+static void __tethering_disabled_cb(tethering_error_e error, tethering_type_e type, tethering_disabled_cause_e code, void *data)
+{
+ int ret;
+
+ if (data) {
+ tethering_h th = (tethering_h)data;
+ tethering_destroy(th);
+ }
+
+ ret = wifi_initialize();
+ setting_retm_if(ret < 0, "*** [ERR] wifi_initialize() ***");
+
+ ret = wifi_activate(NULL, NULL);
+ if (ret < 0) {
+ wifi_deinitialize();
+ }
+ setting_retm_if(ret < 0, "*** [ERR] wifi_activate() ***");
+
+ ret = wifi_deinitialize();
+ setting_retm_if(ret < 0, "*** [ERR] wifi_deinitialize() ***");
+}
+
+static void __tethering_turn_off_resp_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ setting_retm_if(NULL == obj, "NULL == obj");
+ int response_type = btn_type(obj);
+ Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
+
+ if (g_main_ad)
+ {
+ evas_object_del(g_main_ad->popup);
+ g_main_ad->popup = NULL;
+ }
+
+ if (POPUP_RESPONSE_OK == response_type)
+ {
+ tethering_h th = NULL;
+ tethering_error_e ret = TETHERING_ERROR_NONE;
+
+ ret = tethering_create(&th);
+ if (ret != TETHERING_ERROR_NONE) {
+ list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
+ list_item->chk_status = EINA_FALSE;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ }
+
+ ret = tethering_set_disabled_cb(th, TETHERING_TYPE_WIFI, __tethering_disabled_cb, th);
+ if (ret != TETHERING_ERROR_NONE) {
+ list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
+ list_item->chk_status = EINA_FALSE;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+
+ tethering_destroy(th);
+ return;
+ }
+
+ tethering_disable(th, TETHERING_TYPE_WIFI);
+ }
+ else if (POPUP_RESPONSE_CANCEL == response_type)
+ {
+ list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
+ list_item->chk_status = EINA_FALSE;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ }
+}
+
+void __alternate_wifi_mode(Setting_GenGroupItem_Data *list_item, Evas_Object *check)
+{
+ SETTING_TRACE_BEGIN;
+ int ret;
+ Eina_Bool status = elm_check_state_get(check);
+ SETTING_TRACE("wifi mode status : %d", status);
+
+ int value, err;
+
+ if (tethering_is_enabled(NULL, TETHERING_TYPE_WIFI) == TRUE) {
+ list_item->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+
+ g_main_ad->popup = setting_create_popup_with_btn(list_item,
+ g_main_ad->win_main, NULL,
+ _("Connecting Wi-Fi will turn off Mobile hotspot. Continue?"),
+ __tethering_turn_off_resp_cb,
+ 0, 2, _("IDS_COM_SK_OK"), _("IDS_COM_SK_CANCEL"));
+ } else {
+ ret = wifi_initialize();
+ if (ret < 0) {
+ setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err);
+ list_item->chk_status = value;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ }
+ setting_retm_if(ret < 0, "*** [ERR] wifi_initialize() ***");
+
+ if (status) {
+ ret = wifi_activate(NULL, NULL);
+ if (ret < 0) {
+ setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err);
+ list_item->chk_status = value;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ wifi_deinitialize();
+ }
+ setting_retm_if(ret < 0, "*** [ERR] wifi_activate() ***");
+ } else {
+ ret = wifi_deactivate(NULL, NULL);
+ if (ret < 0) {
+ setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err);
+ list_item->chk_status = value;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ wifi_deinitialize();
+ }
+ setting_retm_if(ret < 0, "*** [ERR] wifi_deactivate() ***");
+ }
+
+ ret = wifi_deinitialize();
+ if (ret < 0) {
+ setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err);
+ list_item->chk_status = value;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ }
+ setting_retm_if(ret < 0, "*** [ERR] wifi_deinitialize() ***");
+
+ list_item->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+
+ }
+ SETTING_TRACE_END;
+}
+
+void __alternate_bt_mode(Setting_GenGroupItem_Data *list_item, Evas_Object *check)
+{
+ SETTING_TRACE_BEGIN;
+ int ret;
+ Eina_Bool status = elm_check_state_get(check);
+ SETTING_TRACE("bt mode status : %d", status);
+
+ int value, err;
+
+ ret = bt_initialize();
+ if (ret < 0) {
+ setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err);
+ list_item->chk_status = value;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ }
+ setting_retm_if(ret < 0, "*** [ERR] bt_initialize() ***");
+
+
+ if (status) {
+ ret = bt_adapter_enable();
+ if (ret < 0) {
+ setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err);
+ list_item->chk_status = value;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ bt_deinitialize();
+ }
+ setting_retm_if(ret < 0, "*** [ERR] bt_adapter_enable() ***");
+ } else {
+ ret = bt_adapter_disable();
+ if (ret < 0) {
+ setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err);
+ list_item->chk_status = value;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ bt_deinitialize();
+ }
+ setting_retm_if(ret < 0, "*** [ERR] bt_adapter_disable() ***");
+ }
+
+ ret = bt_deinitialize();
+ if (ret < 0) {
+ setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err);
+ list_item->chk_status = value;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ }
+ setting_retm_if(ret < 0, "*** [ERR] bt_deinitialize() ***");
+
+ list_item->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+
+ SETTING_TRACE_END;
+}
+
+void __alternate_nfc_mode(Setting_GenGroupItem_Data *list_item, Evas_Object *check)
+{
+ SETTING_TRACE_BEGIN;
+ int ret;
+ Eina_Bool status = elm_check_state_get(check);
+ SETTING_TRACE("nfc mode status : %d", status);
+
+ int value, err;
+
+ ret = nfc_manager_initialize(NULL, NULL);
+ if (ret < 0) {
+ setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &value, &err);
+ list_item->chk_status = value;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ }
+ setting_retm_if(ret < 0, "*** [ERR] nfc_manager_initialize() ***");
+
+ ret = nfc_manager_set_activation(status, NULL, NULL);
+ if (ret < 0) {
+ setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &value, &err);
+ list_item->chk_status = value;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ nfc_manager_deinitialize();
+ }
+ setting_retm_if(ret < 0, "*** [ERR] nfc_manager_set_activation() ***");
+
+ ret = nfc_manager_deinitialize();
+ if (ret < 0) {
+ setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &value, &err);
+ list_item->chk_status = value;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+ }
+ setting_retm_if(ret < 0, "*** [ERR] nfc_manager_deinitialize() ***");
+
+ list_item->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
+ elm_object_item_data_set(list_item->item, list_item);
+ elm_genlist_item_update(list_item->item);
+
+ SETTING_TRACE_END;
+}
+
+void __alternate_sbeam_mode(Evas_Object *check)
+{
+ SETTING_TRACE_BEGIN;
+ int ret;
+ Eina_Bool status = elm_check_state_get(check);
+ SETTING_TRACE("wifi mode status : %d", status);
+
+ vconf_set_bool(VCONFKEY_NFC_SBEAM, status);
+
+ SETTING_TRACE_END;
+}
+