diff options
author | Wim Taymans <wtaymans@redhat.com> | 2014-08-07 23:13:12 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2014-08-07 23:13:12 +0200 |
commit | 4c6007ce197ba7fc37dcd20e1fbd780b3cc4f2a8 (patch) | |
tree | e758a3e5c8de3939b1e87d6a65c40c95ede043cb /src | |
parent | 9957550cc9c0cfb30c4781852f0d5ef4336eaddb (diff) |
manager: implement GetDevices()
Diffstat (limited to 'src')
-rw-r--r-- | src/hsd-headset.c | 2 | ||||
-rw-r--r-- | src/hsd-manager.c | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/hsd-headset.c b/src/hsd-headset.c index 1b81d19..dcea642 100644 --- a/src/hsd-headset.c +++ b/src/hsd-headset.c @@ -404,7 +404,7 @@ rfcomm_io_cb (GIOChannel *source, GIOCondition condition, gpointer data) GIOStatus st; HsdHeadset *h = data; - g_debug ("condition %d\n", condition); + g_debug ("condition %d", condition); if (condition & (G_IO_ERR | G_IO_HUP)) return FALSE; diff --git a/src/hsd-manager.c b/src/hsd-manager.c index 2ef38ca..8cf691f 100644 --- a/src/hsd-manager.c +++ b/src/hsd-manager.c @@ -66,13 +66,25 @@ manager_get_devices (HsdManager *m, GVariant *parameters, GDBusMethodInvocation *invocation) { - GVariant *var; + GVariantBuilder *devices; + GHashTableIter iter; + gpointer key, value; g_debug ("manager GetDevices"); - var = g_variant_new_array (G_VARIANT_TYPE ("(oa{sv})"), NULL, 0); + devices = g_variant_builder_new (G_VARIANT_TYPE ("a(oa{sv})")); + + g_hash_table_iter_init (&iter, m->devices); + while (g_hash_table_iter_next (&iter, &key, &value)) { + GVariantBuilder *props; + + props = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}")); + + g_variant_builder_add (devices, "(oa{sv})", key, props); + } + g_dbus_method_invocation_return_value ( - invocation, g_variant_new_tuple (&var, 1)); + invocation, g_variant_new ("(a(oa{sv}))", devices)); } static void |