summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorEduardo Rocha <eduardo.rocha@openbossa.org>2006-03-21 15:12:37 +0000
committerEduardo Rocha <eduardo.rocha@openbossa.org>2006-03-21 15:12:37 +0000
commita075f123e43ea9bd73e7e9288e96516f00c10853 (patch)
treef3b56dd8bc9f32bef5e554c78e02ad39ce64e2e3 /hcid
parent5eac136182fd238043ce62613830019256bd7120 (diff)
Added ListConnections
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-adapter.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index a10cbdb2..b10b34ee 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -408,6 +408,41 @@ static DBusHandlerResult handle_dev_is_discoverable_req(DBusConnection *conn, DB
return send_reply_and_unref(conn, reply);
}
+static DBusHandlerResult handle_dev_list_connections_req(DBusConnection *conn, DBusMessage *msg, void *data)
+{
+ DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter array_iter;
+
+ struct hci_dbus_data *dbus_data = data;
+ struct slist *l = dbus_data->active_conn;
+ struct active_conn_info *dev;
+
+ char *peer_addr;
+ bdaddr_t tmp;
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return error_out_of_memory(conn, msg);
+
+ dbus_message_iter_init_append(reply, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_STRING_AS_STRING, &array_iter);
+
+ while(l) {
+ dev = (struct active_conn_info *) l->data;
+ baswap(&tmp, dev->bdaddr); peer_addr = batostr(&tmp);
+
+ dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &peer_addr);
+ bt_free(peer_addr);
+
+ l = l->next;
+ }
+ dbus_message_iter_close_container(&iter, &array_iter);
+
+ return send_reply_and_unref(conn, reply);
+}
+
static DBusHandlerResult handle_dev_get_major_class_req(DBusConnection *conn, DBusMessage *msg, void *data)
{
DBusMessage *reply;
@@ -1565,6 +1600,7 @@ static struct service_data dev_services[] = {
{ "SetDiscoverableTimeout", handle_dev_set_discoverable_to_req, },
{ "IsConnectable", handle_dev_is_connectable_req, },
{ "IsDiscoverable", handle_dev_is_discoverable_req, },
+ { "ListConnections", handle_dev_list_connections_req, },
{ "GetMajorClass", handle_dev_get_major_class_req, },
{ "ListAvailableMinorClasses", handle_dev_list_minor_classes_req, },
{ "GetMinorClass", handle_dev_get_minor_class_req, },