diff options
Diffstat (limited to 'hcid')
| -rw-r--r-- | hcid/dbus-api.txt | 6 | ||||
| -rw-r--r-- | hcid/dbus-service.c | 25 | 
2 files changed, 28 insertions, 3 deletions
| diff --git a/hcid/dbus-api.txt b/hcid/dbus-api.txt index bac035b4..fad8033e 100644 --- a/hcid/dbus-api.txt +++ b/hcid/dbus-api.txt @@ -1114,7 +1114,11 @@ Service		org.bluez  Interface	org.bluez.Service  Object path	path from org.bluez.Manager.ListServices() -Methods		string GetName() +Methods		string GetIdentifier() + +			This method returns the service identifier. + +		string GetName()  			This method returns the service name. diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index 6cc0630b..a18ac579 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -92,7 +92,6 @@ int binary_record_cmp(struct binary_record *rec, uint32_t *handle)  	return (rec->ext_handle - *handle);  } -  static void service_free(struct service *service)  {  	if (!service) @@ -168,6 +167,28 @@ static void service_exit(const char *name, struct service *service)  	service->bus_name = NULL;  } +static DBusHandlerResult get_identifier(DBusConnection *conn, +					DBusMessage *msg, void *data) +{ + +	struct service *service = data; +	DBusMessage *reply; +	const char *identifier = ""; + +	reply = dbus_message_new_method_return(msg); +	if (!reply) +		return DBUS_HANDLER_RESULT_NEED_MEMORY; + +	if (service->ident) +		identifier = service->ident; +	 +	dbus_message_append_args(reply, +			DBUS_TYPE_STRING, &identifier, +			DBUS_TYPE_INVALID); + +	return send_message_and_unref(conn, reply); +} +  static DBusHandlerResult get_name(DBusConnection *conn,  					DBusMessage *msg, void *data)  { @@ -594,6 +615,7 @@ static DBusHandlerResult remove_trust(DBusConnection *conn,  }  static struct service_data services_methods[] = { +	{ "GetIdentifier",	get_identifier		},  	{ "GetName",		get_name		},  	{ "GetDescription",	get_description		},  	{ "Start",		start			}, @@ -943,4 +965,3 @@ int init_services(const char *path)  	return 0;  } - | 
