linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bluez-devel] [DBUS PATCH] ListBondings
@ 2006-02-20 19:55 Claudio Takahasi
  2006-02-20 20:36 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Claudio Takahasi @ 2006-02-20 19:55 UTC (permalink / raw)
  To: bluez-devel

[-- Attachment #1: Type: text/plain, Size: 235 bytes --]

Hi Marcel,

This is the patch to list bonded devices.

Do you have suggestions/comments?

Regards,
Claudio.
--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT

[-- Attachment #2: list-bondings01.patch --]
[-- Type: text/x-patch, Size: 1439 bytes --]

--- bluez-utils-cvs.orig/hcid/dbus-device.c	2006-02-15 15:44:38.000000000 -0200
+++ bluez-utils-cvs-list-bondings/hcid/dbus-device.c	2006-02-20 13:46:54.000000000 -0300
@@ -41,6 +41,15 @@
 
 #include "textfile.h"
 
+
+static void append_bonding_devices(char *key, char *value, void *data)
+{
+	DBusMessageIter *iter = data;
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &key);
+
+}
+
 static char *get_peer_name(const bdaddr_t *local, const bdaddr_t *peer)
 {
 	char filename[PATH_MAX + 1], addr[18];
@@ -729,8 +738,30 @@
 
 static DBusMessage* handle_dev_list_bondings_req(DBusMessage *msg, void *data)
 {
-	/*FIXME: */
-	return bluez_new_failure_msg(msg, BLUEZ_EDBUS_NOT_IMPLEMENTED);
+	char filename[PATH_MAX + 1];
+	struct hci_dbus_data *dbus_data = data;
+	DBusMessage *reply;
+	DBusMessageIter iter;
+	DBusMessageIter array_iter;
+	char addr[18];
+
+	get_device_address(dbus_data->dev_id, addr, sizeof(addr));
+
+	snprintf(filename, PATH_MAX, "%s/%s/linkkeys", STORAGEDIR, addr);
+
+	reply = dbus_message_new_method_return(msg);
+
+	dbus_message_iter_init_append(reply, &iter);
+	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+						DBUS_TYPE_STRING_AS_STRING, &array_iter);
+
+
+	textfile_foreach(filename, &append_bonding_devices, &array_iter);
+
+	dbus_message_iter_close_container(&iter, &array_iter);
+
+	return reply;
+
 }
 
 static DBusMessage* handle_dev_has_bonding_req(DBusMessage *msg, void *data)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Bluez-devel] [DBUS PATCH] ListBondings
  2006-02-20 19:55 [Bluez-devel] [DBUS PATCH] ListBondings Claudio Takahasi
@ 2006-02-20 20:36 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2006-02-20 20:36 UTC (permalink / raw)
  To: bluez-devel

Hi Claudio,

> This is the patch to list bonded devices.

I made append_bonding_devices() a local function and applied your patch.

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] 2+ messages in thread

end of thread, other threads:[~2006-02-20 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-20 19:55 [Bluez-devel] [DBUS PATCH] ListBondings Claudio Takahasi
2006-02-20 20:36 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).