summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-03-21 20:25:22 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-03-21 20:25:22 +0000
commitcf9b9a475788329f44c7e521d036ac647b56b8cb (patch)
tree11ceac8442993843587f51b7358dad04929ff1cb /hcid
parentbdbad0d759c9f5c8092afd2cac4e1a76722b4517 (diff)
Implement full Service.GetInfo() support
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-common.c5
-rw-r--r--hcid/dbus-service.c11
2 files changed, 13 insertions, 3 deletions
diff --git a/hcid/dbus-common.c b/hcid/dbus-common.c
index 3e059158..3f08e5cd 100644
--- a/hcid/dbus-common.c
+++ b/hcid/dbus-common.c
@@ -88,6 +88,9 @@ void append_dict_entry(DBusMessageIter *dict, const char *key,
case DBUS_TYPE_UINT32:
sig = DBUS_TYPE_UINT32_AS_STRING;
break;
+ case DBUS_TYPE_BOOLEAN:
+ sig = DBUS_TYPE_BOOLEAN_AS_STRING;
+ break;
default:
sig = DBUS_TYPE_VARIANT_AS_STRING;
break;
@@ -95,7 +98,7 @@ void append_dict_entry(DBusMessageIter *dict, const char *key,
dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, sig, &value);
- dbus_message_iter_append_basic(&value, type, &val);
+ dbus_message_iter_append_basic(&value, type, val);
dbus_message_iter_close_container(&entry, &value);
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c
index fc1592c1..fe4f24df 100644
--- a/hcid/dbus-service.c
+++ b/hcid/dbus-service.c
@@ -108,6 +108,7 @@ static DBusHandlerResult get_info(DBusConnection *conn,
DBusMessage *reply;
DBusMessageIter iter;
DBusMessageIter dict;
+ dbus_bool_t running;
reply = dbus_message_new_method_return(msg);
if (!reply)
@@ -120,9 +121,15 @@ static DBusHandlerResult get_info(DBusConnection *conn,
DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
- append_dict_entry(&dict, "identifier", DBUS_TYPE_STRING, service->ident);
+ append_dict_entry(&dict, "identifier", DBUS_TYPE_STRING, &service->ident);
+
+ append_dict_entry(&dict, "name", DBUS_TYPE_STRING, &service->name);
+
+ append_dict_entry(&dict, "description", DBUS_TYPE_STRING, &service->descr);
+
+ running = (service->external || service->bus_name) ? TRUE : FALSE;
- append_dict_entry(&dict, "name", DBUS_TYPE_STRING, service->name);
+ append_dict_entry(&dict, "running", DBUS_TYPE_BOOLEAN, &running);
dbus_message_iter_close_container(&iter, &dict);