From 5bb2816373b31c080a944dc957f3f38c1282aedf Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 15 Dec 2008 00:44:17 +0100 Subject: [PATCH] Add property for connection type --- doc/connection-api.txt | 6 +++++- src/element.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/connection-api.txt b/doc/connection-api.txt index 7f3d940..e2cf474 100644 --- a/doc/connection-api.txt +++ b/doc/connection-api.txt @@ -17,7 +17,11 @@ Signals PropertyChanged(string name, variant value) This signal indicates a changed value of the given property. -Properties string IPv4.Method [readonly] +Properties string Type [readonly] + + The connection type (for example wifi etc.) + + string IPv4.Method [readonly] Indicates the way how the IPv4 settings were configured. Possible values here are "dhcp" diff --git a/src/element.c b/src/element.c index 5081ff3..d1e6de3 100644 --- a/src/element.c +++ b/src/element.c @@ -679,12 +679,13 @@ static DBusMessage *network_set_property(DBusConnection *conn, return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } -static DBusMessage *get_connection_properties(DBusConnection *conn, +static DBusMessage *connection_get_properties(DBusConnection *conn, DBusMessage *msg, void *data) { struct connman_element *element = data; DBusMessage *reply; DBusMessageIter array, dict; + const char *str; DBG("conn %p", conn); @@ -699,6 +700,11 @@ static DBusMessage *get_connection_properties(DBusConnection *conn, DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict); + str = subtype2string(element->subtype); + if (str != NULL) + connman_dbus_dict_append_variant(&dict, "Type", + DBUS_TYPE_STRING, &str); + add_common_properties(element, &dict); dbus_message_iter_close_container(&array, &dict); @@ -724,7 +730,7 @@ static GDBusMethodTable network_methods[] = { }; static GDBusMethodTable connection_methods[] = { - { "GetProperties", "", "a{sv}", get_connection_properties }, + { "GetProperties", "", "a{sv}", connection_get_properties }, { }, }; -- 1.7.9.5