service: Remove Service.Mode
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 16 Jun 2011 07:44:53 +0000 (09:44 +0200)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 16 Jun 2011 13:26:11 +0000 (15:26 +0200)
The only source for the cellular mode update was removed in
a474ef1be8b76167b9d0ef8a9eb6fe24cc5eacc5". The WiFi plugin will not
support adhoc mode. So this property is completly unused.

doc/service-api.txt
include/service.h
plugins/wifi.c
src/service.c

index 7e87e6e..2123e91 100644 (file)
@@ -160,20 +160,6 @@ Properties string State [readonly]
                        advanced properties or showing the correct icon
                        to the user.
 
-               string Mode [readonly]
-
-                       If the service type is WiFi or Cellular, then this
-                       property is present and contains the mode of the
-                       network.
-
-                       For WiFi services the possible values are "managed"
-                       and "adhoc". For Cellular services it describes the
-                       network technology. Possible values are "gprs", "edge"
-                       and "umts".
-
-                       This property might be only present for WiFi and
-                       Cellular services.
-
                array{string} Security [readonly]
 
                        If the service type is WiFi, then this property is
index 91c14bf..36c8658 100644 (file)
@@ -47,15 +47,6 @@ enum connman_service_type {
        CONNMAN_SERVICE_TYPE_GADGET    = 9,
 };
 
