static guint network_connected_popup_timer_id = 0;
static gboolean block_network_connected_popup = FALSE;
-static const char *_convert_wifi_service_state_to_string(wifi_service_state_e wifi_service_state_type)
+char *_convert_wifi_service_state_to_string(wifi_service_state_e wifi_service_state_type)
{
switch (wifi_service_state_type) {
case NETCONFIG_WIFI_UNKNOWN:
return "Invalid parameter";
}
-static const char *_convert_wifi_technology_state_to_string(wifi_tech_state_e wifi_tech_state_type)
+char *_convert_wifi_technology_state_to_string(wifi_tech_state_e wifi_tech_state_type)
{
switch (wifi_tech_state_type) {
case NETCONFIG_WIFI_TECH_UNKNOWN:
vconf_ignore_key_changed(VCONFKEY_WIFI_ENABLE_QS, __notification_value_changed_cb);
}
-static void _set_power_save(gboolean power_save)
-{
- gboolean result;
- const char *if_path;
- GVariant *input_args = NULL;
- static gboolean old_state = TRUE;
- const gchar *args_disable = "POWERMODE 1";
- const gchar *args_enable = "POWERMODE 0";
- if (old_state == power_save)
- return;
-
- if_path = netconfig_wifi_get_supplicant_interface();
- if (if_path == NULL) {
- ERR("Fail to get wpa_supplicant DBus path");
- return;
- }
-
- if (power_save)
- input_args = g_variant_new("(s)", args_enable);
- else
- input_args = g_variant_new("(s)", args_disable);
-
- result = netconfig_supplicant_invoke_dbus_method_nonblock(
- SUPPLICANT_SERVICE,
- if_path,
- SUPPLICANT_INTERFACE ".Interface",
- "Driver",
- input_args,
- NULL);
- if (result == FALSE)
- ERR("Fail to set power save mode POWERMODE %d", power_save);
- else
- old_state = power_save;
-
- return;
-}
-
static void _set_power_lock(gboolean power_lock)
{
gint32 ret = 0;
netconfig_set_system_event(SYS_EVT_WIFI_STATE, EKEY_WIFI_STATE, EVAL_WIFI_ON);
netconfig_wifi_bgscan_stop();
+ netconfig_wifi_bgscan_set_interval(SCAN_EXPONENTIAL_MIN);
netconfig_wifi_bgscan_start(TRUE);
/* Add callback to track change in notification setting */
netconfig_set_system_event(SYS_EVT_WIFI_STATE, EKEY_WIFI_STATE, EVAL_WIFI_OFF);
- netconfig_wifi_set_bgscan_pause(FALSE);
netconfig_wifi_bgscan_stop();
_set_bss_found(FALSE);
/* Inform net-popup to remove the wifi found notification */
netconfig_send_notification_to_net_popup(NETCONFIG_DEL_FOUND_AP_NOTI, NULL);
netconfig_send_notification_to_net_popup(NETCONFIG_DEL_PORTAL_NOTI, NULL);
+ netconfig_send_notification_to_net_popup(NETCONFIG_DEL_IP_CONFLICT_NOTI, NULL);
_deregister_network_notification();
}
/* During DHCP, temporarily disable Wi-Fi power saving */
if ((old_state < NETCONFIG_WIFI_ASSOCIATION || old_state == NETCONFIG_WIFI_FAILURE) && new_state == NETCONFIG_WIFI_CONFIGURATION) {
_set_power_lock(TRUE);
- _set_power_save(FALSE);
dhcp_stage = TRUE;
} else if (dhcp_stage == TRUE) {
_set_power_lock(FALSE);
- _set_power_save(TRUE);
dhcp_stage = FALSE;
}
netconfig_wifi_indicator_stop();
- netconfig_wifi_set_bgscan_pause(FALSE);
-
netconfig_wifi_bgscan_stop();
+ netconfig_wifi_bgscan_set_interval(SCAN_EXPONENTIAL_MIN);
netconfig_wifi_bgscan_start(TRUE);
} else if ((old_state > NETCONFIG_WIFI_IDLE && old_state < NETCONFIG_WIFI_CONNECTED) && new_state == NETCONFIG_WIFI_IDLE) {
/* in ipv6 case disconnect/association -> association */
DBG("reset the bg scan period");
- netconfig_wifi_set_bgscan_pause(FALSE);
netconfig_wifi_bgscan_stop();
netconfig_wifi_bgscan_start(TRUE);
return g_tech_state;
}
+gboolean wifi_state_is_technology_available(void)
+{
+ GVariant *message = NULL;
+ GVariantIter *iter, *next;
+ const char *path;
+ gboolean ret = FALSE;
+
+ message = netconfig_invoke_dbus_method(CONNMAN_SERVICE,
+ CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE,
+ "GetTechnologies", NULL);
+ if (message == NULL) {
+ ERR("Failed to get_technology_state");
+ return FALSE;
+ }
+
+ g_variant_get(message, "(a(oa{sv}))", &iter);
+ while (g_variant_iter_loop(iter, "(oa{sv})", &path, &next)) {
+ if (path != NULL && g_strcmp0(path, CONNMAN_WIFI_TECHNOLOGY_PREFIX) == 0)
+ ret = TRUE;
+ }
+
+ g_variant_unref(message);
+ g_variant_iter_free(iter);
+
+ DBG("Wi-Fi technology is %s", ret ? "available" : "unavailable");
+ return ret;
+}
+
void wifi_state_set_connected_essid(void)
{
__set_wifi_connected_essid();
*/
gboolean handle_get_wifi_state(Wifi *wifi, GDBusMethodInvocation *context)
{
- g_return_val_if_fail(wifi != NULL, FALSE);
+ g_return_val_if_fail(wifi != NULL, TRUE);
GVariant *param = NULL;
wifi_tech_state_e tech_state = NETCONFIG_WIFI_TECH_UNKNOWN;
wifi_service_state_e service_state = NETCONFIG_WIFI_UNKNOWN;