diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2010-11-10 18:15:15 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-11-10 18:15:15 +0100 |
commit | 8333817dae08600bc2f4a84b499108ca1c39b4e2 (patch) | |
tree | 2a729fc4e7df6555cf3835f046ee3efc2b439420 /plugins/bluetooth.c | |
parent | 5cb8bb1ba90826b09f1e443336f15f379cd6955b (diff) | |
download | connman-8333817dae08600bc2f4a84b499108ca1c39b4e2.tar.gz connman-8333817dae08600bc2f4a84b499108ca1c39b4e2.tar.bz2 connman-8333817dae08600bc2f4a84b499108ca1c39b4e2.zip |
tethering: Add async tethering_enabled callback
Diffstat (limited to 'plugins/bluetooth.c')
-rw-r--r-- | plugins/bluetooth.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index 9a73e96f..984a647f 100644 --- a/plugins/bluetooth.c +++ b/plugins/bluetooth.c @@ -36,6 +36,7 @@ #include <connman/technology.h> #include <connman/device.h> #include <connman/inet.h> +#include <connman/tethering.h> #include <connman/dbus.h> #include <connman/log.h> @@ -968,8 +969,35 @@ static void server_register_reply(DBusPendingCall *call, void *user_data) dbus_message_unref(reply); dbus_pending_call_unref(call); + connman_tethering_enabled(); } +static void server_unregister_reply(DBusPendingCall *call, void *user_data) +{ + DBusError error; + DBusMessage *reply; + + DBG(""); + + reply = dbus_pending_call_steal_reply(call); + + dbus_error_init(&error); + + if (dbus_set_error_from_message(&error, reply) == TRUE) { + connman_error("%s", error.message); + dbus_error_free(&error); + dbus_message_unref(reply); + dbus_pending_call_unref(call); + return; + } + + dbus_message_unref(reply); + dbus_pending_call_unref(call); + + connman_tethering_disabled(); +} + + static void server_register(const char *path, const char *uuid, const char *bridge, connman_bool_t enabled) { @@ -1008,8 +1036,12 @@ static void server_register(const char *path, const char *uuid, return; } - dbus_pending_call_set_notify(call, server_register_reply, - g_strdup(path), g_free); + if (enabled == TRUE) + dbus_pending_call_set_notify(call, server_register_reply, + NULL, NULL); + else + dbus_pending_call_set_notify(call, server_unregister_reply, + NULL, NULL); dbus_message_unref(message); } @@ -1021,6 +1053,8 @@ static void enable_nap(gpointer key, gpointer value, const char *bridge = user_data; const char *path; + DBG(""); + path = connman_device_get_string(device, "Path"); server_register(path, "nap", bridge, TRUE); @@ -1033,6 +1067,8 @@ static void disable_nap(gpointer key, gpointer value, const char *bridge = user_data; const char *path; + DBG(""); + path = connman_device_get_string(device, "Path"); server_register(path, "nap", bridge, FALSE); |