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;
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);
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));
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;
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) {
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;
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);
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;
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)
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)
{
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) {
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;
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)
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)