diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-08-29 11:41:15 +0000 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-08-29 11:41:15 +0000 | 
| commit | c13f5169711913b9b6d3ee40740480fe234491cd (patch) | |
| tree | fe8f060ad0d043f0e01c84a185c8d1fc119c302e | |
| parent | 60fa5f6cfbfe82c239bb957c1a3298bceaa62604 (diff) | |
Add GetAdapter method and update API documentation
| -rw-r--r-- | audio/audio-api.txt | 11 | ||||
| -rw-r--r-- | audio/device.c | 21 | 
2 files changed, 31 insertions, 1 deletions
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 }  };  | 
