From 2bf7ba889892853e2f9a00e4455b41ffff6eb8af Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Wed, 12 Apr 2017 13:20:52 +0900 Subject: [PATCH] Replaced Wi-Fi CAPI with Wi-Fi manager CAPI Change-Id: I9a18a6245d17fe7285dfa9d8ea2fda0841679f73 Signed-off-by: Seonah Moon --- CMakeLists.txt | 2 +- include/mh_func_onoff.h | 3 +- include/mobile_hotspot.h | 5 ++-- packaging/ug-setting-mobileap-efl.spec | 4 +-- src/mh_func_onoff.c | 31 ++++--------------- src/mh_main_ug.c | 55 +++++++++++++++++----------------- src/mh_popup.c | 2 +- 7 files changed, 41 insertions(+), 61 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec25932..d5f1d98 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ ENDIF (TIZEN_FEATURE_EMULATOR) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -SET(dependents "elementary evas ui-gadget-1 capi-network-tethering capi-network-connection capi-network-wifi notification aul bundle efl-extension dpm") +SET(dependents "elementary evas ui-gadget-1 capi-network-tethering capi-network-connection capi-network-wifi-manager notification aul bundle efl-extension dpm") SET(CMAKE_BUILD_TYPE "Release") diff --git a/include/mh_func_onoff.h b/include/mh_func_onoff.h index 2eaa0a1..ea91d64 100644 --- a/include/mh_func_onoff.h +++ b/include/mh_func_onoff.h @@ -43,9 +43,8 @@ void _passphrase_changed_cb(void *user_data); int _handle_wifi_onoff_change(mh_appdata_t *ad); int _handle_bt_onoff_change(mh_appdata_t *ad); int _handle_usb_onoff_change(mh_appdata_t *ad); -int _turn_on_wifi(void); bool _is_wifi_direct_on(void); -void _wifi_state_changed_cb(wifi_device_state_e state, void *user_data); +void _wifi_state_changed_cb(wifi_manager_device_state_e state, void *user_data); void _wifi_tethering_checkbox_popup_status_set(bool value); bool _wifi_tethering_checkbox_popup_status_get(void); gboolean _ps_recheck_timeout_cb(gpointer data); diff --git a/include/mobile_hotspot.h b/include/mobile_hotspot.h index 69dc646..2ac8ce1 100755 --- a/include/mobile_hotspot.h +++ b/include/mobile_hotspot.h @@ -48,9 +48,9 @@ extern "C" { #include #include #include -#include -#include #include +#include +#include #include #include @@ -222,6 +222,7 @@ typedef struct { tethering_h handle; connection_h conn_handle; + wifi_manager_h wifi_handle; tethering_type_e type; Evas_Object *win; diff --git a/packaging/ug-setting-mobileap-efl.spec b/packaging/ug-setting-mobileap-efl.spec index 3537471..d337fdc 100755 --- a/packaging/ug-setting-mobileap-efl.spec +++ b/packaging/ug-setting-mobileap-efl.spec @@ -3,7 +3,7 @@ Name: ug-setting-mobileap-efl Summary: Tethering UI Gadget Library -Version: 1.0.159 +Version: 1.0.160 Release: 1 Group: App/Network License: Flora-1.1 @@ -12,7 +12,7 @@ Source0: %{name}-%{version}.tar.gz BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(ui-gadget-1) -BuildRequires: pkgconfig(capi-network-wifi) +BuildRequires: pkgconfig(capi-network-wifi-manager) BuildRequires: pkgconfig(capi-network-tethering) BuildRequires: pkgconfig(capi-network-connection) BuildRequires: pkgconfig(notification) diff --git a/src/mh_func_onoff.c b/src/mh_func_onoff.c index 242ff48..e6d8caf 100644 --- a/src/mh_func_onoff.c +++ b/src/mh_func_onoff.c @@ -265,7 +265,7 @@ int _create_wifi_hotspot_on_popup(mh_appdata_t *ad) bool wifi_state = false; int value = 0; - wifi_is_activated(&wifi_state); + wifi_manager_is_activated(ad->wifi_handle, &wifi_state); _set_vconf_prev_wifi_state(wifi_state); value = _get_checkbox_status(TETHERING_TYPE_WIFI); if (0 == value) { @@ -386,14 +386,6 @@ static void __disable_tethering_by_ind(mh_appdata_t *ad, tethering_disabled_caus return; } -/* Wi-Fi callbacks */ -static void __wifi_activated_cb(wifi_error_e result, void *user_data) -{ - DBG("+\n"); - - return; -} - /* Tethering callbacks */ void _enabled_cb(tethering_error_e result, tethering_type_e type, bool is_requested, void *user_data) { @@ -496,7 +488,7 @@ void _connection_changed_cb(tethering_client_h client, bool is_opened, void *use return; } -void _wifi_state_changed_cb(wifi_device_state_e state, void *user_data) +void _wifi_state_changed_cb(wifi_manager_device_state_e state, void *user_data) { if (user_data == NULL) { ERR("user_data is NULL\n"); @@ -508,11 +500,11 @@ void _wifi_state_changed_cb(wifi_device_state_e state, void *user_data) mh_appdata_t *ad = (mh_appdata_t *)user_data; char *str = NULL; char *fmt = NULL; - if (state == WIFI_DEVICE_STATE_ACTIVATED) { + if (state == WIFI_MANAGER_DEVICE_STATE_ACTIVATED) { if (ad->main.wifi_item && elm_object_item_disabled_get(ad->main.wifi_item)) elm_object_item_disabled_set(ad->main.wifi_item, EINA_FALSE); _set_vconf_prev_wifi_state(false); - } else if (state == WIFI_DEVICE_STATE_DEACTIVATED) { + } else if (state == WIFI_MANAGER_DEVICE_STATE_DEACTIVATED) { _set_vconf_prev_wifi_state(true); } @@ -522,7 +514,7 @@ void _wifi_state_changed_cb(wifi_device_state_e state, void *user_data) ad->popup_checkbox = NULL; evas_object_del(ad->popup); ad->popup = NULL; - if (state == WIFI_DEVICE_STATE_ACTIVATED) + if (state == WIFI_MANAGER_DEVICE_STATE_ACTIVATED) fmt = STR_TETH_ON_DESC_1; else fmt = STR_TETH_ON_DESC_2; @@ -766,19 +758,6 @@ int _handle_usb_onoff_change(mh_appdata_t *ad) return 0; } -int _turn_on_wifi(void) -{ - int ret; - - ret = wifi_activate(__wifi_activated_cb, NULL); - if (ret != WIFI_ERROR_NONE) { - ERR("wifi_activate() is failed : %d\n", ret); - return -1; - } - - return 0; -} - bool _is_wifi_direct_on(void) { int wifi_direct_state = 0; diff --git a/src/mh_main_ug.c b/src/mh_main_ug.c index bc03862..6a34cf1 100755 --- a/src/mh_main_ug.c +++ b/src/mh_main_ug.c @@ -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) diff --git a/src/mh_popup.c b/src/mh_popup.c index 9b35584..2c9a088 100755 --- a/src/mh_popup.c +++ b/src/mh_popup.c @@ -395,7 +395,7 @@ static void __language_changed_cb(void *data, Evas_Object *obj, void *event_info switch (ad->type) { case TETHERING_TYPE_WIFI: - wifi_is_activated(&wifi_state); + wifi_manager_is_activated(ad->wifi_handle, &wifi_state); _set_vconf_prev_wifi_state(wifi_state); if (wifi_state == true || _is_wifi_direct_on() == true) fmt = STR_TETH_ON_DESC_1; -- 2.7.4