From fd186fc26f79431c35c6114377ad8dcdf7dfac7d Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Mon, 20 Jun 2016 17:54:55 +0900 Subject: [PATCH] [wearable] Remove weconn dependency Change-Id: I96e1c29fd0de8ab866f7dbcef59678cba5ec76e2 Signed-off-by: Seonah Moon --- CMakeLists.txt | 1 - include/util.h | 13 ------- packaging/net-config.spec | 4 +-- src/signal-handler.c | 4 +-- src/utils/util.c | 91 ----------------------------------------------- src/wifi-agent.c | 23 ------------ src/wifi-power.c | 73 +------------------------------------ src/wifi-state.c | 6 ---- 8 files changed, 5 insertions(+), 210 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c069f5..8cb1db5 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,6 @@ ENDIF(TIZEN_TV) IF(TIZEN_WEARABLE) ADD_DEFINITIONS(-DTIZEN_WEARABLE) - SET(WEARABLE_REQUIRED_PKGS "weconn") ENDIF(TIZEN_WEARABLE) IF(TIZEN_TELEPHONY_ENABLE) diff --git a/include/util.h b/include/util.h index 970c4ef..6a5e541 100755 --- a/include/util.h +++ b/include/util.h @@ -36,15 +36,6 @@ extern "C" { #define MAX_SIZE_ERROR_BUFFER 256 -#if defined TIZEN_WEARABLE -typedef enum { - WC_POPUP_TYPE_SESSION_OVERLAPPED, - WC_POPUP_TYPE_WIFI_CONNECTED, - WC_POPUP_TYPE_CAPTIVE_PORTAL, - WC_POPUP_TYPE_WIFI_RESTRICT -}netconfig_wcpopup_type_e; -#endif - GKeyFile *netconfig_keyfile_load(const char *pathname); void netconfig_keyfile_save(GKeyFile *keyfile, const char *pathname); @@ -82,10 +73,6 @@ int netconfig_send_message_to_net_popup(const char *title, int netconfig_send_restriction_to_net_popup(const char *title, const char *type, const char *restriction); void netconfig_set_system_event(const char * sys_evt, const char * evt_key, const char * evt_val); -#if defined TIZEN_WEARABLE -int wc_launch_syspopup(netconfig_wcpopup_type_e type); -int wc_launch_popup(netconfig_wcpopup_type_e type); -#endif void netconfig_set_vconf_int(const char * key, int value); void netconfig_set_vconf_str(const char * key, const char * value); int netconfig_vconf_get_int(const char * key, int *value); diff --git a/packaging/net-config.spec b/packaging/net-config.spec index 16d02c4..a5e0037 100755 --- a/packaging/net-config.spec +++ b/packaging/net-config.spec @@ -1,6 +1,6 @@ Name: net-config Summary: TIZEN Network Configuration service -Version: 1.1.76 +Version: 1.1.77 Release: 2 Group: System/Network License: Apache-2.0 @@ -48,7 +48,7 @@ cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DTIZEN_TETHERING_ENABLE=1 \ %endif %if "%{profile}" == "mobile" - -DTIZEN_TELEPHONY_ENABLE=1 \ + -DTIZEN_TELEPHONY_ENABLE=1 \ -DTIZEN_WLAN_BOARD_SPRD=1 \ %else %if "%{profile}" == "tv" diff --git a/src/signal-handler.c b/src/signal-handler.c index 19eb5b5..34cb6f4 100755 --- a/src/signal-handler.c +++ b/src/signal-handler.c @@ -529,8 +529,8 @@ static void _supplicant_session_overlapped(GDBusConnection *conn, { DBG("Driver session overlapped handling!"); ERR("WPS PBC SESSION OVERLAPPED"); -#if defined TIZEN_WEARABLE - wc_launch_syspopup(WC_POPUP_TYPE_SESSION_OVERLAPPED); +#if defined TIZEN_WEARABLE + return; #else netconfig_send_message_to_net_popup("WPS Error", "wps session overlapped", "popup", NULL); diff --git a/src/utils/util.c b/src/utils/util.c index 15dcb15..336e6be 100755 --- a/src/utils/util.c +++ b/src/utils/util.c @@ -17,9 +17,6 @@ * */ -#if defined TIZEN_WEARABLE -#include -#endif #include #include #include @@ -45,7 +42,6 @@ #include "neterror.h" #include "wifi-state.h" -#define WC_POPUP_EXTRA_DATA_KEY "http://tizen.org/appcontrol/data/connection_type" #define MAC_INFO_FILEPATH tzplatform_mkpath(TZ_SYS_ETC, "/.mac.info") #define MAC_ADDRESS_MAX_LEN 18 @@ -271,18 +267,11 @@ void netconfig_wifi_device_picker_service_start(void) else return; -#if defined TIZEN_WEARABLE - if (aul_app_is_running("org.tizen.wifi") > 0) { - DBG("wifi app is running"); - return; - } -#else int wifi_ug_state; netconfig_vconf_get_int(VCONFKEY_WIFI_UG_RUN_STATE, &wifi_ug_state); if (wifi_ug_state == VCONFKEY_WIFI_UG_RUN_STATE_ON_FOREGROUND) return; -#endif DBG("Register device picker timer with %d milliseconds", NETCONFIG_WIFI_DEVICE_PICKER_INTERVAL); netconfig_start_timer(NETCONFIG_WIFI_DEVICE_PICKER_INTERVAL, __netconfig_wifi_try_device_picker, NULL, &timer_id); @@ -938,86 +927,6 @@ void netconfig_set_system_event(const char * sys_evt, const char * evt_key, cons bundle_free(b); } -#if defined TIZEN_WEARABLE -int wc_launch_syspopup(netconfig_wcpopup_type_e type) -{ - int ret; - bundle* b; - char *ssid = NULL; - - b = bundle_create(); - if (!b) { - ERR("Failed to create bundle"); - return -1; - } - - switch (type) { - case WC_POPUP_TYPE_SESSION_OVERLAPPED: - bundle_add(b, "event-type", "wps-session-overlapped"); - break; - case WC_POPUP_TYPE_WIFI_CONNECTED: - ssid = vconf_get_str(VCONFKEY_WIFI_CONNECTED_AP_NAME); - if (ssid == NULL) { - ERR("Failed to get connected ap ssid"); - ssid = g_strdup(" "); - } - bundle_add(b, "event-type", "wifi-connected"); - bundle_add(b, "ssid", ssid); - if (ssid) - g_free(ssid); - break; - case WC_POPUP_TYPE_WIFI_RESTRICT: - bundle_add(b, "event-type", "wifi-restrict"); - break; - default: - ERR("Popup is not supported[%d]", type); - bundle_free(b); - return -1; - } - - ret = syspopup_launch("wc-syspopup", b); - if (ret < 0) - ERR("Failed to launch syspopup"); - - bundle_free(b); - return ret; -} - -int wc_launch_popup(netconfig_wcpopup_type_e type) -{ - int ret; - app_control_h app_control = NULL; - - ret = app_control_create(&app_control); - if (ret != APP_CONTROL_ERROR_NONE) { - ERR("Failed to create appcontrol[%d]", ret); - return -1; - } - - switch (type) { - case WC_POPUP_TYPE_CAPTIVE_PORTAL: - app_control_add_extra_data(app_control, WC_POPUP_EXTRA_DATA_KEY, "captive-portal"); - break; - default: - ERR("Popup is not supported[%d]", type); - app_control_destroy(app_control); - return -1; - } - - app_control_set_app_id(app_control, "com.samsung.weconn-popup"); - ret = app_control_send_launch_request(app_control, NULL, NULL); - if (ret != APP_CONTROL_ERROR_NONE) { - DBG("failed appcontrol launch request [%d]", ret); - app_control_destroy(app_control); - return -1; - } - - app_control_destroy(app_control); - - return 0; -} -#endif - void netconfig_set_vconf_int(const char * key, int value) { int ret = 0; diff --git a/src/wifi-agent.c b/src/wifi-agent.c index 8d0db7b..61dc12a 100755 --- a/src/wifi-agent.c +++ b/src/wifi-agent.c @@ -400,7 +400,6 @@ static gboolean is_monitor_notifier_registered = FALSE; #if defined TIZEN_WEARABLE static gboolean is_portal_msg_shown = FALSE; -static guint portal_msg_timer = 0; #endif struct poll_timer_data { @@ -530,18 +529,6 @@ static gboolean __netconfig_wifi_portal_login_timeout(gpointer data) return FALSE; } -#if defined TIZEN_WEARABLE -static gboolean __netconfig_display_portal_msg(gpointer data) -{ - DBG(""); - wc_launch_popup(WC_POPUP_TYPE_CAPTIVE_PORTAL); - - netconfig_stop_timer(&portal_msg_timer); - - return FALSE; -} -#endif - static void __netconfig_wifi_portal_login_timer_start(struct poll_timer_data *data) { @@ -593,17 +580,7 @@ gboolean handle_request_browser(NetConnmanAgent *connman_agent, is_monitor_notifier_registered = TRUE; } -#if defined TIZEN_WEARABLE - if (is_portal_msg_shown) { - net_connman_agent_complete_request_browser(connman_agent, context); - return TRUE; - } - - is_portal_msg_shown = TRUE; - netconfig_start_timer_seconds(4, __netconfig_display_portal_msg, NULL, &portal_msg_timer); -#else ret = netconfig_send_notification_to_net_popup(NETCONFIG_ADD_PORTAL_NOTI, ssid); -#endif timer_data.time_elapsed = 0; __netconfig_wifi_portal_login_timer_start(&timer_data); diff --git a/src/wifi-power.c b/src/wifi-power.c index 47af55c..a9d15a5 100755 --- a/src/wifi-power.c +++ b/src/wifi-power.c @@ -47,11 +47,6 @@ #define WLAN_SUPPLICANT_SCRIPT "/usr/sbin/wpa_supp.sh" #define P2P_SUPPLICANT_SCRIPT "/usr/sbin/p2p_supp.sh" -#if defined TIZEN_WEARABLE -#include -static weconn_h weconn_handle = NULL; -#endif - #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" @@ -427,19 +422,6 @@ int netconfig_wifi_on_wearable(gboolean device_picker_test) int err = 0; int wifi_use; int ps_mode; - enum netconfig_wifi_tech_state wifi_tech_state; - weconn_service_state_e weconn_state; - - wifi_tech_state = wifi_state_get_technology_state(); - if (wifi_tech_state >= NETCONFIG_WIFI_TECH_POWERED) - return -EALREADY; - - err = weconn_get_service_state(weconn_handle, W_SERVICE_TYPE_BT, - &weconn_state); - if (err == 0 && weconn_state == W_SERVICE_STATE_CONNECTED) { - WARN("Not permitted Wi-Fi on"); - return -EPERM; - } if (netconfig_vconf_get_int(VCONF_WIFI_WEARABLE_WIFI_USE, &wifi_use) < 0) { ERR("Fail to get VCONF_WIFI_WEARABLE_WIFI_USE"); @@ -473,47 +455,10 @@ int netconfig_wifi_on_wearable(gboolean device_picker_test) return err; } -static void __weconn_service_state_changed_cb(weconn_service_state_e state, void *user_data) -{ - if (state == W_SERVICE_STATE_CONNECTED) { - DBG("SAP is connected"); - if (wifi_state > VCONFKEY_WIFI_OFF) - wifi_power_off(); - } else if (state == W_SERVICE_STATE_DISCONNECTED) { - DBG("SAP is disconnected"); - wifi_power_on_wearable(FALSE); - } -} - -static int _weconn_set_state_changed_cb(int service_type, void *user_data) -{ - int ret; - - if (weconn_handle) { - weconn_destroy(weconn_handle); - weconn_handle = NULL; - } - - ret = weconn_create(&weconn_handle); - if (ret < 0) { - ERR("Failed weconn_create(%d)", ret); - return -1; - } - - ret = weconn_set_service_state_change_cb(weconn_handle, __weconn_service_state_changed_cb, service_type, user_data); - if (ret < 0) { - ERR("Failed weconn_set_service_state_change_cb(%d)", ret); - return -1; - } - - return 0; -} - static void __wearable_wifi_use_changed_cb(keynode_t* node, void* user_data) { int wifi_state; int wifi_use = 1; - gboolean wifi_restrict = FALSE; if (netconfig_vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state) < 0) { ERR("Fail to get VCONFKEY_WIFI_STATE"); @@ -531,15 +476,7 @@ static void __wearable_wifi_use_changed_cb(keynode_t* node, void* user_data) WARN("Wi-Fi is already turned on"); return; } - - wifi_restrict = netconfig_is_wifi_allowed(); - if (wifi_restrict == FALSE) { - DBG("launch wifi restrict popup"); - netconfig_set_vconf_int(VCONF_WIFI_WEARABLE_WIFI_USE, 0); - wc_launch_syspopup(WC_POPUP_TYPE_WIFI_RESTRICT); - } else { - wifi_power_on_wearable(TRUE); - } + wifi_power_on_wearable(TRUE); } else { ERR("## wifi use [OFF]"); if (wifi_state == VCONFKEY_WIFI_OFF) { @@ -986,18 +923,11 @@ int wifi_power_on_wearable(gboolean device_picker_test) int err = 0; int wifi_use = 1; wifi_tech_state_e tech_state; - weconn_service_state_e weconn_state; tech_state = wifi_state_get_technology_state(); if (tech_state >= NETCONFIG_WIFI_TECH_POWERED) return -EALREADY; - err = weconn_get_service_state(weconn_handle, W_SERVICE_TYPE_BT, &weconn_state); - if (err == 0 && weconn_state == W_SERVICE_STATE_CONNECTED) { - WARN("Not permitted Wi-Fi on"); - return -EPERM; - } - if (netconfig_vconf_get_int(VCONF_WIFI_WEARABLE_WIFI_USE, &wifi_use) < 0) { ERR("Fail to get VCONF_WIFI_WEARABLE_WIFI_USE"); return -EIO; @@ -1055,7 +985,6 @@ void wifi_power_initialize(void) } #if defined TIZEN_WEARABLE - _weconn_set_state_changed_cb(W_SERVICE_TYPE_BT, NULL); vconf_notify_key_changed(VCONF_WIFI_WEARABLE_WIFI_USE, __wearable_wifi_use_changed_cb, NULL); #if defined TIZEN_TELEPHONY_ENABLE diff --git a/src/wifi-state.c b/src/wifi-state.c index 3819afc..fbafbd9 100755 --- a/src/wifi-state.c +++ b/src/wifi-state.c @@ -587,9 +587,6 @@ void wifi_state_set_service_state(wifi_service_state_e new_state) if (new_state == NETCONFIG_WIFI_CONNECTED) { _wifi_state_connected_activation(); -#if defined TIZEN_WEARABLE - wc_launch_syspopup(WC_POPUP_TYPE_WIFI_CONNECTED); -#endif } } @@ -677,9 +674,6 @@ wifi_tech_state_e wifi_state_get_technology_state(void) void wifi_state_set_connected_essid(void) { __set_wifi_connected_essid(); -#if defined TIZEN_WEARABLE - wc_launch_syspopup(WC_POPUP_TYPE_WIFI_CONNECTED); -#endif } void wifi_state_get_connected_essid(gchar **essid) -- 2.7.4