diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-09-22 15:11:44 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-09-22 15:11:44 -0700 |
commit | 5ca10fa88a87d4c22ddb09a75372116bcb067f9b (patch) | |
tree | 6d99dd17a3da17e4553d5c9a1f816b92e798aee1 /src/adapter.c | |
parent | 31de5e6c504abbcdccafc2a95af34b5301780797 (diff) |
Add Devices property to GetProperties.
Diffstat (limited to 'src/adapter.c')
-rw-r--r-- | src/adapter.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/adapter.c b/src/adapter.c index 2a4891c6..78990a60 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -1509,6 +1509,9 @@ static DBusMessage *get_properties(DBusConnection *conn, DBusMessageIter dict; char str[249], srcaddr[18]; gboolean discov_active; + char **devices; + int i; + GSList *l; ba2str(&adapter->bdaddr, srcaddr); @@ -1558,6 +1561,16 @@ static DBusMessage *get_properties(DBusConnection *conn, dbus_message_iter_append_dict_entry(&dict, "Discovering", DBUS_TYPE_BOOLEAN, &discov_active); + /* Devices */ + devices = g_new0(char *, g_slist_length(adapter->devices) + 1); + for (i = 0, l = adapter->devices; l; l = l->next, i++) { + struct btd_device *dev = l->data; + devices[i] = (char *) device_get_path(dev); + } + dbus_message_iter_append_dict_entry(&dict, "Devices", + DBUS_TYPE_ARRAY, &devices); + g_free(devices); + dbus_message_iter_close_container(&iter, &dict); return reply; |