summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2013-01-23 15:27:55 -0300
committerDenis Kenzior <denkenz@gmail.com>2013-01-23 14:18:18 -0600
commit71986b67a3857645a1d1f6647b29ed713c2f165f (patch)
tree55503c5e337932d5b5acf7bf2c6b79bb314f30f7
parent67cdf33fe807c228adbc2be6ead239a4a0502e62 (diff)
downloadofono-71986b67a3857645a1d1f6647b29ed713c2f165f.tar.bz2
hfp_hf_bluez5: Follow HFP AG device Alias property
If the device Alias property changes we should also change the name of the modem.
-rw-r--r--plugins/hfp_hf_bluez5.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index fbb1be32..91bafafc 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -258,12 +258,28 @@ static void proxy_removed(GDBusProxy *proxy, void *user_data)
static void property_changed(GDBusProxy *proxy, const char *name,
DBusMessageIter *iter, void *user_data)
{
- const char *interface, *path;
+ const char *interface, *path, *alias;
+ struct ofono_modem *modem;
+ DBusMessageIter alias_iter;
interface = g_dbus_proxy_get_interface(proxy);
path = g_dbus_proxy_get_path(proxy);
DBG("path: %s interface: %s", path, interface);
+
+ if (g_str_equal(BLUEZ_DEVICE_INTERFACE, interface) == FALSE)
+ return;
+
+ if (g_dbus_proxy_get_property(proxy, "Alias", &alias_iter) == FALSE)
+ return;
+
+ dbus_message_iter_get_basic(&alias_iter, &alias);
+
+ modem = g_hash_table_lookup(modem_hash, path);
+ if (modem == NULL)
+ return;
+
+ ofono_modem_set_name(modem, alias);
}
static int hfp_init(void)