From cf9b9a475788329f44c7e521d036ac647b56b8cb Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 21 Mar 2007 20:25:22 +0000 Subject: [PATCH] Implement full Service.GetInfo() support --- hcid/dbus-common.c | 5 ++++- hcid/dbus-service.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hcid/dbus-common.c b/hcid/dbus-common.c index 3e0591583..3f08e5cd4 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 fc1592c1e..fe4f24df5 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, "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, "running", DBUS_TYPE_BOOLEAN, &running); dbus_message_iter_close_container(&iter, &dict);