diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-03-09 22:21:27 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-03-09 22:21:27 +0000 |
commit | 96c80bcf3082bfe60dec6e1885511787c65cbcfd (patch) | |
tree | 4aefce94e2c867f7fc6b9d78ce3a869e5d90a145 /hcid/dbus.c | |
parent | 3c1d9df615705539a3d43d46e80f978cf08b9948 (diff) |
avoid multiple inquiry request when there is pending inquiry procedure
Diffstat (limited to 'hcid/dbus.c')
-rw-r--r-- | hcid/dbus.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/hcid/dbus.c b/hcid/dbus.c index 471952b2..bb8d2528 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -281,6 +281,7 @@ static gboolean register_dbus_path(const char *path, uint16_t path_id, uint16_t data->discoverable_timeout = DFT_DISCOVERABLE_TIMEOUT; data->timeout_hits = 0; data->timeout_handler = NULL; + data->busy = 0; if (fallback) { if (!dbus_connection_register_fallback(connection, path, pvtable, data)) { @@ -554,6 +555,7 @@ void hcid_dbus_inquiry_start(bdaddr_t *local) { DBusMessage *message = NULL; char path[MAX_PATH_LENGTH]; + struct hci_dbus_data *pdata = NULL; char *local_addr; bdaddr_t tmp; int id; @@ -568,6 +570,10 @@ void hcid_dbus_inquiry_start(bdaddr_t *local) snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id); + if (dbus_connection_get_object_path_data(connection, path, (void*) &pdata)) { + pdata->busy = 1; + } + message = dbus_message_new_signal(path, ADAPTER_INTERFACE, DEV_SIG_DISCOVER_START); if (message == NULL) { @@ -591,6 +597,7 @@ void hcid_dbus_inquiry_complete(bdaddr_t *local) { DBusMessage *message = NULL; char path[MAX_PATH_LENGTH]; + struct hci_dbus_data *pdata = NULL; char *local_addr; bdaddr_t tmp; int id; @@ -605,6 +612,10 @@ void hcid_dbus_inquiry_complete(bdaddr_t *local) snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id); + if (dbus_connection_get_object_path_data(connection, path, (void*) &pdata)) { + pdata->busy = 0; + } + message = dbus_message_new_signal(path, ADAPTER_INTERFACE, DEV_SIG_DISCOVER_COMPLETE); if (message == NULL) { |