summaryrefslogtreecommitdiffstats
path: root/dundee
diff options
context:
space:
mode:
authorPaulo Borges <paulo.borges@openbossa.org>2013-03-20 19:26:33 -0300
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2013-03-24 13:20:16 +0100
commit953e74a9457aee433b1e18485dd06196744b172b (patch)
tree9456bbd1d4c9cb3344febbba2bb40b8436fe7764 /dundee
parentd26dab944c16eeb113f68e8cfd90071b353530e6 (diff)
downloadofono-953e74a9457aee433b1e18485dd06196744b172b.tar.bz2
dundee: Initial GDBusClient for BlueZ 5
This patch adds callbacks to track additions of BlueZ related interfaces.
Diffstat (limited to 'dundee')
-rw-r--r--dundee/bluez5.c36
-rw-r--r--dundee/dundee.h2
2 files changed, 38 insertions, 0 deletions
diff --git a/dundee/bluez5.c b/dundee/bluez5.c
index 6685b4c4..5d6e728a 100644
--- a/dundee/bluez5.c
+++ b/dundee/bluez5.c
@@ -22,16 +22,52 @@
#include <config.h>
#endif
+#include <stdint.h>
+#include <sys/socket.h>
+#include <gdbus.h>
+
#include "dundee.h"
+#include "plugins/bluez5.h"
+
+#define DUN_DT_PROFILE_PATH "/bluetooth/profile/dun_dt"
+
+static GDBusClient *bluez;
+
+static void proxy_added(GDBusProxy *proxy, void *user_data)
+{
+ const char *path = g_dbus_proxy_get_path(proxy);
+ const char *interface = g_dbus_proxy_get_interface(proxy);
+
+ if (!g_str_equal(BLUEZ_DEVICE_INTERFACE, interface))
+ return;
+
+ DBG("%s %s", path, interface);
+}
+
+static void connect_handler(DBusConnection *conn, void *user_data)
+{
+ DBG("");
+
+ bt_register_profile_with_role(conn, DUN_GW_UUID, DUN_VERSION_1_2,
+ "dun_dt", DUN_DT_PROFILE_PATH, "client");
+}
int __dundee_bluetooth_init(void)
{
+ DBusConnection *conn = ofono_dbus_get_connection();
+
DBG("");
+ bluez = g_dbus_client_new(conn, BLUEZ_SERVICE, BLUEZ_MANAGER_PATH);
+ g_dbus_client_set_connect_watch(bluez, connect_handler, NULL);
+ g_dbus_client_set_proxy_handlers(bluez, proxy_added, NULL, NULL, NULL);
+
return 0;
}
void __dundee_bluetooth_cleanup(void)
{
DBG("");
+
+ g_dbus_client_unref(bluez);
}
diff --git a/dundee/dundee.h b/dundee/dundee.h
index db932b63..daf78a54 100644
--- a/dundee/dundee.h
+++ b/dundee/dundee.h
@@ -26,6 +26,8 @@
#include <ofono/types.h>
+#define DUN_VERSION_1_2 0x0102
+
void __dundee_exit(void);
enum dundee_error_type {