summaryrefslogtreecommitdiffstats
path: root/hcid/dbus.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2006-09-05 20:39:15 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2006-09-05 20:39:15 +0000
commitf1604b8852a3d166363d18e750281a427e2ff948 (patch)
tree9fa5244abd6cbf84b980d9f3ed8ec7b18aa08499 /hcid/dbus.c
parentadf984f0cb0829b4509fdbe8bb8e3ded9c7e496c (diff)
Reply for CancelDiscovery now sent before send DiscoveryCompleted
Diffstat (limited to 'hcid/dbus.c')
-rw-r--r--hcid/dbus.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/hcid/dbus.c b/hcid/dbus.c
index f3333e6d..0cdb5ccf 100644
--- a/hcid/dbus.c
+++ b/hcid/dbus.c
@@ -381,7 +381,14 @@ static void reply_pending_requests(const char *path, struct hci_dbus_data *pdata
pdata->bonding = NULL;
}
else if (pdata->discover_state != STATE_IDLE) {
- /* pending inquiry */
+
+ /* If there is a pending reply for discovery cancel */
+ if (pdata->discovery_cancel) {
+ message = dbus_message_new_method_return(pdata->discovery_cancel);
+ send_reply_and_unref(connection, message);
+ dbus_message_unref(pdata->discovery_cancel);
+ pdata->discovery_cancel = NULL;
+ }
/* Send discovery completed signal if there isn't name to resolve */
message = dbus_message_new_signal(path, ADAPTER_INTERFACE,
@@ -1009,6 +1016,14 @@ void hcid_dbus_inquiry_complete(bdaddr_t *local)
pdata->discovery_requestor = NULL;
}
+ /* If there is a pending reply for discovery cancel */
+ if (pdata->discovery_cancel) {
+ message = dbus_message_new_method_return(pdata->discovery_cancel);
+ send_reply_and_unref(connection, message);
+ dbus_message_unref(pdata->discovery_cancel);
+ pdata->discovery_cancel = NULL;
+ }
+
/* Send discovery completed signal if there isn't name to resolve */
message = dbus_message_new_signal(path, ADAPTER_INTERFACE,
"DiscoveryCompleted");
@@ -1189,10 +1204,6 @@ void hcid_dbus_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status, char
* devices request WITH name resolving
*/
if (pdata->discover_state == STATE_RESOLVING_NAMES) {
- message = dbus_message_new_signal(path, ADAPTER_INTERFACE,
- "DiscoveryCompleted");
-
- send_reply_and_unref(connection, message);
if (pdata->discovery_requestor) {
name_listener_remove(connection, pdata->discovery_requestor,
@@ -1200,6 +1211,18 @@ void hcid_dbus_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status, char
free(pdata->discovery_requestor);
pdata->discovery_requestor = NULL;
}
+
+ /* If there is a pending reply for discovery cancel */
+ if (pdata->discovery_cancel) {
+ message = dbus_message_new_method_return(pdata->discovery_cancel);
+ send_reply_and_unref(connection, message);
+ dbus_message_unref(pdata->discovery_cancel);
+ pdata->discovery_cancel = NULL;
+ }
+
+ message = dbus_message_new_signal(path, ADAPTER_INTERFACE,
+ "DiscoveryCompleted");
+ send_reply_and_unref(connection, message);
}
pdata->discover_state = STATE_IDLE;