Implement full Service.GetInfo() support

This commit is contained in:
Marcel Holtmann 2007-03-21 20:25:22 +00:00
parent bdbad0d759
commit cf9b9a4757
2 changed files with 13 additions and 3 deletions

View File

@ -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);

View File

@ -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);