-
-static void __netconfig_wifi_restrict_mode(keynode_t *node, void *user_data)
-{
- int wifi_state = 0, restricted = 0;
- int wifi_off_by_restricted = 0;
-
- netconfig_vconf_get_int(VCONF_WIFI_OFF_STATE_BY_RESTRICTED, &wifi_off_by_restricted);
-
- netconfig_vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
-
- if (node != NULL)
- restricted = vconf_keynode_get_bool(node);
- else
- netconfig_vconf_get_bool(VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE, &restricted);
-
- DBG("network restricted mode %s", restricted > 0 ? "ON" : "OFF");
- DBG("Wi-Fi state %d, Wi-Fi was off by restricted mode %s", wifi_state,
- wifi_off_by_restricted ? "Yes" : "No");
-
- if (restricted > 0) {
- /* network restricted on */
- if (wifi_state == VCONFKEY_WIFI_OFF)
- return;
-
- wifi_power_off();
-
- netconfig_set_vconf_int(VCONF_WIFI_OFF_STATE_BY_RESTRICTED, 1);
- } else {
- /* network restricted off */
- if (!wifi_off_by_restricted)
- return;
-
- netconfig_set_vconf_int(VCONF_WIFI_OFF_STATE_BY_RESTRICTED, 0);
-
- if (wifi_state > VCONFKEY_WIFI_OFF)
- return;
-
- wifi_power_on();