#include "network-statistics.h"
#include "wifi-background-scan.h"
+#define NETCONFIG_UPDATE_DEVICE_LIST_COUNT 3
#define NETCONFIG_UPDATE_DEVICE_LIST_TIMEOUT 1 * 1000
#define NETCONFIG_NETWORK_NOTIFICATION_TIMEOUT 15 * 1000
static gboolean new_bss_found = FALSE;
+static guint network_update_timer_cnt = 0;
static guint network_update_timer_id = 0;
static guint network_noti_timer_id = 0;
return "powered";
case NETCONFIG_WIFI_TECH_CONNECTED:
return "connected";
- case NETCONFIG_WIFI_TECH_TETHERED:
- return "tethered";
default:
ERR("Invalid wifi_tech_state_e parameter");
break;
return;
}
- netconfig_set_vconf_str(VCONFKEY_WIFI_CONNECTED_AP_NAME, essid_name);
+ netconfig_set_vconf_str(VCONFKEY_WIFI_CONNECTED_AP_NAME, essid_name, TRUE);
/* Block Network Connected popup for 3sec
* to avoid multiple popup's due to ready signals */
static void __unset_wifi_connected_essid(void)
{
- netconfig_set_vconf_str(VCONFKEY_WIFI_CONNECTED_AP_NAME, "");
+ netconfig_set_vconf_str(VCONFKEY_WIFI_CONNECTED_AP_NAME, "", TRUE);
}
static const char *__get_wifi_connected_essid(void)
}
}
- netconfig_set_vconf_int(VCONFKEY_WIFI_STATE, wifi_state);
- netconfig_set_vconf_int(VCONFKEY_NETWORK_WIFI_STATE, network_wifi_state);
+ netconfig_set_vconf_int(VCONFKEY_WIFI_STATE, wifi_state, TRUE);
+ netconfig_set_vconf_int(VCONFKEY_NETWORK_WIFI_STATE, network_wifi_state, TRUE);
}
void wifi_state_update_power_state(const char *interface_name, gboolean powered)
* It includes Wi-Fi state configuration
*/
tech_state = wifi_state_get_technology_state(interface_name);
+ if (tech_state == NETCONFIG_WIFI_TECH_UNKNOWN)
+ wifi_state_update_device_list();
if (powered == TRUE) {
if (tech_state < NETCONFIG_WIFI_TECH_POWERED && netconfig_is_wifi_tethering_on() != TRUE) {
DBG("Wi-Fi turned on or waken up from power-save mode");
+ gchar *mac_addr = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
+
+ if (mac_addr != NULL) {
+ if (strlen(mac_addr) == 0)
+ netconfig_set_mac_address_from_file();
+ g_free(mac_addr);
+ }
wifi_state_set_powered(interface_name, TRUE);
wifi_state_set_technology_state(interface_name, NETCONFIG_WIFI_TECH_POWERED);
netconfig_set_system_event(SYS_EVT_WIFI_STATE, EKEY_WIFI_STATE, EVAL_WIFI_ON);
netconfig_wifi_bgscan_stop(interface_name);
- netconfig_wifi_bgscan_set_interval(interface_name, SCAN_EXPONENTIAL_MIN);
+ netconfig_wifi_bgscan_set_exp_interval(interface_name, SCAN_EXPONENTIAL_MIN);
netconfig_wifi_bgscan_start(interface_name, TRUE);
/* Add callback to track change in notification setting */
return updated;
}
+ DBG("Wi-Fi g_device_list: %p", g_device_list);
+
device_list = g_device_list;
g_device_list = NULL;
if (g_strcmp0(dev_key, "Powered") == 0) {
if (device_data) {
device_data->powered = g_variant_get_boolean(dev_var);
+
+ if (device_data->tech_state == NETCONFIG_WIFI_TECH_UNKNOWN)
+ device_data->tech_state = NETCONFIG_WIFI_TECH_OFF;
+
+ if (device_data->interface_name)
+ wifi_state_update_power_state(
+ device_data->interface_name, device_data->powered);
+
if (device_data->powered == TRUE)
device_data->tech_state = NETCONFIG_WIFI_TECH_POWERED;
else
g_slist_free_full(device_list, __device_free_data);
+ if (network_update_timer_id && updated)
+ netconfig_stop_timer(&network_update_timer_id);
+
return updated;
}
static gboolean __state_update_device_list(gpointer data)
{
- if (wifi_state_update_device_list() == FALSE)
- return TRUE;
+ if (wifi_state_update_device_list() == FALSE) {
+ if (network_update_timer_cnt <
+ NETCONFIG_UPDATE_DEVICE_LIST_COUNT) {
+ network_update_timer_cnt++;
+ return TRUE;
+ }
+ }
netconfig_stop_timer(&network_update_timer_id);
return FALSE;
netconfig_wifi_indicator_stop(interface_name);
netconfig_wifi_bgscan_stop(interface_name);
- netconfig_wifi_bgscan_set_interval(interface_name, SCAN_EXPONENTIAL_MIN);
+ netconfig_wifi_bgscan_set_exp_interval(interface_name, SCAN_EXPONENTIAL_MIN);
netconfig_wifi_bgscan_start(interface_name, TRUE);
} else if ((old_state > NETCONFIG_WIFI_IDLE && old_state < NETCONFIG_WIFI_CONNECTED) && new_state == NETCONFIG_WIFI_IDLE) {
/* in ipv6 case disconnect/association -> association */
netconfig_wifi_bgscan_stop(interface_name);
netconfig_wifi_bgscan_start(interface_name, TRUE);
+ } else if (old_state == NETCONFIG_WIFI_FAILURE && new_state == NETCONFIG_WIFI_IDLE) {
+ DBG("reset the bg scan period, in failure case");
+ netconfig_wifi_bgscan_stop(interface_name);
+ netconfig_wifi_bgscan_set_exp_interval(interface_name, SCAN_EXPONENTIAL_MIN);
+ netconfig_wifi_bgscan_start(interface_name, FALSE);
}
_wifi_state_changed(interface_name, new_state);