HasBonding
PATCH 1/1 HasBonding
Hi Marcel,
Here is the patch to check if there is a link key available for a remote device. Do you have suggestions/comments?
Regards,
Claudio.
--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT
hcid/hcid.h +1 -0
@@ -154,6 +154,7 @@int stop_device (uint16_t dev_id);int get_device_address (uint16_t dev_id,char *address,size_t size); +int get_device_bluetooth_address (uint16_t dev_id,bdaddr_t *ba);int get_device_version (uint16_t dev_id,char *version,size_t size);int get_device_revision (uint16_t dev_id,char *revision,size_t size);int get_device_manufacturer (uint16_t dev_id,char *manufacturer,size_t size);
hcid/device.c +13 -0
@@ -227,6 +227,19 @@return ba2str (&dev->bdaddr, address); } +int get_device_bluetooth_address (uint16_t dev_id,bdaddr_t *ba) +{ +struct hci_dev *dev; + +ASSERT_DEV_ID ; + + dev = &devices[dev_id]; + +memcpy (ba, &dev->bdaddr,sizeof (dev->bdaddr)); + +return 0 ; +} +int get_device_version (uint16_t dev_id,char *version,size_t size) {struct hci_dev *dev;
hcid/dbus-device.c +31 -2
@@ -735,8 +735,37 @@static DBusMessage *handle_dev_has_bonding_req (DBusMessage *msg,void *data) { -/*FIXME: */ -return bluez_new_failure_msg (msg,BLUEZ_EDBUS_NOT_IMPLEMENTED ); +unsigned char key[16 ]; +struct hci_dbus_data *dbus_data = data; +DBusMessage *reply =NULL ; +const char *str_bdaddr; +bdaddr_t dba; +bdaddr_t sba; +dbus_bool_t result = FALSE; + +dbus_message_get_args (msg,NULL , +DBUS_TYPE_STRING , &str_bdaddr, +DBUS_TYPE_INVALID ); + +/* basic arguments validation */ +if (!str_bdaddr ||strlen (str_bdaddr) !=17 ) +return bluez_new_failure_msg (msg,BLUEZ_EDBUS_WRONG_PARAM ); + +str2ba (str_bdaddr, &dba); + +/* get the local Bluetooth Address */ +get_device_bluetooth_address (dbus_data->dev_id, &sba); + +/* check if there is a link key associated to the remote device */ +if (!read_link_key (&sba, &dba, key)) + result = TRUE; + + reply =dbus_message_new_method_return (msg); + +dbus_message_append_args (reply,DBUS_TYPE_BOOLEAN , &result, +DBUS_TYPE_INVALID ); + +return reply; }static DBusMessage *handle_dev_remove_bonding_req (DBusMessage *msg,void *data)
Marcel Holtmann
maintainerHi Claudio,
Quoted 2 lines
Here is the patch to check if there is a link key available for a remote device. Do you have suggestions/comments?
there is no need for a get_device_bluetooth_address() helper function, but the rest of your patch has been applied to the CVS.
Regards
Marcel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Thanks for fixing the code.
I didn't know the correct textfile_get function usage.
Regards,
Claudio.
Quoted 3 lines · Marcel Holtmann
Hi Claudio,
Quoted 1 line
Here is the patch to check if there is a link key available for a remot=
e device.
Quoted 7 lines
Quoted 1 line
Do you have suggestions/comments?
there is no need for a
get_device_bluetooth_address()helper function, but the rest of your patch has been applied to the CVS.Regards
Quoted 7 lines
Marcel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi=
les
Quoted 3 lines
for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat=
=3D121642
Quoted 5 lines
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel