From 6df9fdf35996a69d5f711abb061c1671675872b0 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 25 Jan 2007 11:56:21 +0000 Subject: Implement Service.IsExternal method --- hcid/dbus-api.txt | 6 ++++++ hcid/dbus-service.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) 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 }, -- cgit