diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-01-03 12:14:01 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-01-03 12:14:01 +0000 |
commit | 6033ee0c9966238f3732e945841d85ddb5162cc2 (patch) | |
tree | 76d609cb63074d1038187bb29833105493a4517e /hcid/dbus-hci.c | |
parent | d21f13975ab07dcf9ec8b51fd764d1c5a9b76f92 (diff) |
Add disconnection delay and RemoteDeviceDisconnectRequested signal for the DisconnectRemoteDevice method
Diffstat (limited to 'hcid/dbus-hci.c')
-rw-r--r-- | hcid/dbus-hci.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c index 51f3ca65..8fd443b6 100644 --- a/hcid/dbus-hci.c +++ b/hcid/dbus-hci.c @@ -473,6 +473,14 @@ int unregister_adapter_path(const char *path) adapter->active_conn = NULL; } + /* Check if there is a pending RemoteDeviceDisconnect request */ + if (adapter->pending_dc) { + error_no_such_adapter(adapter->pending_dc->conn, + adapter->pending_dc->msg); + g_timeout_remove(adapter->pending_dc->timeout_id); + dc_pending_timeout_cleanup(adapter); + } + free (adapter); unreg: @@ -1742,6 +1750,20 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status, adapter->bonding = NULL; } + /* Check if there is a pending RemoteDeviceDisconnect request */ + if (adapter->pending_dc) { + DBusMessage *reply; + + reply = dbus_message_new_method_return(adapter->pending_dc->msg); + if (!reply) + error("Failed to allocate disconnect reply"); + else + send_message_and_unref(adapter->pending_dc->conn, reply); + + g_timeout_remove(adapter->pending_dc->timeout_id); + dc_pending_timeout_cleanup(adapter); + } + /* Send the remote device disconnected signal */ message = dev_signal_factory(adapter->dev_id, "RemoteDeviceDisconnected", |