Tethering: Power on Wi-Fi before enable Wi-Fi tethering
[apps/native/ug-mobile-ap.git] / src / mh_common_utility.c
index d1a4969..b0a399b 100644 (file)
@@ -1,13 +1,13 @@
 /*
 * ug-mobile-ap
 *
-* Copyright 2012  Samsung Electronics Co., Ltd
+* Copyright 2012-2013  Samsung Electronics Co., Ltd
 
-* Licensed under the Flora License, Version 1.0 (the "License");
+* Licensed under the Flora License, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 
-* http://www.tizenopensource.org/license
+* http://floralicense.org/license
 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
@@ -104,9 +104,15 @@ static void __popup_resp_yes(void *data, Evas_Object *obj, void *event_info)
        switch (popup_type) {
        case MH_POP_WIFI_ON_CONF:
                wifi_is_activated(&wifi_state);
-               if (wifi_state == true) {
-                       if (_turn_off_wifi(ad) != 0) {
-                               ERR("_turn_off_wifi is failed\n");
+               DBG("wifi_state : %d\n", wifi_state);
+               if (wifi_state == false) {
+                       ret = vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_WIFI_STATE,
+                                       VCONFKEY_MOBILE_HOTSPOT_WIFI_PENDING_ON);
+                       if (ret < 0)
+                               ERR("vconf_set_int() is failed : %d\n", ret);
+
+                       if (_turn_on_wifi(ad) != 0) {
+                               ERR("_turn_on_wifi is failed\n");
                                _update_wifi_item(ad, MH_STATE_NONE);
                        }
                } else if (_is_wifi_direct_on() == true) {
@@ -124,6 +130,11 @@ static void __popup_resp_yes(void *data, Evas_Object *obj, void *event_info)
                break;
 
        case MH_POP_WIFI_OFF_CONF:
+               ret = vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_WIFI_STATE,
+                               VCONFKEY_MOBILE_HOTSPOT_WIFI_PENDING_OFF);
+               if (ret < 0)
+                       ERR("vconf_set_int() is failed : %d\n", ret);
+
                ret = tethering_disable(ad->handle, TETHERING_TYPE_WIFI);
                if (ret != TETHERING_ERROR_NONE) {
                        ERR("wifi tethering off is failed : %d\n", ret);
@@ -728,4 +739,4 @@ Evas_Object *_create_slide_title(Evas_Object *parent, const char *text)
 
        elm_access_object_unregister(label);
        return label;
-}
\ No newline at end of file
+}