-enum connman_service_mode {
-       CONNMAN_SERVICE_MODE_UNKNOWN = 0,
-       CONNMAN_SERVICE_MODE_MANAGED = 1,
-       CONNMAN_SERVICE_MODE_ADHOC   = 2,
-       CONNMAN_SERVICE_MODE_GPRS    = 3,
-       CONNMAN_SERVICE_MODE_EDGE    = 4,
-       CONNMAN_SERVICE_MODE_UMTS    = 5,
-};
-
 enum connman_service_security {
        CONNMAN_SERVICE_SECURITY_UNKNOWN = 0,
        CONNMAN_SERVICE_SECURITY_NONE    = 1,
index 127b731..e3849ce 100644 (file)
@@ -755,7 +755,7 @@ static void network_added(GSupplicantNetwork *supplicant_network)
        struct connman_network *network;
        GSupplicantInterface *interface;
        struct wifi_data *wifi;
-       const char *name, *identifier, *mode, *security, *group;
+       const char *name, *identifier, *security, *group;
        const unsigned char *ssid;
        unsigned int ssid_len;
        connman_bool_t wps;
@@ -766,7 +766,6 @@ static void network_added(GSupplicantNetwork *supplicant_network)
        wifi = g_supplicant_interface_get_data(interface);
        name = g_supplicant_network_get_name(supplicant_network);
        identifier = g_supplicant_network_get_identifier(supplicant_network);
-       mode = g_supplicant_network_get_mode(supplicant_network);
        security = g_supplicant_network_get_security(supplicant_network);
        group = g_supplicant_network_get_identifier(supplicant_network);
        wps = g_supplicant_network_get_wps(supplicant_network);
@@ -797,7 +796,6 @@ static void network_added(GSupplicantNetwork *supplicant_network)
 
        connman_network_set_blob(network, "WiFi.SSID",
                                                ssid, ssid_len);
-       connman_network_set_string(network, "WiFi.Mode", mode);
        connman_network_set_string(network, "WiFi.Security", security);
        connman_network_set_strength(network,
                                calculate_strength(supplicant_network));
index 2ba956e..deb0901 100644 (file)
@@ -57,7 +57,6 @@ struct connman_service {
        char *identifier;
        char *path;
        enum connman_service_type type;
-       enum connman_service_mode mode;
        enum connman_service_security security;
        enum connman_service_state state_ipv4;
        enum connman_service_state state_ipv6;
@@ -180,26 +179,6 @@ const char *__connman_service_type2string(enum connman_service_type type)
        return NULL;
 }
 
-static const char *mode2string(enum connman_service_mode mode)
-{
-       switch (mode) {
-       case CONNMAN_SERVICE_MODE_UNKNOWN:
-               break;
-       case CONNMAN_SERVICE_MODE_MANAGED:
-               return "managed";
-       case CONNMAN_SERVICE_MODE_ADHOC:
-               return "adhoc";
-       case CONNMAN_SERVICE_MODE_GPRS:
-               return "gprs";
-       case CONNMAN_SERVICE_MODE_EDGE:
-               return "edge";
-       case CONNMAN_SERVICE_MODE_UMTS:
-               return "umts";
-       }
-
-       return NULL;
-}
-
 static const char *security2string(enum connman_service_security security)
 {
        switch (security) {
@@ -821,19 +800,6 @@ const char *__connman_service_default(void)
        return __connman_service_type2string(service->type);
 }
 
-static void mode_changed(struct connman_service *service)
-{
-       const char *str;
-
-       str = mode2string(service->mode);
-       if (str == NULL)
-               return;
-
-       connman_dbus_property_changed_basic(service->path,
-                               CONNMAN_SERVICE_INTERFACE, "Mode",
-                                               DBUS_TYPE_STRING, &str);
-}
-
 static void state_changed(struct connman_service *service)
 {
        enum connman_service_state state;
@@ -1626,11 +1592,6 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
                connman_dbus_dict_append_basic(dict, "Type",
                                                DBUS_TYPE_STRING, &str);
 
-       str = mode2string(service->mode);
-       if (str != NULL)
-               connman_dbus_dict_append_basic(dict, "Mode",
-                                               DBUS_TYPE_STRING, &str);
-
        connman_dbus_dict_append_array(dict, "Security",
                                DBUS_TYPE_STRING, append_security, service);
 
@@ -3054,7 +3015,6 @@ static void service_initialize(struct connman_service *service)
        service->session_usage_count = 0;
 
        service->type     = CONNMAN_SERVICE_TYPE_UNKNOWN;
-       service->mode     = CONNMAN_SERVICE_MODE_UNKNOWN;
        service->security = CONNMAN_SERVICE_SECURITY_UNKNOWN;
 
        service->state_ipv4 = CONNMAN_SERVICE_STATE_UNKNOWN;
@@ -4697,18 +4657,6 @@ static enum connman_service_type convert_network_type(struct connman_network *ne
        return CONNMAN_SERVICE_TYPE_UNKNOWN;
 }
 
-static enum connman_service_mode convert_wifi_mode(const char *mode)
-{
-       if (mode == NULL)
-               return CONNMAN_SERVICE_MODE_UNKNOWN;
-       else if (g_str_equal(mode, "managed") == TRUE)
-               return CONNMAN_SERVICE_MODE_MANAGED;
-       else if (g_str_equal(mode, "adhoc") == TRUE)
-               return CONNMAN_SERVICE_MODE_ADHOC;
-       else
-               return CONNMAN_SERVICE_MODE_UNKNOWN;
-}
-
 static enum connman_service_security convert_wifi_security(const char *security)
 {
        if (security == NULL)
@@ -4729,24 +4677,6 @@ static enum connman_service_security convert_wifi_security(const char *security)
                return CONNMAN_SERVICE_SECURITY_UNKNOWN;
 }
 
-static enum connman_service_mode convert_cellular_mode(connman_uint8_t mode)
-{
-       switch (mode) {
-       case 0:
-       case 1:
-               return CONNMAN_SERVICE_MODE_GPRS;
-       case 3:
-               return CONNMAN_SERVICE_MODE_EDGE;
-       case 2:
-       case 4:
-       case 5:
-       case 6:
-               return CONNMAN_SERVICE_MODE_UMTS;
-       }
-
-       return CONNMAN_SERVICE_MODE_UNKNOWN;
-}
-
 static void update_from_network(struct connman_service *service,
                                        struct connman_network *network)
 {
@@ -4784,18 +4714,10 @@ static void update_from_network(struct connman_service *service,
                service->strength = strength;
        }
 
-       str = connman_network_get_string(network, "WiFi.Mode");
-       service->mode = convert_wifi_mode(str);
-
        str = connman_network_get_string(network, "WiFi.Security");
        service->security = convert_wifi_security(str);
 
-       if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR) {
-               connman_uint8_t value = connman_network_get_uint8(network,
-                                                       "Cellular.Mode");
-
-               service->mode = convert_cellular_mode(value);
-       } else if (service->type == CONNMAN_SERVICE_TYPE_WIFI)
+       if (service->type == CONNMAN_SERVICE_TYPE_WIFI)
                service->wps = connman_network_get_bool(network, "WiFi.WPS");
 
        if (service->strength > strength && service->network != NULL) {
@@ -4901,8 +4823,7 @@ struct connman_service * __connman_service_create_from_network(struct connman_ne
 void __connman_service_update_from_network(struct connman_network *network)
 {
        struct connman_service *service;
-       enum connman_service_mode mode;
-       connman_uint8_t strength, value;
+       connman_uint8_t strength;
        connman_bool_t roaming;
        GSequenceIter *iter;
        const char *name;
@@ -4940,7 +4861,7 @@ void __connman_service_update_from_network(struct connman_network *network)
 roaming:
        roaming = connman_network_get_bool(service->network, "Roaming");
        if (roaming == service->roaming)
-               goto done;
+               return;
 
        stats_enable = stats_enabled(service);
        if (stats_enable == TRUE)
@@ -4956,20 +4877,6 @@ roaming:
        iter = g_hash_table_lookup(service_hash, service->identifier);
        if (iter != NULL)
                g_sequence_sort_changed(iter, service_compare, NULL);
-
-done:
-       if (service->type != CONNMAN_SERVICE_TYPE_CELLULAR)
-               return;
-
-       value = connman_network_get_uint8(service->network, "Cellular.Mode");
-       mode = convert_cellular_mode(value);
-
-       if (mode == service->mode)
-               return;
-
-       service->mode = mode;
-
-       mode_changed(service);
 }
 
 void __connman_service_remove_from_network(struct connman_network *network)