summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-04-17 08:43:45 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-04-17 08:43:45 +0000
commit4c911c68f8bdc213aaaa40e6726617b553694dbb (patch)
tree5386bb36526e9dd060e2c5ade15fd324df39bf53 /hcid
parent2d09985d7bc2333ad4bb24e4f1790acd8ec1467b (diff)
Implement experimental Service.GetBusName method
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-api.txt7
-rw-r--r--hcid/dbus-service.c21
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 },