From 6033ee0c9966238f3732e945841d85ddb5162cc2 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 3 Jan 2007 12:14:01 +0000 Subject: Add disconnection delay and RemoteDeviceDisconnectRequested signal for the DisconnectRemoteDevice method --- hcid/dbus-hci.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'hcid/dbus-hci.c') 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", -- cgit