From e5379d85aab8bd6cd6d675048797b7134be28dc9 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Fri, 4 Feb 2011 20:18:23 +0100 Subject: [PATCH] service: Remove WPS from the exported D-Bus properties When WPS is supported it is added to the security string array. --- doc/service-api.txt | 22 ++++++---------------- src/service.c | 24 ++++++++++++++++++------ test/get-services | 5 +++-- test/list-services | 5 +++-- test/monitor-services | 3 ++- test/test-manager | 5 +++-- 6 files changed, 35 insertions(+), 29 deletions(-) diff --git a/doc/service-api.txt b/doc/service-api.txt index 99f78d7..b3e758e 100644 --- a/doc/service-api.txt +++ b/doc/service-api.txt @@ -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 diff --git a/src/service.c b/src/service.c index fa2d3e4..5081763 100644 --- a/src/service.c +++ b/src/service.c @@ -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: diff --git a/test/get-services b/test/get-services index 605e278..47630a6 100755 --- a/test/get-services +++ b/test/get-services @@ -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: diff --git a/test/list-services b/test/list-services index f1b89b6..3ae6a4d 100755 --- a/test/list-services +++ b/test/list-services @@ -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: diff --git a/test/monitor-services b/test/monitor-services index e4fe328..cbae377 100755 --- a/test/monitor-services +++ b/test/monitor-services @@ -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) diff --git a/test/test-manager b/test/test-manager index 87b0e16..a29eaf7 100755 --- a/test/test-manager +++ b/test/test-manager @@ -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"]: -- 2.7.4