summaryrefslogtreecommitdiffstats
path: root/binding/gdbus/ofono_manager.c
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-04-04 16:01:15 -0700
commit020e5b1720c971380c3250580db5530dbe358627 (patch)
tree3dba3528fbb15fb579fbb5d75c33d250acb16eba /binding/gdbus/ofono_manager.c
parent8d4abe69907961af0dd5f872b157c58241b0e107 (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/ofono_manager.c')
-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;
}
}