service: Remove WPS from the exported D-Bus properties
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 4 Feb 2011 19:18:23 +0000 (20:18 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 4 Feb 2011 19:18:23 +0000 (20:18 +0100)
When WPS is supported it is added to the security string array.

doc/service-api.txt
src/service.c
test/get-services
test/list-services
test/monitor-services
test/test-manager

index 99f78d7..b3e758e 100644 (file)
@@ -174,15 +174,15 @@ Properties        string State [readonly]
                        This property might be only present for WiFi and
                        Cellular services.
 
-               string Security [readonly]
+               array{string} Security [readonly]
 
                        If the service type is WiFi, then this property is
-                       present and contains the security method or key
-                       management setting.
+                       present and contains the list of security methods
+                       or key management settings.
 
-                       Possible values are "none", "wep", "psk" and
-                       also "ieee8021x". Alternate values for "psk"
-                       can also be "wpa" and "rsn".
+                       Possible values are "none", "wep", "psk", "ieee8021x"
+                       and also "wps". Alternate values for "psk" can also
+                       be "wpa" and "rsn".
 
                        This property might be only present for WiFi
                        services.
@@ -214,16 +214,6 @@ Properties string State [readonly]
                        passphrase is needed, then this property will
                        be set to false.
 
-               boolean WPS [readonly]
-
-                       If the service type is Wifi, then this property
-                       indicates if it provides WPS (Wifi Protected Setup).
-
-                       If this is set to true, then if no Passphrase is
-                       provided or if given Passphrase is wrong, WPS
-                       push-button or pin methods will be available through
-                       Agent API.
-
                uint8 Strength [readonly]
 
                        Indicates the signal strength of the service. This
index fa2d3e4..5081763 100644 (file)
@@ -761,6 +761,22 @@ static void apn_changed(struct connman_service *service)
                                                DBUS_TYPE_BOOLEAN, &required);
 }
 
+static void append_security(DBusMessageIter *iter, void *user_data)
+{
+       struct connman_service *service = user_data;
+       const char *str;
+
+       str = security2string(service->security);
+       if (str != NULL)
+               dbus_message_iter_append_basic(iter,
+                               DBUS_TYPE_STRING, &str);
+
+       str = "wps";
+       if (service->wps == TRUE)
+               dbus_message_iter_append_basic(iter,
+                               DBUS_TYPE_STRING, &str);
+}
+
 static void append_ethernet(DBusMessageIter *iter, void *user_data)
 {
        struct connman_service *service = user_data;
@@ -1346,10 +1362,8 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
                connman_dbus_dict_append_basic(dict, "Mode",
                                                DBUS_TYPE_STRING, &str);
 
-       str = security2string(service->security);
-       if (str != NULL)
-               connman_dbus_dict_append_basic(dict, "Security",
-                                               DBUS_TYPE_STRING, &str);
+       connman_dbus_dict_append_array(dict, "Security",
+                               DBUS_TYPE_STRING, append_security, service);
 
        str = state2string(service->state);
        if (str != NULL)
@@ -1444,8 +1458,6 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
                connman_dbus_dict_append_basic(dict, "PassphraseRequired",
                                                DBUS_TYPE_BOOLEAN, &required);
 
-               connman_dbus_dict_append_basic(dict, "WPS",
-                                       DBUS_TYPE_BOOLEAN, &service->wps);
                /* fall through */
        case CONNMAN_SERVICE_TYPE_ETHERNET:
        case CONNMAN_SERVICE_TYPE_WIMAX:
index 605e278..47630a6 100755 (executable)
@@ -40,10 +40,11 @@ for entry in services:
                                                "Ethernet", "Provider"]:
                        val = extract_values(properties[key])
                elif key in ["Nameservers", "Nameservers.Configuration",
-                                       "Domains", "Domains.Configuration"]:
+                                       "Domains", "Domains.Configuration",
+                                               "Security"]:
                        val = extract_list(properties[key])
                elif key in ["Favorite", "Immutable", "AutoConnect",
-                               "SetupRequired", "PassphraseRequired", "WPS"]:
+                               "SetupRequired", "PassphraseRequired"]:
                        if properties[key] == dbus.Boolean(1):
                                val = "true"
                        else:
index f1b89b6..3ae6a4d 100755 (executable)
@@ -45,11 +45,12 @@ for path in properties["Services"]:
                                                "Ethernet", "Provider"]:
                        val = extract_values(properties[key])
                elif key in ["Nameservers", "Nameservers.Configuration",
-                                       "Domains", "Domains.Configuration"]:
+                                       "Domains", "Domains.Configuration",
+                                               "Security"]:
                        val = extract_list(properties[key])
                elif key in ["Favorite", "Immutable", "AutoConnect",
                                        "LoginRequired", "SetupRequired",
-                                               "PassphraseRequired", "WPS"]:
+                                               "PassphraseRequired"]:
                        if properties[key] == dbus.Boolean(1):
                                val = "true"
                        else:
index e4fe328..cbae377 100755 (executable)
@@ -35,7 +35,8 @@ def property_changed(name, value, path):
                        "Proxy", "Proxy.Configuration", "Ethernet"]:
                val = extract_values(value)
        elif name in ["Nameservers", "Nameservers.Configuration",
-                                       "Domains", "Domains.Configuration"]:
+                                       "Domains", "Domains.Configuration"
+                                               "Security"]:
                val = extract_list(value)
        elif name in ["Strength", "Priority"]:
                val = int(value)
index 87b0e16..a29eaf7 100755 (executable)
@@ -56,7 +56,7 @@ def print_properties(key, value):
                                        "Available", "Remember", "Default",
                                        "Favorite", "Immutable", "AutoConnect",
                                                "LoginRequired", "SetupRequired",
-                                               "PassphraseRequired", "WPS"]:
+                                               "PassphraseRequired"]:
                                if properties[key] == dbus.Boolean(1):
                                        val = "true"
                                else:
@@ -69,7 +69,8 @@ def print_properties(key, value):
                                val = extract_values(properties[key])
 
                        elif key in ["Nameservers", "Nameservers.Configuration",
-                                       "Domains", "Domains.Configuration"]:
+                                       "Domains", "Domains.Configuration",
+                                               "Security"]:
                                val = extract_list(properties[key])
 
                        elif key in ["Strength", "Priority"]: