diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-12-13 22:00:39 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-12-13 22:13:40 +0200 |
commit | da29958e9439d900c67ca0947e3e71d7be6b3515 (patch) | |
tree | b848da0e7ef3c7bb0bc1c06ace421c93191db700 /src | |
parent | 399baa05cc9fbc9f6f523f084e622f0f4bca30f8 (diff) | |
download | bluez-da29958e9439d900c67ca0947e3e71d7be6b3515.tar.gz |
core: Remove RequestSession and ReleaseSession
Sessions is no longer used by obexd and the concept is probably not
relevant anymore since BlueZ 5 don't remember powered state anymore.
Diffstat (limited to 'src')
-rw-r--r-- | src/adapter.c | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/src/adapter.c b/src/adapter.c index 15db015f2..0fb2c04cd 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -336,18 +336,6 @@ static int adapter_set_mode(struct btd_adapter *adapter, uint8_t mode) return err; } -static struct session_req *find_session_by_msg(GSList *list, const DBusMessage *msg) -{ - for (; list; list = list->next) { - struct session_req *req = list->data; - - if (req->msg == msg) - return req; - } - - return NULL; -} - static int set_mode(struct btd_adapter *adapter, uint8_t new_mode) { int err; @@ -389,24 +377,6 @@ done: return 0; } -static void set_session_pending_mode(struct btd_adapter *adapter, - uint8_t new_mode, DBusMessage *msg) -{ - struct session_req *req; - - /* - * Schedule the reply to be sent when a mode-change notification - * arrives. The reply will be sent by set_mode_complete(). - */ - req = find_session_by_msg(adapter->mode_sessions, msg); - if (req) { - adapter->pending_mode = req; - session_ref(req); - } else - adapter->pending_mode = create_session(adapter, msg, new_mode, - SESSION_TYPE_MODE_SESSION, NULL); -} - static void set_discoverable(struct btd_adapter *adapter, gboolean discoverable, GDBusPendingPropertySet id) { @@ -729,45 +699,6 @@ static void session_unref(struct session_req *req) session_free(req); } -static void confirm_mode_cb(struct agent *agent, DBusError *derr, void *data) -{ - DBusConnection *conn = btd_get_dbus_connection(); - struct session_req *req = data; - int err; - DBusMessage *reply; - - req->got_reply = TRUE; - - if (derr && dbus_error_is_set(derr)) { - reply = dbus_message_new_error(req->msg, derr->name, - derr->message); - g_dbus_send_message(conn, reply); - session_unref(req); - return; - } - - err = set_mode(req->adapter, req->mode); - if (err >= 0 && req->adapter->mode != req->mode) { - set_session_pending_mode(req->adapter, req->mode, req->msg); - goto done; - } - - if (err < 0) - reply = btd_error_failed(req->msg, strerror(-err)); - else - reply = dbus_message_new_method_return(req->msg); - - /* - * Send reply immediately only if there was an error changing mode, or - * change is not needed. Otherwise, reply is sent in - * set_mode_complete. - */ - g_dbus_send_message(conn, reply); - -done: - session_unref(req); -} - static void set_discoverable_timeout(struct btd_adapter *adapter, uint32_t timeout, GDBusPendingPropertySet id) { @@ -1406,67 +1337,6 @@ static gboolean adapter_property_get_uuids(const GDBusPropertyTable *property, return TRUE; } -static DBusMessage *request_session(DBusConnection *conn, - DBusMessage *msg, void *data) -{ - struct btd_adapter *adapter = data; - struct session_req *req; - const char *sender = dbus_message_get_sender(msg); - uint8_t new_mode; - int err; - - if (!adapter->agent) - return btd_error_agent_not_available(msg); - - if (!adapter->mode_sessions) - adapter->global_mode = adapter->mode; - - if (adapter->discoverable) - new_mode = MODE_DISCOVERABLE; - else - new_mode = MODE_CONNECTABLE; - - req = find_session(adapter->mode_sessions, sender); - if (req) { - session_ref(req); - return dbus_message_new_method_return(msg); - } else { - req = create_session(adapter, msg, new_mode, - SESSION_TYPE_MODE_SESSION, session_owner_exit); - adapter->mode_sessions = g_slist_append(adapter->mode_sessions, - req); - } - - /* No need to change mode */ - if (adapter->mode >= new_mode) - return dbus_message_new_method_return(msg); - - err = agent_confirm_mode_change(adapter->agent, mode2str(new_mode), - confirm_mode_cb, req, NULL); - if (err < 0) { - session_unref(req); - return btd_error_failed(msg, strerror(-err)); - } - - return NULL; -} - -static DBusMessage *release_session(DBusConnection *conn, - DBusMessage *msg, void *data) -{ - struct btd_adapter *adapter = data; - struct session_req *req; - const char *sender = dbus_message_get_sender(msg); - - req = find_session(adapter->mode_sessions, sender); - if (!req) - return btd_error_failed(msg, "Invalid Session"); - - session_unref(req); - - return dbus_message_new_method_return(msg); -} - static uint8_t parse_io_capability(const char *capability) { if (g_str_equal(capability, "")) @@ -1581,10 +1451,6 @@ static DBusMessage *unregister_agent(DBusConnection *conn, DBusMessage *msg, } static const GDBusMethodTable adapter_methods[] = { - { GDBUS_ASYNC_METHOD("RequestSession", NULL, NULL, - request_session) }, - { GDBUS_METHOD("ReleaseSession", NULL, NULL, - release_session) }, { GDBUS_METHOD("StartDiscovery", NULL, NULL, adapter_start_discovery) }, { GDBUS_ASYNC_METHOD("StopDiscovery", NULL, NULL, |