diff options
| author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-10-27 13:14:45 +0000 | 
|---|---|---|
| committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-10-27 13:14:45 +0000 | 
| commit | a6f89e8b48c190be6268a1d67c5ca4d2c7c2c384 (patch) | |
| tree | 55fe48a200a5883283f0b4180772992c68973a1b | |
| parent | 6d3c7f4586facea63a29d56ce15dab12fee8acd5 (diff) | |
Added IsRunning
| -rw-r--r-- | hcid/dbus-service.c | 20 | 
1 files changed, 18 insertions, 2 deletions
| diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index 319e9144..fabec119 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -54,7 +54,6 @@ struct service_call {  	struct service_agent *agent;  }; -  static struct slist *services = NULL;  static void service_call_free(void *data) @@ -148,6 +147,9 @@ static struct service_agent *service_agent_new(const char *id, const char *name,  			goto mem_fail;  	} +	/* by default when the service agent registers the service must not be running */ +	agent->running = SERVICE_NOT_RUNNING; +  	return agent;  mem_fail: @@ -373,7 +375,21 @@ static DBusHandlerResult stop(DBusConnection *conn,  static DBusHandlerResult is_running(DBusConnection *conn,  					DBusMessage *msg, void *data)  { -	return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +	struct service_agent *agent = data; +	DBusMessage *reply; +	dbus_bool_t running; + +	reply = dbus_message_new_method_return(msg); +	if (!reply) +		return DBUS_HANDLER_RESULT_NEED_MEMORY; + +	running = (agent->running ? TRUE : FALSE); + +	dbus_message_append_args(reply, +			DBUS_TYPE_BOOLEAN, &running, +			DBUS_TYPE_INVALID); + +	return send_message_and_unref(conn, reply);  }  static DBusHandlerResult list_users(DBusConnection *conn, | 
