This email list is read-only. Emails sent to this list will be discarded ---------------------------------- plugins/bluetooth.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+), 0 deletions(-)
New commits: commit 9328a63c330a64982d2a9bc060d8985c2228d3e5 Author: Marcel Holtmann <[email protected]> Date: Wed Dec 17 04:54:01 2008 +0100 Retrieve list of Bluetooth devices Diff in this email is a maximum of 400 lines. diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index 94c8649..2b33c3a 100644 --- a/plugins/bluetooth.c +++ b/plugins/bluetooth.c @@ -175,6 +175,45 @@ done: dbus_message_unref(reply); } +static void devices_reply(DBusPendingCall *call, void *user_data) +{ + DBusMessage *message = user_data; + const char *path = dbus_message_get_path(message); + DBusMessage *reply; + DBusError error; + char **devices; + int i, num_devices; + + DBG("path %s", path); + + dbus_message_unref(message); + + reply = dbus_pending_call_steal_reply(call); + + dbus_error_init(&error); + + if (dbus_message_get_args(reply, &error, + DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, + &devices, &num_devices, + DBUS_TYPE_INVALID) == FALSE) { + if (dbus_error_is_set(&error) == TRUE) { + connman_error("%s", error.message); + dbus_error_free(&error); + } else + connman_error("Wrong arguments for device list"); + goto done; + } + + for (i = 0; i < num_devices; i++) { + DBG("device %s", devices[i]); + } + + g_strfreev(devices); + +done: + dbus_message_unref(reply); +} + static void add_adapter(DBusConnection *connection, const char *path) { struct connman_element *device; @@ -210,6 +249,20 @@ static void add_adapter(DBusConnection *connection, const char *path) } dbus_pending_call_set_notify(call, properties_reply, message, NULL); + + message = dbus_message_new_method_call(BLUEZ_SERVICE, path, + BLUEZ_ADAPTER_INTERFACE, "ListDevices"); + if (message == NULL) + return; + + if (dbus_connection_send_with_reply(connection, message, + &call, TIMEOUT) == FALSE) { + connman_error("Failed to get Bluetooth devices"); + dbus_message_unref(message); + return; + } + + dbus_pending_call_set_notify(call, devices_reply, message, NULL); } static void remove_adapter(DBusConnection *connection, const char *path) _______________________________________________ Commits mailing list [email protected] https://lists.moblin.org/mailman/listinfo/commits
