diff options
author | Paulo Borges <paulo.borges@openbossa.org> | 2013-03-20 19:26:39 -0300 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2013-03-24 13:22:17 +0100 |
commit | ce933c58a8470be0b1aad2916bc90d978f39e963 (patch) | |
tree | 3f0633367810e7c061d5b011426ea090640f2d9a /dundee | |
parent | a3ce2daccd117c020029f842c79947b96ef1abf9 (diff) | |
download | android_external_ofono-ce933c58a8470be0b1aad2916bc90d978f39e963.tar.gz android_external_ofono-ce933c58a8470be0b1aad2916bc90d978f39e963.tar.bz2 android_external_ofono-ce933c58a8470be0b1aad2916bc90d978f39e963.zip |
dundee: Add BlueZ Profile handler
This patch declares the external dundee Profile handler. It
contains the initial implementation of the D-Bus Profile1
interface and methods responsible for handling Bluetooth
connections.
Diffstat (limited to 'dundee')
-rw-r--r-- | dundee/bluez5.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/dundee/bluez5.c b/dundee/bluez5.c index 37ac4d08..e927835a 100644 --- a/dundee/bluez5.c +++ b/dundee/bluez5.c @@ -25,6 +25,7 @@ #include <stdint.h> #include <sys/socket.h> #include <gdbus.h> +#include <errno.h> #include "dundee.h" #include "plugins/bluez5.h" @@ -42,6 +43,59 @@ struct bluetooth_device { char *name; }; +static DBusMessage *profile_new_connection(DBusConnection *conn, + DBusMessage *msg, void *user_data) +{ + DBG(""); + + return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE + ".NotImplemented", + "Implementation not provided"); +} + +static DBusMessage *profile_release(DBusConnection *conn, + DBusMessage *msg, void *user_data) +{ + DBG(""); + + return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE + ".NotImplemented", + "Implementation not provided"); +} + +static DBusMessage *profile_cancel(DBusConnection *conn, + DBusMessage *msg, void *user_data) +{ + DBG(""); + + return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE + ".NotImplemented", + "Implementation not provided"); +} + +static DBusMessage *profile_disconnection(DBusConnection *conn, + DBusMessage *msg, void *user_data) +{ + DBG(""); + + return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE + ".NotImplemented", + "Implementation not provided"); +} + +static const GDBusMethodTable profile_methods[] = { + { GDBUS_ASYNC_METHOD("NewConnection", + GDBUS_ARGS({ "device", "o"}, { "fd", "h"}, + { "fd_properties", "a{sv}" }), + NULL, profile_new_connection) }, + { GDBUS_METHOD("Release", NULL, NULL, profile_release) }, + { GDBUS_METHOD("Cancel", NULL, NULL, profile_cancel) }, + { GDBUS_METHOD("RequestDisconnection", + GDBUS_ARGS({"device", "o"}), NULL, + profile_disconnection) }, + { } +}; + static void bluetooth_device_destroy(gpointer user_data) { struct bluetooth_device *bt_device = user_data; @@ -235,6 +289,15 @@ int __dundee_bluetooth_init(void) DBG(""); + if (!g_dbus_register_interface(conn, DUN_DT_PROFILE_PATH, + BLUEZ_PROFILE_INTERFACE, + profile_methods, NULL, + NULL, NULL, NULL)) { + ofono_error("Register Profile interface failed: %s", + DUN_DT_PROFILE_PATH); + return -EIO; + } + 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); @@ -247,8 +310,13 @@ int __dundee_bluetooth_init(void) void __dundee_bluetooth_cleanup(void) { + DBusConnection *conn = ofono_dbus_get_connection(); + DBG(""); + g_dbus_unregister_interface(conn, DUN_DT_PROFILE_PATH, + BLUEZ_PROFILE_INTERFACE); + g_dbus_client_unref(bluez); g_hash_table_destroy(registered_devices); } |