From c13f5169711913b9b6d3ee40740480fe234491cd Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 29 Aug 2007 11:41:15 +0000 Subject: Add GetAdapter method and update API documentation --- audio/audio-api.txt | 11 ++++++++++- audio/device.c | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/audio/audio-api.txt b/audio/audio-api.txt index c49b61b9..4fbed84a 100644 --- a/audio/audio-api.txt +++ b/audio/audio-api.txt @@ -105,7 +105,16 @@ Methods string GetAddress() [experimental] Returns the Bluetooth address of the remote device. - array{string} GetConnectedInterfaces() [experimental] + string GetAdapter() [experimental] + + Returns the address of the local adapter that the + device is associated with. + + string GetName() [experimental] + + Returns a friendly name for the device. + + array{string} GetConnectedInterfaces() [experimental] Returns a string list of interfaces that are in a connected state. diff --git a/audio/device.c b/audio/device.c index 4f47bcb2..9c90ed43 100644 --- a/audio/device.c +++ b/audio/device.c @@ -119,6 +119,26 @@ static DBusHandlerResult device_get_name(DBusConnection *conn, return send_message_and_unref(conn, reply); } +static DBusHandlerResult device_get_adapter(DBusConnection *conn, + DBusMessage *msg, void *data) +{ + struct device *device = data; + DBusMessage *reply; + char address[18], *ptr = address; + + reply = dbus_message_new_method_return(msg); + if (!reply) + return DBUS_HANDLER_RESULT_NEED_MEMORY; + + ba2str(&device->src, address); + + dbus_message_append_args(reply, DBUS_TYPE_STRING, &ptr, + DBUS_TYPE_INVALID); + + return send_message_and_unref(conn, reply); +} + + static DBusHandlerResult device_get_connected(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -152,6 +172,7 @@ static DBusHandlerResult device_get_connected(DBusConnection *conn, static DBusMethodVTable device_methods[] = { { "GetAddress", device_get_address, "", "s" }, { "GetName", device_get_name, "", "s" }, + { "GetAdapter", device_get_adapter, "", "s" }, { "GetConnectedInterfaces", device_get_connected, "", "as" }, { NULL, NULL, NULL, NULL } }; -- cgit