diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-06-09 04:37:29 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-06-09 04:37:29 +0000 |
commit | 8eae4fc054a6f522d9cbc24dbe824838056f0dcf (patch) | |
tree | 83c35c3a15e9c20ce944add18fbc7fc8d1f6ece1 /hcid/dbus-hci.c | |
parent | 4aa07a5ae2035b9ad13c63c3cb85192c85d85252 (diff) |
Add support for Simple Pairing User Notification event
Diffstat (limited to 'hcid/dbus-hci.c')
-rw-r--r-- | hcid/dbus-hci.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c index b2df0e69..6b9d06bd 100644 --- a/hcid/dbus-hci.c +++ b/hcid/dbus-hci.c @@ -1174,6 +1174,40 @@ int hcid_dbus_user_passkey(bdaddr_t *sba, bdaddr_t *dba) return 0; } +int hcid_dbus_user_notify(bdaddr_t *sba, bdaddr_t *dba, uint32_t passkey) +{ + struct adapter *adapter; + struct device *device; + struct agent *agent; + char addr[18]; + + adapter = adapter_find(sba); + if (!adapter) { + error("No matching adapter found"); + return -1; + } + + ba2str(dba, addr); + + device = adapter_get_device(connection, adapter, addr); + if (device && device->agent) + agent = device->agent; + else + agent = adapter->agent; + + if (!agent) { + error("No agent available for user confirm request"); + return -1; + } + + if (agent_display_passkey(agent, device, passkey) < 0) { + error("Displaying passkey failed"); + return -1; + } + + return 0; +} + void hcid_dbus_bonding_process_complete(bdaddr_t *local, bdaddr_t *peer, uint8_t status) { |