#define VCONF_WIFI_OFF_STATE_BY_AIRPLANE "file/private/wifi/wifi_off_by_airplane"
#define VCONF_WIFI_OFF_STATE_BY_RESTRICTED "file/private/wifi/wifi_off_by_restricted"
#define VCONF_WIFI_OFF_STATE_BY_EMERGENCY "file/private/wifi/wifi_off_by_emergency"
-#if defined TIZEN_WEARABLE
-#define VCONF_WIFI_WEARABLE_WIFI_USE "db/private/wifi/wearable_wifi_use"
-#endif
#if !defined TIZEN_WEARABLE
#define VCONFKEY_SETAPPL_NETWORK_PERMIT_WITH_LCD_OFF_LIMIT "db/setting/network_with_lcd_off_limit"
#endif
static gboolean wifi_firmware_recovery_mode = FALSE;
static int airplane_mode = 0;
-#if defined TIZEN_WEARABLE
-static int psmode_wifi_use = 1;
-#endif
-
static gboolean __is_wifi_restricted(void)
{
#if defined TIZEN_WEARABLE
static int retry_count = NETCONFIG_TECH_WAITING_COUNT;
gboolean value_enable = TRUE;
gboolean reply = FALSE;
- GVariant *param0 = NULL;
GVariant *params = NULL;
char key[] = "Powered";
return TRUE;
}
- param0 = g_variant_new_boolean(value_enable);
- params = g_variant_new("(sv)", key, param0);
+ params = g_variant_new("(sv)", key, g_variant_new_boolean(value_enable));
reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
CONNMAN_WIFI_TECHNOLOGY_PREFIX,
static int _set_connman_technology_power(gboolean enable)
{
gboolean reply = FALSE;
- GVariant *param0 = NULL;
GVariant *params = NULL;
char key[] = "Powered";
gboolean value_enable = TRUE;
return 0;
}
- if (enable == TRUE)
- param0 = g_variant_new_boolean(value_enable);
- else
- param0 = g_variant_new_boolean(value_disable);
-
- params = g_variant_new("(sv)", key, param0);
+ params = g_variant_new("(sv)", key, (enable == TRUE) ?
+ g_variant_new_boolean(value_enable) : g_variant_new_boolean(value_disable));
reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
CONNMAN_WIFI_TECHNOLOGY_PREFIX, CONNMAN_TECHNOLOGY_INTERFACE,
int netconfig_wifi_on_wearable(gboolean device_picker_test)
{
int err = 0;
- int wifi_use;
int ps_mode;
- if (netconfig_vconf_get_int(VCONF_WIFI_WEARABLE_WIFI_USE, &wifi_use) < 0) {
- ERR("Fail to get VCONF_WIFI_WEARABLE_WIFI_USE");
+ if (netconfig_vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &ps_mode) < 0) {
+ ERR("Fail to get VCONFKEY_SETAPPL_PSMODE");
return -EIO;
}
- if (wifi_use > 0) {
- if (netconfig_vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &ps_mode) < 0) {
- ERR("Fail to get VCONFKEY_SETAPPL_PSMODE");
- return -EIO;
- }
-
- if (ps_mode > SETTING_PSMODE_NORMAL) {
- WARN("ps mode is on(%d), Not turn on Wi-Fi", ps_mode);
- return -EPERM;
- }
- } else {
- WARN("Not permitted Wi-Fi on");
+ if (ps_mode > SETTING_PSMODE_NORMAL) {
+ WARN("ps mode is on(%d), Not turn on Wi-Fi", ps_mode);
return -EPERM;
}
return err;
}
-
-static void __wearable_wifi_use_changed_cb(keynode_t* node, void* user_data)
-{
- int wifi_state;
- int wifi_use = 1;
-
- if (netconfig_vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state) < 0) {
- ERR("Fail to get VCONFKEY_WIFI_STATE");
- return;
- }
-
- if (node != NULL)
- wifi_use = vconf_keynode_get_int(node);
- else
- netconfig_vconf_get_int(VCONF_WIFI_WEARABLE_WIFI_USE, &wifi_use);
-
- if (wifi_use > 0) {
- DBG("wifi use on");
- if (wifi_state > VCONFKEY_WIFI_OFF) {
- WARN("Wi-Fi is already turned on");
- return;
- }
- wifi_power_on_wearable(TRUE);
- } else {
- ERR("## wifi use [OFF]");
- if (wifi_state == VCONFKEY_WIFI_OFF) {
- WARN("Wi-Fi is already turned off");
- return;
- }
-
- wifi_power_off();
- }
-}
#else
static void __netconfig_wifi_restrict_mode(keynode_t *node, void *user_data)
{
int wifi_off_by_airplane = 0;
netconfig_vconf_get_int(VCONF_WIFI_OFF_STATE_BY_AIRPLANE, &wifi_off_by_airplane);
-
-#if defined TIZEN_WEARABLE
- netconfig_vconf_get_int(VCONF_WIFI_WEARABLE_WIFI_USE, &wifi_state);
-#else
netconfig_vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
-#endif
if (node != NULL)
airplane_state = vconf_keynode_get_bool(node);
wifi_power_off();
netconfig_set_vconf_int(VCONF_WIFI_OFF_STATE_BY_AIRPLANE, 1);
-#if defined TIZEN_WEARABLE
- netconfig_set_vconf_int(VCONF_WIFI_WEARABLE_WIFI_USE, 0);
-#endif
} else {
/* airplane mode off */
if (!wifi_off_by_airplane)
return;
netconfig_set_vconf_int(VCONF_WIFI_OFF_STATE_BY_AIRPLANE, 0);
-#if defined TIZEN_WEARABLE
- netconfig_set_vconf_int(VCONF_WIFI_WEARABLE_WIFI_USE, 1);
-#else
if (wifi_state > VCONFKEY_WIFI_OFF)
return;
wifi_power_on();
-#endif
}
}
#if !defined TIZEN_WEARABLE
int emergency_by_fmm = 0;
#endif
-#if defined TIZEN_WEARABLE
- int wifi_use = 1;
-#endif
-
netconfig_vconf_get_int(VCONF_WIFI_OFF_STATE_BY_EMERGENCY, &wifi_off_by_emergency);
netconfig_vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
/* basic power saving mode on */
} else if (emergency == SETTING_PSMODE_WEARABLE_ENHANCED) {
/* enhanced power saving mode on */
- netconfig_vconf_get_int(VCONF_WIFI_WEARABLE_WIFI_USE, &wifi_use);
- psmode_wifi_use = wifi_use;
- if (wifi_use != 0)
- netconfig_set_vconf_int(VCONF_WIFI_WEARABLE_WIFI_USE, 0);
-
if (wifi_state == VCONFKEY_WIFI_OFF)
return;
netconfig_set_vconf_int(VCONF_WIFI_OFF_STATE_BY_EMERGENCY, 1);
} else {
/* power saving mode off */
- netconfig_set_vconf_int(VCONF_WIFI_WEARABLE_WIFI_USE, psmode_wifi_use);
if (!wifi_off_by_emergency)
return;
int wifi_power_on_wearable(gboolean device_picker_test)
{
int err = 0;
- int wifi_use = 1;
wifi_tech_state_e tech_state;
tech_state = wifi_state_get_technology_state();
if (tech_state >= NETCONFIG_WIFI_TECH_POWERED)
return -EALREADY;
- if (netconfig_vconf_get_int(VCONF_WIFI_WEARABLE_WIFI_USE, &wifi_use) < 0) {
- ERR("Fail to get VCONF_WIFI_WEARABLE_WIFI_USE");
- return -EIO;
- }
-
- if (wifi_use == 0) {
- WARN("VCONF_WIFI_WEARABLE_WIFI_USE is OFF");
- return -EPERM;
- }
-
err = wifi_power_driver_and_supplicant(TRUE);
if (err < 0 && err != -EALREADY)
return err;
}
#if defined TIZEN_WEARABLE
- vconf_notify_key_changed(VCONF_WIFI_WEARABLE_WIFI_USE, __wearable_wifi_use_changed_cb, NULL);
-
vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
__netconfig_wifi_airplane_mode, NULL);
#else
DBG("Wi-Fi power on requested");
- g_return_val_if_fail(wifi != NULL, FALSE);
+ g_return_val_if_fail(wifi != NULL, TRUE);
if (!netconfig_dpm_update_from_wifi()) {
DBG("DPM policy restricts Wi-Fi");
netconfig_wifi_enable_device_picker_test();
#endif
if (err < 0) {
- if (err == -EINPROGRESS)
- netconfig_error_inprogress(context);
- else if (err == -EALREADY)
+ if (err == -EALREADY)
netconfig_error_already_exists(context);
else if (err == -EPERM)
netconfig_error_permission_denied(context);
DBG("Wi-Fi power off requested");
- g_return_val_if_fail(wifi != NULL, FALSE);
+ g_return_val_if_fail(wifi != NULL, TRUE);
err = wifi_power_off();
if (err < 0) {