Replaced Wi-Fi CAPI with Wi-Fi manager CAPI
[apps/native/ug-mobile-ap.git] / src / mh_main_ug.c
index bc03862..6a34cf1 100755 (executable)
@@ -41,46 +41,47 @@ static Evas_Object *create_content(mh_appdata_t *ad)
        return ad->naviframe;
 }
 
-static void __set_callbacks(tethering_h handle, void *user_data)
+static void __set_callbacks(mh_appdata_t *ad, void *user_data)
 {
        DBG("+\n");
 
        int ret;
 
-       ret = tethering_set_enabled_cb(handle, TETHERING_TYPE_ALL,
+       ret = tethering_set_enabled_cb(ad->handle, TETHERING_TYPE_ALL,
                        _enabled_cb, user_data);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_set_enabled_cb [0x%X]\n", ret);
 
-       ret = tethering_wifi_set_passphrase_changed_cb(handle,
+       ret = tethering_wifi_set_passphrase_changed_cb(ad->handle,
                        _passphrase_changed_cb, user_data);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_wifi_set_passphrase_changed_cb [0x%X]\n", ret);
 
-       ret = tethering_wifi_set_ssid_visibility_changed_cb(handle,
+       ret = tethering_wifi_set_ssid_visibility_changed_cb(ad->handle,
                        _visibility_changed_cb, user_data);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_wifi_set_ssid_visibility_changed_cb [0x%X]\n", ret);
 
-       ret = tethering_wifi_set_security_type_changed_cb(handle,
+       ret = tethering_wifi_set_security_type_changed_cb(ad->handle,
                        _security_type_changed_cb, user_data);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_wifi_set_security_type_changed_cb [0x%X]\n", ret);
 
-       ret = tethering_set_disabled_cb(handle, TETHERING_TYPE_ALL,
+       ret = tethering_set_disabled_cb(ad->handle, TETHERING_TYPE_ALL,
                        _disabled_cb, user_data);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_set_disabled_cb [0x%X]\n", ret);
 
-       ret = tethering_set_connection_state_changed_cb(handle,
+       ret = tethering_set_connection_state_changed_cb(ad->handle,
                        TETHERING_TYPE_ALL,
                        _connection_changed_cb, user_data);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_set_connection_state_changed_cb [0x%X]\n", ret);
 
-       ret = wifi_set_device_state_changed_cb(_wifi_state_changed_cb, user_data);
-       if (ret != WIFI_ERROR_NONE)
-               ERR("wifi_set_device_state_changed_cb [0x%X]\n", ret);
+       ret = wifi_manager_set_device_state_changed_cb(ad->wifi_handle,
+                       _wifi_state_changed_cb, user_data);
+       if (ret != WIFI_MANAGER_ERROR_NONE)
+               ERR("wifi_manager_set_device_state_changed_cb [0x%X]\n", ret);
        vconf_notify_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
                                _device_name_changed_cb, user_data);
 
@@ -96,38 +97,38 @@ static void __set_callbacks(tethering_h handle, void *user_data)
        DBG("-\n");
 }
 
-static void __unset_callbacks(tethering_h handle)
+static void __unset_callbacks(mh_appdata_t *ad)
 {
        DBG("+\n");
 
        int ret;
 
-       ret = wifi_unset_device_state_changed_cb();
-       if (ret != WIFI_ERROR_NONE)
-               ERR("wifi_unset_device_state_changed_cb [0x%X]\n", ret);
+       ret = wifi_manager_unset_device_state_changed_cb(ad->wifi_handle);
+       if (ret != WIFI_MANAGER_ERROR_NONE)
+               ERR("wifi_manager_unset_device_state_changed_cb [0x%X]\n", ret);
 
-       ret = tethering_unset_connection_state_changed_cb(handle,
+       ret = tethering_unset_connection_state_changed_cb(ad->handle,
                        TETHERING_TYPE_ALL);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_unset_connection_state_changed_cb[0x%X]\n", ret);
 
-       ret = tethering_unset_disabled_cb(handle, TETHERING_TYPE_ALL);
+       ret = tethering_unset_disabled_cb(ad->handle, TETHERING_TYPE_ALL);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_unset_disabled_cb [0x%X]\n", ret);
 
-       ret = tethering_wifi_unset_security_type_changed_cb(handle);
+       ret = tethering_wifi_unset_security_type_changed_cb(ad->handle);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_wifi_unset_security_type_changed_cb [0x%X]\n", ret);
 
-       ret = tethering_wifi_unset_ssid_visibility_changed_cb(handle);
+       ret = tethering_wifi_unset_ssid_visibility_changed_cb(ad->handle);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_wifi_unset_ssid_visibility_changed_cb [0x%X]\n", ret);
 
-       ret = tethering_wifi_unset_passphrase_changed_cb(handle);
+       ret = tethering_wifi_unset_passphrase_changed_cb(ad->handle);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_wifi_unset_passphrase_changed_cb [0x%X]\n", ret);
 
-       ret = tethering_unset_enabled_cb(handle, TETHERING_TYPE_ALL);
+       ret = tethering_unset_enabled_cb(ad->handle, TETHERING_TYPE_ALL);
        if (ret != TETHERING_ERROR_NONE)
                ERR("tethering_unset_enabled [0x%X]\n", ret);
 
@@ -231,11 +232,11 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode,
        if (ret != CONNECTION_ERROR_NONE)
                ERR("connection_create() is failed : %d\n", ret);
 
-       ret = wifi_initialize();
-       if (ret != WIFI_ERROR_NONE)
-               ERR("wifi_initialize() is failed : %d\n", ret);
+       ret = wifi_manager_initialize(&ad->wifi_handle);
+       if (ret != WIFI_MANAGER_ERROR_NONE)
+               ERR("wifi_manager_initialize() is failed : %d\n", ret);
 
-       __set_callbacks(ad->handle, (void *)ad);
+       __set_callbacks(ad, (void *)ad);
 
        DBG("-\n");
        return layout;
@@ -344,9 +345,9 @@ static void on_destroy(ui_gadget_h ug, app_control_h app_control, void *priv)
        if (vconf_set_int(VCONF_MOBILE_AP_CONNECT_USB_POPUP_STATUS, 0) < 0)
                ERR("vconf_set_int is failed\n");
 
-       ret = wifi_deinitialize();
-       if (ret != WIFI_ERROR_NONE)
-               ERR("wifi_deinitialize() is failed : %d\n", ret);
+       ret = wifi_manager_deinitialize(ad->wifi_handle);
+       if (ret != WIFI_MANAGER_ERROR_NONE)
+               ERR("wifi_manager_deinitialize() is failed : %d\n", ret);
 
        ret = connection_destroy(ad->conn_handle);
        if (ret != CONNECTION_ERROR_NONE)