diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-04-24 18:19:24 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2007-04-24 18:19:24 +0000 |
commit | 3286581f8afecebbdae8a9f9ae96fefda8c611a8 (patch) | |
tree | 343821265c6d8590c744c250f03faafd631512dd | |
parent | 712a6619937ca6109be36f3b764da6c388a0b487 (diff) |
Send signal when requesting remote device name
-rw-r--r-- | hcid/dbus-api.txt | 5 | ||||
-rw-r--r-- | hcid/dbus-hci.c | 27 |
2 files changed, 24 insertions, 8 deletions
diff --git a/hcid/dbus-api.txt b/hcid/dbus-api.txt index 42aad463..bca8a2c8 100644 --- a/hcid/dbus-api.txt +++ b/hcid/dbus-api.txt @@ -1033,6 +1033,11 @@ Signals void ModeChanged(string mode) This signal will be sent every time the service daemon tries to resolve a remote and this fails. + void RemoteNameRequested(string address) + + This signal will be sent every time the service daemon + tries to resolve a remote name during discovery. + void RemoteAliasChanged(string address, string alias) After changing an alias with SetRemoteAlias this diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c index ca25dd70..e9a03b22 100644 --- a/hcid/dbus-hci.c +++ b/hcid/dbus-hci.c @@ -1005,7 +1005,7 @@ int found_device_req_name(struct adapter *adapter) /* send at least one request or return failed if the list is empty */ do { - DBusMessage *failed_signal = NULL; + DBusMessage *signal = NULL; struct remote_dev_info *dev = l->data; char *peer_addr; bdaddr_t tmp; @@ -1023,7 +1023,7 @@ int found_device_req_name(struct adapter *adapter) if (hci_send_req(dd, &rq, 500) < 0) { error("Unable to send the HCI remote name request: %s (%d)", strerror(errno), errno); - failed_signal = dev_signal_factory(adapter->dev_id, + signal = dev_signal_factory(adapter->dev_id, "RemoteNameFailed", DBUS_TYPE_STRING, &peer_addr, DBUS_TYPE_INVALID); @@ -1032,21 +1032,32 @@ int found_device_req_name(struct adapter *adapter) if (rp.status) { error("Remote name request failed with status 0x%02x", rp.status); - failed_signal = dev_signal_factory(adapter->dev_id, + signal = dev_signal_factory(adapter->dev_id, "RemoteNameFailed", DBUS_TYPE_STRING, &peer_addr, DBUS_TYPE_INVALID); } + if (!signal) { + req_sent = 1; + /* if we are in discovery, inform application of getting name */ + if (adapter->discov_type & (STD_INQUIRY | PERIODIC_INQUIRY)) { + signal = dev_signal_factory(adapter->dev_id, + "RemoteNameRequested", + DBUS_TYPE_STRING, &peer_addr, + DBUS_TYPE_INVALID); + } + } + free(peer_addr); - if (!failed_signal) { - req_sent = 1; - break; + if (signal) { + send_message_and_unref(connection, signal); + signal = NULL; } - send_message_and_unref(connection, failed_signal); - failed_signal = NULL; + if (req_sent) + break; /* if failed, request the next element */ /* remove the element from the list */ |