* [Bluez-devel] [DBUS PATCH] HasBonding
@ 2006-02-20 18:44 Claudio Takahasi
2006-02-20 20:35 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: Claudio Takahasi @ 2006-02-20 18:44 UTC (permalink / raw)
To: bluez-devel
[-- Attachment #1: Type: text/plain, Size: 272 bytes --]
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
[-- Attachment #2: has-bonding01.patch --]
[-- Type: text/x-patch, Size: 2383 bytes --]
--- bluez-utils-cvs.orig/hcid/hcid.h 2006-02-12 03:49:17.000000000 -0200
+++ bluez-utils-cvs-has-bonding/hcid/hcid.h 2006-02-20 12:38:29.000000000 -0300
@@ -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);
--- bluez-utils-cvs.orig/hcid/device.c 2006-02-12 04:33:18.000000000 -0200
+++ bluez-utils-cvs-has-bonding/hcid/device.c 2006-02-20 12:38:06.000000000 -0300
@@ -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;
--- bluez-utils-cvs.orig/hcid/dbus-device.c 2006-02-15 15:44:38.000000000 -0200
+++ bluez-utils-cvs-has-bonding/hcid/dbus-device.c 2006-02-20 12:37:40.000000000 -0300
@@ -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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bluez-devel] [DBUS PATCH] HasBonding
2006-02-20 18:44 [Bluez-devel] [DBUS PATCH] HasBonding Claudio Takahasi
@ 2006-02-20 20:35 ` Marcel Holtmann
2006-02-20 22:15 ` Claudio Takahasi
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2006-02-20 20:35 UTC (permalink / raw)
To: bluez-devel
Hi Claudio,
> 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
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bluez-devel] [DBUS PATCH] HasBonding
2006-02-20 20:35 ` Marcel Holtmann
@ 2006-02-20 22:15 ` Claudio Takahasi
0 siblings, 0 replies; 3+ messages in thread
From: Claudio Takahasi @ 2006-02-20 22:15 UTC (permalink / raw)
To: bluez-devel
Thanks for fixing the code.
I didn't know the correct textfile_get function usage.
Regards,
Claudio.
On 2/20/06, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Claudio,
>
> > Here is the patch to check if there is a link key available for a remot=
e 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 fi=
les
> 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
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> 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
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-02-20 22:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-20 18:44 [Bluez-devel] [DBUS PATCH] HasBonding Claudio Takahasi
2006-02-20 20:35 ` Marcel Holtmann
2006-02-20 22:15 ` Claudio Takahasi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.