From 020e5b1720c971380c3250580db5530dbe358627 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Wed, 9 Jan 2019 18:40:26 -0800 Subject: 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 --- binding/gdbus/ofono_manager.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'binding/gdbus') 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; } } -- cgit 1.2.3-korg