summaryrefslogtreecommitdiffstats
path: root/dundee
diff options
context:
space:
mode:
authorPaulo Borges <paulo.borges@openbossa.org>2013-03-20 19:26:34 -0300
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2013-03-24 13:20:18 +0100
commitf0c85c9c558135dec6ec45adb692c0e995e44e6b (patch)
tree3f85b39c0eac8b3fe4a9feb28fbefa2171df2e07 /dundee
parent953e74a9457aee433b1e18485dd06196744b172b (diff)
downloadofono-f0c85c9c558135dec6ec45adb692c0e995e44e6b.tar.bz2
dundee: Add mechanism to store bluetooth devices
This patch adds a hash that will store every known bluetooth device that implements DUN service.
Diffstat (limited to 'dundee')
-rw-r--r--dundee/bluez5.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/dundee/bluez5.c b/dundee/bluez5.c
index 5d6e728a..fb5b3154 100644
--- a/dundee/bluez5.c
+++ b/dundee/bluez5.c
@@ -32,6 +32,25 @@
#define DUN_DT_PROFILE_PATH "/bluetooth/profile/dun_dt"
static GDBusClient *bluez;
+static GHashTable *registered_devices;
+
+struct bluetooth_device {
+ char *path;
+ char *address;
+ char *name;
+};
+
+static void bluetooth_device_destroy(gpointer user_data)
+{
+ struct bluetooth_device *bt_device = user_data;
+
+ DBG("%s", bt_device->path);
+
+ g_free(bt_device->path);
+ g_free(bt_device->address);
+ g_free(bt_device->name);
+ g_free(bt_device);
+}
static void proxy_added(GDBusProxy *proxy, void *user_data)
{
@@ -62,6 +81,9 @@ int __dundee_bluetooth_init(void)
g_dbus_client_set_connect_watch(bluez, connect_handler, NULL);
g_dbus_client_set_proxy_handlers(bluez, proxy_added, NULL, NULL, NULL);
+ registered_devices = g_hash_table_new_full(g_str_hash, g_str_equal,
+ g_free, bluetooth_device_destroy);
+
return 0;
}
@@ -70,4 +92,5 @@ void __dundee_bluetooth_cleanup(void)
DBG("");
g_dbus_client_unref(bluez);
+ g_hash_table_destroy(registered_devices);
}