summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-20 19:28:04 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-20 19:28:04 +0000
commite5707949f5e8b5cc9eb39711173f79a4c06616d9 (patch)
treed2f984278382d2e091121fde92d77ad028214d2b /hcid
parent9ec58817713065b28e0f8d734fe10181ef5b170e (diff)
Implement GetIdentifier method
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-api.txt6
-rw-r--r--hcid/dbus-service.c25
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;
}
-