Add property for connection type
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 14 Dec 2008 23:44:17 +0000 (00:44 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 14 Dec 2008 23:44:17 +0000 (00:44 +0100)
doc/connection-api.txt
src/element.c

index 7f3d940..e2cf474 100644 (file)
@@ -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"
index 5081ff3..d1e6de3 100644 (file)
@@ -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 },
        { },
 };