summaryrefslogtreecommitdiffstats
path: root/binding/gdbus
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-01-09 18:40:26 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-01-29 22:56:25 -0800
commita96d4695e4cca3f0590ddcf4c8346fcc38236a56 (patch)
tree6f8456630b39140bc7a59937ebb4b10e461469a4 /binding/gdbus
parentcf9ca2650ac61ac9ebb4441007e6337c32eaf03f (diff)
binding: telephony: remove bluetooth dependency
By subscribing to org.ofono.Modem PropertyChanged events it can be detected when a handsfree profile device is connected. In turn the bluetooth service access is no longer needed. Bug-AGL: SPEC-2117 Change-Id: Iae92c66962ac88e07d58d75e566ae31e7128c831 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/gdbus')
-rw-r--r--binding/gdbus/ofono_manager.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/binding/gdbus/ofono_manager.c b/binding/gdbus/ofono_manager.c
index 1086beb..98d8c5b 100644
--- a/binding/gdbus/ofono_manager.c
+++ b/binding/gdbus/ofono_manager.c
@@ -69,8 +69,19 @@ int ofono_manager_set_default_modem(const char *address)
else if (!strcmp(key, "Type"))
type = g_variant_get_string(value, NULL);
}
- /* If the HFP modem matches the BT address, is powered, and online then set as default */
- if (!g_strcmp0(type, "hfp") && !g_strcmp0(address, serial) && powered && online) {
+
+ /* If not a HFP modem then continue */
+ if (g_strcmp0(type, "hfp"))
+ continue;
+
+ /* If address is NULL then use the first modem as default,
+ * and if not then continue if doesn't match address.
+ */
+ if (address && g_strcmp0(address, serial))
+ continue;
+
+ /* If powered, and online then set as default */
+ if (powered && online) {
default_modem.address = serial;
default_modem.path = path;
default_modem.name = name;
@@ -78,7 +89,7 @@ int ofono_manager_set_default_modem(const char *address)
default_modem.powered = powered;
default_modem.online = online;
default_modem.valid = TRUE;
- AFB_NOTICE("New modem: %s (%s)", name, address);
+ AFB_NOTICE("New modem: %s (%s)", name, serial);
break;
}
}