summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2006-11-29 15:03:43 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2006-11-29 15:03:43 +0000
commit6fdf5128e0ed914eead1c3897382e80d51cc9629 (patch)
tree69b94be3b0e1ea62cc596404932ea35d01ea20dd /hcid
parent135f79c35257dc7bced182f1e4ae60b3fcdc9602 (diff)
Send RemoteDeviceDisconnected for all connected devices when HCI_DEV_DOWN event is received
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-hci.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c
index e39a0968..14efb861 100644
--- a/hcid/dbus-hci.c
+++ b/hcid/dbus-hci.c
@@ -672,6 +672,23 @@ failed:
return ret;
}
+static void send_dc_signal(struct active_conn_info *dev, const char *path)
+{
+ DBusMessage *message;
+ char addr[18];
+ const char *paddr = addr;
+
+ ba2str(&dev->bdaddr, addr);
+
+ message = dbus_message_new_signal(path, ADAPTER_INTERFACE,
+ "RemoteDeviceDisconnected");
+ dbus_message_append_args(message,
+ DBUS_TYPE_STRING, &paddr,
+ DBUS_TYPE_INVALID);
+
+ send_message_and_unref(connection, message);
+}
+
int hcid_dbus_stop_device(uint16_t id)
{
char path[MAX_PATH_LENGTH];
@@ -695,13 +712,6 @@ int hcid_dbus_stop_device(uint16_t id)
/* check pending requests */
reply_pending_requests(path, adapter);
- message = dev_signal_factory(adapter->dev_id, "ModeChanged",
- DBUS_TYPE_STRING, &scan_mode,
- DBUS_TYPE_INVALID);
-
- send_message_and_unref(connection, message);
-
-
cancel_passkey_agent_requests(adapter->passkey_agents, path, NULL);
release_passkey_agents(adapter, NULL);
@@ -741,11 +751,18 @@ int hcid_dbus_stop_device(uint16_t id)
}
if (adapter->active_conn) {
+ slist_foreach(adapter->active_conn, (slist_func_t) send_dc_signal, path);
slist_foreach(adapter->active_conn, (slist_func_t) free, NULL);
slist_free(adapter->active_conn);
adapter->active_conn = NULL;
}
+ message = dev_signal_factory(adapter->dev_id, "ModeChanged",
+ DBUS_TYPE_STRING, &scan_mode,
+ DBUS_TYPE_INVALID);
+
+ send_message_and_unref(connection, message);
+
adapter->up = 0;
adapter->mode = SCAN_DISABLED;
adapter->discov_active = 0;