diff options
| -rw-r--r-- | hcid/dbus-api.txt | 7 | ||||
| -rw-r--r-- | hcid/dbus-service.c | 21 | 
2 files changed, 28 insertions, 0 deletions
| diff --git a/hcid/dbus-api.txt b/hcid/dbus-api.txt index b76c86c6..5d21b53b 100644 --- a/hcid/dbus-api.txt +++ b/hcid/dbus-api.txt @@ -1089,6 +1089,13 @@ Methods		dict GetInfo()  			This method returns the service description. +		string GetBusName() [experimental] + +			Returns the unique bus name of the service if it has +			been started. + +			Possible errors: org.bluez.Error.NotAvailable +  		void Start()  			This method tells the system to start the diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index 81c4b2da..73b5c397 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -205,6 +205,26 @@ static DBusHandlerResult get_description(DBusConnection *conn,  	return send_message_and_unref(conn, reply);  } +static DBusHandlerResult get_bus_name(DBusConnection *conn, +						DBusMessage *msg, void *data) +{ +	struct service *service = data; +	DBusMessage *reply; + +	if (!service->bus_name) +		return error_not_available(conn, msg); + +	reply = dbus_message_new_method_return(msg); +	if (!reply) +		return DBUS_HANDLER_RESULT_NEED_MEMORY; + +	dbus_message_append_args(reply, +			DBUS_TYPE_STRING, &service->bus_name, +			DBUS_TYPE_INVALID); + +	return send_message_and_unref(conn, reply); +} +  static void service_setup(gpointer data)  {  	/* struct service *service = data; */ @@ -611,6 +631,7 @@ static struct service_data services_methods[] = {  	{ "GetIdentifier",	get_identifier		},  	{ "GetName",		get_name		},  	{ "GetDescription",	get_description		}, +	{ "GetBusName",		get_bus_name		},  	{ "Start",		start			},  	{ "Stop",		stop			},  	{ "IsRunning",		is_running		}, | 
