diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-01-25 11:56:21 +0000 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-01-25 11:56:21 +0000 | 
| commit | 6df9fdf35996a69d5f711abb061c1671675872b0 (patch) | |
| tree | cd6cdf3e2efc088901f53abcc73c46cf6c40bd70 | |
| parent | e0f6cbcb6eb3bbb8a87a6c9c7cd7af8c61fb559e (diff) | |
Implement Service.IsExternal method
| -rw-r--r-- | hcid/dbus-api.txt | 6 | ||||
| -rw-r--r-- | hcid/dbus-service.c | 18 | 
2 files changed, 24 insertions, 0 deletions
| diff --git a/hcid/dbus-api.txt b/hcid/dbus-api.txt index 2734fab0..c4efb147 100644 --- a/hcid/dbus-api.txt +++ b/hcid/dbus-api.txt @@ -1068,6 +1068,12 @@ Methods		string GetIdentifier()  			Returns true if the service has been started and  			is currently active. Otherwise, it returns false. +		boolean IsExternal() [experimental] +			Returns true if the service was registered using the +			Database.RegisterService method instead of a .service +			file. The Start and Stop methods are not applicable to +			external services and will return an error. +  		array{string} ListUsers() [experimental]  			Returns list of current users (device addresses) diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index c6cc99f0..6ff18f2e 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -442,6 +442,23 @@ static DBusHandlerResult is_running(DBusConnection *conn,  	return send_message_and_unref(conn, reply);  } +static DBusHandlerResult is_external(DBusConnection *conn, +					DBusMessage *msg, void *data) +{ +	struct service *service = data; +	DBusMessage *reply; + +	reply = dbus_message_new_method_return(msg); +	if (!reply) +		return DBUS_HANDLER_RESULT_NEED_MEMORY; + +	dbus_message_append_args(reply, +			DBUS_TYPE_BOOLEAN, &service->external, +			DBUS_TYPE_INVALID); + +	return send_message_and_unref(conn, reply); +} +  static DBusHandlerResult list_users(DBusConnection *conn,  					DBusMessage *msg, void *data)  { @@ -547,6 +564,7 @@ static struct service_data services_methods[] = {  	{ "Start",		start			},  	{ "Stop",		stop			},  	{ "IsRunning",		is_running		}, +	{ "IsExternal",		is_external		},  	{ "ListUsers",		list_users		},  	{ "RemoveUser",		remove_user		},  	{ "SetTrusted",		set_trusted		}, | 
