diff options
author | Abhishek Sansanwal <abhishek.s94@samsung.com> | 2017-04-06 11:23:31 +0530 |
---|---|---|
committer | Abhishek Sansanwal <abhishek.s94@samsung.com> | 2017-04-06 11:25:47 +0530 |
commit | 0adf26fafb3b711028616f105380a24cd5be67b7 (patch) | |
tree | 7fae925759370e89a5ff386b25ede64ff08c56b4 | |
parent | 0674aebbf4bdf7c1a2c870f8c20a90691d8f731f (diff) | |
download | wifi-0adf26fafb3b711028616f105380a24cd5be67b7.tar.gz wifi-0adf26fafb3b711028616f105380a24cd5be67b7.tar.bz2 wifi-0adf26fafb3b711028616f105380a24cd5be67b7.zip |
Removed emulator build dependencysubmit/tizen/20170411.013600accepted/tizen/unified/20170411.035226
Signed-off-by: Abhishek Sansanwal <abhishek.s94@samsung.com>
Change-Id: I3e60d30afd2871b4baf84c584b0898e74e8a480e
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | packaging/org.tizen.w-wifi.spec | 3 | ||||
-rw-r--r-- | sources/wearable/CMakeLists.txt | 17 | ||||
-rw-r--r-- | sources/wearable/inc/net/emulator.h | 129 | ||||
-rwxr-xr-x | sources/wearable/inc/util/device.h | 36 | ||||
-rw-r--r-- | sources/wearable/src/net/emulator.c | 114 | ||||
-rw-r--r-- | sources/wearable/src/net/emulator.h | 129 | ||||
-rwxr-xr-x | sources/wearable/src/net/wifi_manager.c | 140 | ||||
-rw-r--r-- | sources/wearable/src/util/device.c | 113 | ||||
-rw-r--r-- | sources/wearable/src/wearable-circle/app_main.c | 39 | ||||
-rwxr-xr-x | sources/wearable/src/wearable-circle/view/layout_scan.c | 25 |
11 files changed, 444 insertions, 304 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ec2ce4e..136ddf1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,9 +16,6 @@ ENDIF(TIZEN_TETHERING_ENABLE) IF(MODEL_BUILD_FEATURE_WLAN_CONCURRENT_MODE) ADD_DEFINITIONS(-DMODEL_BUILD_FEATURE_WLAN_CONCURRENT_MODE) ENDIF(MODEL_BUILD_FEATURE_WLAN_CONCURRENT_MODE) -IF(TIZEN_EMULATOR) - ADD_DEFINITIONS(-DTIZEN_EMULATOR) -ENDIF(TIZEN_EMULATOR) INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED diff --git a/packaging/org.tizen.w-wifi.spec b/packaging/org.tizen.w-wifi.spec index 0ba4743..36642db 100644 --- a/packaging/org.tizen.w-wifi.spec +++ b/packaging/org.tizen.w-wifi.spec @@ -48,9 +48,6 @@ Wi-Fi UI Gadget for wearable cmake -DCMAKE_INSTALL_PREFIX=%{PREFIX} \ -DMODEL_BUILD_FEATURE_WLAN_CONCURRENT_MODE=1 \ -DTIZEN_WEARABLE=1 \ -%if "%{?_with_emulator}" == "1" - -DTIZEN_EMULATOR=1 \ -%endif . make %{?_smp_mflags} diff --git a/sources/wearable/CMakeLists.txt b/sources/wearable/CMakeLists.txt index 239ba9a..f02f5c0 100644 --- a/sources/wearable/CMakeLists.txt +++ b/sources/wearable/CMakeLists.txt @@ -27,11 +27,9 @@ SET(SRCS ${SRCS} src/net/wifi_manager.c src/net/wifi_generate_pin.c src/net/util/wifi_address.c - src/util/idler.c) -IF(TIZEN_EMULATOR) - SET(SRCS ${SRCS} - src/net/emulator.c) -ENDIF(TIZEN_EMULATOR) + src/util/idler.c + src/util/device.c + src/net/emulator.c) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/inc) @@ -78,13 +76,8 @@ pkg_check_modules(pkgs REQUIRED capi-ui-efl-util ecore-input capi-appfw-application - capi-network-connection) - -IF(NOT TIZEN_EMULATOR) - INCLUDE(FindPkgConfig) - pkg_check_modules(pkgs REQUIRED - capi-network-wifi-manager) -ENDIF(TIZEN_EMULATOR) + capi-network-connection + capi-network-wifi-manager) FIND_LIBRARY(LIB_M m) diff --git a/sources/wearable/inc/net/emulator.h b/sources/wearable/inc/net/emulator.h new file mode 100644 index 0000000..a08458a --- /dev/null +++ b/sources/wearable/inc/net/emulator.h @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * PROPRIETARY/CONFIDENTIAL + * + * This software is the confidential and proprietary information of + * SAMSUNG ELECTRONICS (Confidential Information). + * You shall not disclose such Confidential Information and shall + * use it only in accordance with the terms of the license agreement + * you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no + * representations or warranties about the suitability + * of the software, either express or implied, including but not + * limited to the implied warranties of merchantability, fitness for a particular purpose, or non- + * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as + * a result of using, modifying or distributing this software or its derivatives. + */ + + +int _wifi_manager_ap_create(wifi_manager_h wifi, const char* essid, wifi_manager_ap_h* ap); + +int _wifi_manager_ap_hidden_create(wifi_manager_h wifi, const char* essid, wifi_manager_ap_h* ap); + +int _wifi_manager_ap_destroy(wifi_manager_ap_h ap); + +int _wifi_manager_ap_clone(wifi_manager_ap_h* cloned_ap, wifi_manager_ap_h origin); + +int _wifi_manager_ap_refresh(wifi_manager_ap_h ap); + +int _wifi_manager_ap_get_essid(wifi_manager_ap_h ap, char** essid); + +int _wifi_manager_ap_get_rssi(wifi_manager_ap_h ap, int* rssi); + +int _wifi_manager_ap_get_frequency(wifi_manager_ap_h ap, int* frequency); + +int _wifi_manager_ap_get_max_speed(wifi_manager_ap_h ap, int* max_speed); + +int _wifi_manager_ap_is_favorite(wifi_manager_ap_h ap, bool* favorite); + +int _wifi_manager_ap_is_passpoint(wifi_manager_ap_h ap, bool* passpoint); + +int _wifi_manager_ap_get_connection_state(wifi_manager_ap_h ap, wifi_manager_connection_state_e* state); + +int _wifi_manager_ap_get_ip_config_type(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, wifi_manager_ip_config_type_e* type); + +int _wifi_manager_ap_set_ip_config_type(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, wifi_manager_ip_config_type_e type); + +int _wifi_manager_ap_get_ip_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** ip_address); + +int _wifi_manager_ap_set_ip_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* ip_address); + +int _wifi_manager_ap_get_subnet_mask(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** subnet_mask); + +int _wifi_manager_ap_set_subnet_mask(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* subnet_mask); + +int _wifi_manager_ap_get_gateway_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** gateway_address); + +int _wifi_manager_ap_set_gateway_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* gateway_address); + +int _wifi_manager_ap_get_proxy_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** proxy_address); + +int _wifi_manager_ap_set_proxy_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* proxy_address); + +int _wifi_manager_ap_get_proxy_type(wifi_manager_ap_h ap, wifi_manager_proxy_type_e* type); + +int _wifi_manager_ap_set_proxy_type(wifi_manager_ap_h ap, wifi_manager_proxy_type_e proxy_type); + +int _wifi_manager_ap_get_dns_address(wifi_manager_ap_h ap, int order, wifi_manager_address_family_e address_family, char** dns_address); + +int _wifi_manager_ap_set_dns_address(wifi_manager_ap_h ap, int order, wifi_manager_address_family_e address_family, const char* dns_address); + +int _wifi_manager_ap_get_security_type(wifi_manager_ap_h ap, wifi_manager_security_type_e* type); + +int _wifi_manager_ap_set_security_type(wifi_manager_ap_h ap, wifi_manager_security_type_e type); + +int _wifi_manager_ap_get_encryption_type(wifi_manager_ap_h ap, wifi_manager_encryption_type_e* type); + +int _wifi_manager_ap_set_encryption_type(wifi_manager_ap_h ap, wifi_manager_encryption_type_e type); + +int _wifi_manager_ap_is_passphrase_required(wifi_manager_ap_h ap, bool* required); + +int _wifi_manager_ap_set_passphrase(wifi_manager_ap_h ap, const char* passphrase); + +int _wifi_manager_ap_is_wps_supported(wifi_manager_ap_h ap, bool* supported); + +int _wifi_manager_ap_get_eap_type(wifi_manager_ap_h ap, wifi_manager_eap_type_e* type); + +int _wifi_manager_ap_set_eap_type(wifi_manager_ap_h ap, wifi_manager_eap_type_e type); + +int _wifi_manager_initialize(wifi_manager_h *wifi); + +int _wifi_manager_deinitialize(wifi_manager_h wifi); + +int _wifi_manager_activate(wifi_manager_h wifi, wifi_manager_activated_cb callback, void* user_data); + +int _wifi_manager_deactivate(wifi_manager_h wifi, wifi_manager_deactivated_cb callback, void* user_data); + +int _wifi_manager_is_activated(wifi_manager_h wifi, bool* activated); + +int _wifi_manager_scan(wifi_manager_h wifi, wifi_manager_scan_finished_cb callback, void* user_data); + +int _wifi_manager_get_connected_ap(wifi_manager_h wifi, wifi_manager_ap_h *ap); + +int _wifi_manager_foreach_found_ap(wifi_manager_h wifi, wifi_manager_found_ap_cb callback, void* user_data); + +int _wifi_manager_forget_ap(wifi_manager_h wifi, wifi_manager_ap_h ap); + +int _wifi_manager_get_connection_state(wifi_manager_h wifi, wifi_manager_connection_state_e *connection_state); + +int _wifi_manager_set_device_state_changed_cb(wifi_manager_h wifi, wifi_manager_device_state_changed_cb callback, void* user_data); + +int _wifi_manager_unset_device_state_changed_cb(wifi_manager_h wifi); + +int _wifi_manager_set_background_scan_cb(wifi_manager_h wifi, wifi_manager_scan_finished_cb callback, void* user_data); + +int _wifi_manager_unset_background_scan_cb(wifi_manager_h wifi); + +int _wifi_manager_set_connection_state_changed_cb(wifi_manager_h wifi, wifi_manager_connection_state_changed_cb callback, void* user_data); + +int _wifi_manager_unset_connection_state_changed_cb(wifi_manager_h wifi); + +int _wifi_manager_config_clone(wifi_manager_config_h origin, wifi_manager_config_h *cloned_config); + +int _wifi_manager_config_destroy(wifi_manager_config_h config); + +int _wifi_manager_config_foreach_configuration(wifi_manager_h wifi, wifi_manager_config_list_cb callback, void *user_data); + +int _wifi_manager_config_get_name(wifi_manager_config_h config, char **name); + +int _wifi_manager_config_get_security_type(wifi_manager_config_h config, wifi_manager_security_type_e *security_type); diff --git a/sources/wearable/inc/util/device.h b/sources/wearable/inc/util/device.h new file mode 100755 index 0000000..5eed6cc --- /dev/null +++ b/sources/wearable/inc/util/device.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * PROPRIETARY/CONFIDENTIAL + * + * This software is the confidential and proprietary information of + * SAMSUNG ELECTRONICS (Confidential Information). + * You shall not disclose such Confidential Information and shall + * use it only in accordance with the terms of the license agreement + * you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no + * representations or warranties about the suitability + * of the software, either express or implied, including but not + * limited to the implied warranties of merchantability, fitness for a particular purpose, or non- + * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as + * a result of using, modifying or distributing this software or its derivatives. + */ + + +#ifndef __UTIL_DEVICE_H__ +#define __UTIL_DEVICE_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include <Elementary.h> + +Eina_Bool _is_emulator(void); + + +#ifdef __cplusplus +} +#endif + +#endif /* __UTIL_DEVICE_H__ */ diff --git a/sources/wearable/src/net/emulator.c b/sources/wearable/src/net/emulator.c index 96055f4..f56e594 100644 --- a/sources/wearable/src/net/emulator.c +++ b/sources/wearable/src/net/emulator.c @@ -20,6 +20,8 @@ #include<dlog.h> #include<glib.h> +#include "net/emulator.h" + #define INET_ADDRSTRLEN 16 #define EMU_AP_LENGTH 5 #define EMU_AP_COUNT 5 @@ -92,37 +94,37 @@ typedef struct { static struct _wifi_cb_s wifi_callbacks = { 0, }; -int wifi_manager_ap_create(wifi_manager_h wifi, const char* essid, wifi_manager_ap_h* ap) +int _wifi_manager_ap_create(wifi_manager_h wifi, const char* essid, wifi_manager_ap_h* ap) { ap = (wifi_manager_ap_h *)g_try_malloc0(sizeof(wifi_manager_ap_h)); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_manager_ap_hidden_create(const char* essid, wifi_manager_ap_h* ap) +int _wifi_manager_manager_ap_hidden_create(const char* essid, wifi_manager_ap_h* ap) { ap = (wifi_manager_ap_h *)g_try_malloc0(sizeof(wifi_manager_ap_h)); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_destroy(wifi_manager_ap_h ap) +int _wifi_manager_ap_destroy(wifi_manager_ap_h ap) { g_free(ap); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_clone(wifi_manager_ap_h* cloned_ap, wifi_manager_ap_h origin) +int _wifi_manager_ap_clone(wifi_manager_ap_h* cloned_ap, wifi_manager_ap_h origin) { cloned_ap = (wifi_manager_ap_h *)g_try_malloc0(sizeof(wifi_manager_ap_h)); *cloned_ap = origin; return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_refresh(wifi_manager_ap_h ap) +int _wifi_manager_ap_refresh(wifi_manager_ap_h ap) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_essid(wifi_manager_ap_h ap, char** essid) +int _wifi_manager_ap_get_essid(wifi_manager_ap_h ap, char** essid) { static int counter = 0; *essid = g_try_malloc(sizeof(char)*(EMU_AP_LENGTH +1)); @@ -131,142 +133,142 @@ int wifi_manager_ap_get_essid(wifi_manager_ap_h ap, char** essid) return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_rssi(wifi_manager_ap_h ap, int* rssi) +int _wifi_manager_ap_get_rssi(wifi_manager_ap_h ap, int* rssi) { *rssi = (int)g_random_int_range(1, 100); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_frequency(wifi_manager_ap_h ap, int* frequency) +int _wifi_manager_ap_get_frequency(wifi_manager_ap_h ap, int* frequency) { *frequency = 2412; return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_max_speed(wifi_manager_ap_h ap, int* max_speed) +int _wifi_manager_ap_get_max_speed(wifi_manager_ap_h ap, int* max_speed) { *max_speed = 0; return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_is_favorite(wifi_manager_ap_h ap, bool* favorite) +int _wifi_manager_ap_is_favorite(wifi_manager_ap_h ap, bool* favorite) { *favorite = false; return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_is_passpoint(wifi_manager_ap_h ap, bool* passpoint) +int _wifi_manager_ap_is_passpoint(wifi_manager_ap_h ap, bool* passpoint) { *passpoint = false; return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_connection_state(wifi_manager_ap_h ap, wifi_manager_connection_state_e* state) +int _wifi_manager_ap_get_connection_state(wifi_manager_ap_h ap, wifi_manager_connection_state_e* state) { *state = WIFI_MANAGER_CONNECTION_STATE_DISCONNECTED; return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_ip_config_type(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, wifi_manager_ip_config_type_e* type) +int _wifi_manager_ap_get_ip_config_type(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, wifi_manager_ip_config_type_e* type) { *type = WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC; return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_set_ip_config_type(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, wifi_manager_ip_config_type_e type) +int _wifi_manager_ap_set_ip_config_type(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, wifi_manager_ip_config_type_e type) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_ip_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** ip_address) +int _wifi_manager_ap_get_ip_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** ip_address) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_set_ip_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* ip_address) +int _wifi_manager_ap_set_ip_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* ip_address) { ip_address = g_try_malloc0(INET_ADDRSTRLEN); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_subnet_mask(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** subnet_mask) +int _wifi_manager_ap_get_subnet_mask(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** subnet_mask) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_set_subnet_mask(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* subnet_mask) +int _wifi_manager_ap_set_subnet_mask(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* subnet_mask) { subnet_mask = g_try_malloc0(INET_ADDRSTRLEN); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_gateway_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** gateway_address) +int _wifi_manager_ap_get_gateway_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** gateway_address) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_set_gateway_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* gateway_address) +int _wifi_manager_ap_set_gateway_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* gateway_address) { gateway_address = g_try_malloc0(INET_ADDRSTRLEN); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_proxy_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** proxy_address) +int _wifi_manager_ap_get_proxy_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** proxy_address) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_set_proxy_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* proxy_address) +int _wifi_manager_ap_set_proxy_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* proxy_address) { proxy_address = g_try_malloc0(INET_ADDRSTRLEN); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_proxy_type(wifi_manager_ap_h ap, wifi_manager_proxy_type_e* type) +int _wifi_manager_ap_get_proxy_type(wifi_manager_ap_h ap, wifi_manager_proxy_type_e* type) { *type = WIFI_MANAGER_PROXY_TYPE_AUTO; return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_set_proxy_type(wifi_manager_ap_h ap, wifi_manager_proxy_type_e proxy_type) +int _wifi_manager_ap_set_proxy_type(wifi_manager_ap_h ap, wifi_manager_proxy_type_e proxy_type) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_dns_address(wifi_manager_ap_h ap, int order, wifi_manager_address_family_e address_family, char** dns_address) +int _wifi_manager_ap_get_dns_address(wifi_manager_ap_h ap, int order, wifi_manager_address_family_e address_family, char** dns_address) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_set_dns_address(wifi_manager_ap_h ap, int order, wifi_manager_address_family_e address_family, const char* dns_address) +int _wifi_manager_ap_set_dns_address(wifi_manager_ap_h ap, int order, wifi_manager_address_family_e address_family, const char* dns_address) { dns_address = g_try_malloc0(INET_ADDRSTRLEN); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_security_type(wifi_manager_ap_h ap, wifi_manager_security_type_e* type) +int _wifi_manager_ap_get_security_type(wifi_manager_ap_h ap, wifi_manager_security_type_e* type) { *type = (wifi_manager_security_type_e)WIFI_SECURITY_TYPE_WPA2_PSK; return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_set_security_type(wifi_manager_ap_h ap, wifi_manager_security_type_e type) +int _wifi_manager_ap_set_security_type(wifi_manager_ap_h ap, wifi_manager_security_type_e type) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_encryption_type(wifi_manager_ap_h ap, wifi_manager_encryption_type_e* type) +int _wifi_manager_ap_get_encryption_type(wifi_manager_ap_h ap, wifi_manager_encryption_type_e* type) { *type = (wifi_manager_encryption_type_e)g_random_int_range(0, 5); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_set_encryption_type(wifi_manager_ap_h ap, wifi_manager_encryption_type_e type) +int _wifi_manager_ap_set_encryption_type(wifi_manager_ap_h ap, wifi_manager_encryption_type_e type) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_is_passphrase_required(wifi_manager_ap_h ap, bool* required) +int _wifi_manager_ap_is_passphrase_required(wifi_manager_ap_h ap, bool* required) { static bool flip = true; flip = !flip; @@ -274,12 +276,12 @@ int wifi_manager_ap_is_passphrase_required(wifi_manager_ap_h ap, bool* required) return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_set_passphrase(wifi_manager_ap_h ap, const char* passphrase) +int _wifi_manager_ap_set_passphrase(wifi_manager_ap_h ap, const char* passphrase) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_is_wps_supported(wifi_manager_ap_h ap, bool* supported) +int _wifi_manager_ap_is_wps_supported(wifi_manager_ap_h ap, bool* supported) { static bool flip = true; flip = !flip; @@ -287,29 +289,29 @@ int wifi_manager_ap_is_wps_supported(wifi_manager_ap_h ap, bool* supported) return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_get_eap_type(wifi_manager_ap_h ap, wifi_manager_eap_type_e* type) +int _wifi_manager_ap_get_eap_type(wifi_manager_ap_h ap, wifi_manager_eap_type_e* type) { *type = (wifi_manager_eap_type_e)g_random_int_range(0, 5); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_ap_set_eap_type(wifi_manager_ap_h ap, wifi_manager_eap_type_e type) +int _wifi_manager_ap_set_eap_type(wifi_manager_ap_h ap, wifi_manager_eap_type_e type) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_initialize(wifi_manager_h *wifi) +int _wifi_manager_initialize(wifi_manager_h *wifi) { wifi = g_try_malloc0(sizeof(wifi_manager_h)); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_deinitialize(wifi_manager_h wifi) +int _wifi_manager_deinitialize(wifi_manager_h wifi) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_activate(wifi_manager_h wifi, wifi_manager_activated_cb callback, void* user_data) +int _wifi_manager_activate(wifi_manager_h wifi, wifi_manager_activated_cb callback, void* user_data) { callback(WIFI_MANAGER_ERROR_NONE, user_data); @@ -318,7 +320,7 @@ int wifi_manager_activate(wifi_manager_h wifi, wifi_manager_activated_cb callbac return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_deactivate(wifi_manager_h wifi, wifi_manager_deactivated_cb callback, void* user_data) +int _wifi_manager_deactivate(wifi_manager_h wifi, wifi_manager_deactivated_cb callback, void* user_data) { callback(WIFI_MANAGER_ERROR_NONE, user_data); @@ -327,24 +329,24 @@ int wifi_manager_deactivate(wifi_manager_h wifi, wifi_manager_deactivated_cb cal return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_is_activated(wifi_manager_h wifi, bool* activated) +int _wifi_manager_is_activated(wifi_manager_h wifi, bool* activated) { *activated = true; return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_scan(wifi_manager_h wifi, wifi_manager_scan_finished_cb callback, void* user_data) +int _wifi_manager_scan(wifi_manager_h wifi, wifi_manager_scan_finished_cb callback, void* user_data) { callback(WIFI_MANAGER_ERROR_NONE, user_data); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_get_connected_ap(wifi_manager_h wifi, wifi_manager_ap_h *ap) +int _wifi_manager_get_connected_ap(wifi_manager_h wifi, wifi_manager_ap_h *ap) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_foreach_found_ap(wifi_manager_h wifi, wifi_manager_found_ap_cb callback, void* user_data) +int _wifi_manager_foreach_found_ap(wifi_manager_h wifi, wifi_manager_found_ap_cb callback, void* user_data) { int ap_count = (int)g_random_int_range(5, 10); int i; @@ -354,18 +356,18 @@ int wifi_manager_foreach_found_ap(wifi_manager_h wifi, wifi_manager_found_ap_cb return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_forget_ap(wifi_manager_h wifi, wifi_manager_ap_h ap) +int _wifi_manager_forget_ap(wifi_manager_h wifi, wifi_manager_ap_h ap) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_get_connection_state(wifi_manager_h wifi, wifi_manager_connection_state_e *connection_state) +int _wifi_manager_get_connection_state(wifi_manager_h wifi, wifi_manager_connection_state_e *connection_state) { *connection_state = WIFI_MANAGER_CONNECTION_STATE_DISCONNECTED; return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_set_device_state_changed_cb(wifi_manager_h wifi, wifi_manager_device_state_changed_cb callback, void* user_data) +int _wifi_manager_set_device_state_changed_cb(wifi_manager_h wifi, wifi_manager_device_state_changed_cb callback, void* user_data) { wifi_callbacks.device_state_cb = callback; wifi_callbacks.device_state_user_data = user_data; @@ -373,40 +375,40 @@ int wifi_manager_set_device_state_changed_cb(wifi_manager_h wifi, wifi_manager_d return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_unset_device_state_changed_cb(wifi_manager_h wifi) +int _wifi_manager_unset_device_state_changed_cb(wifi_manager_h wifi) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_set_background_scan_cb(wifi_manager_h wifi, wifi_manager_scan_finished_cb callback, void* user_data) +int _wifi_manager_set_background_scan_cb(wifi_manager_h wifi, wifi_manager_scan_finished_cb callback, void* user_data) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_unset_background_scan_cb(wifi_manager_h wifi) +int _wifi_manager_unset_background_scan_cb(wifi_manager_h wifi) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_set_connection_state_changed_cb(wifi_manager_h wifi, wifi_manager_connection_state_changed_cb callback, void* user_data) +int _wifi_manager_set_connection_state_changed_cb(wifi_manager_h wifi, wifi_manager_connection_state_changed_cb callback, void* user_data) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_unset_connection_state_changed_cb(wifi_manager_h wifi) +int _wifi_manager_unset_connection_state_changed_cb(wifi_manager_h wifi) { return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_config_clone(wifi_manager_config_h origin, wifi_manager_config_h *cloned_config) +int _wifi_manager_config_clone(wifi_manager_config_h origin, wifi_manager_config_h *cloned_config) { cloned_config = g_try_malloc0(sizeof(wifi_manager_config_h)); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_config_destroy(wifi_manager_config_h config) +int _wifi_manager_config_destroy(wifi_manager_config_h config) { g_free(config); return WIFI_MANAGER_ERROR_NONE; @@ -414,20 +416,20 @@ int wifi_manager_config_destroy(wifi_manager_config_h config) -int wifi_manager_config_foreach_configuration(wifi_manager_h wifi, wifi_manager_config_list_cb callback, void *user_data) +int _wifi_manager_config_foreach_configuration(wifi_manager_h wifi, wifi_manager_config_list_cb callback, void *user_data) { wifi_manager_config_h *conf = g_try_malloc0(sizeof(wifi_manager_config_h)); callback(conf, user_data); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_config_get_name(wifi_manager_config_h config, char **name) +int _wifi_manager_config_get_name(wifi_manager_config_h config, char **name) { *name = g_strdup("config"); return WIFI_MANAGER_ERROR_NONE; } -int wifi_manager_config_get_security_type(wifi_manager_config_h config, wifi_manager_security_type_e *security_type) +int _wifi_manager_config_get_security_type(wifi_manager_config_h config, wifi_manager_security_type_e *security_type) { *security_type = (wifi_manager_security_type_e)g_random_int_range(0, 4); return WIFI_MANAGER_ERROR_NONE; diff --git a/sources/wearable/src/net/emulator.h b/sources/wearable/src/net/emulator.h deleted file mode 100644 index fd130cf..0000000 --- a/sources/wearable/src/net/emulator.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * PROPRIETARY/CONFIDENTIAL - * - * This software is the confidential and proprietary information of - * SAMSUNG ELECTRONICS (Confidential Information). - * You shall not disclose such Confidential Information and shall - * use it only in accordance with the terms of the license agreement - * you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no - * representations or warranties about the suitability - * of the software, either express or implied, including but not - * limited to the implied warranties of merchantability, fitness for a particular purpose, or non- - * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as - * a result of using, modifying or distributing this software or its derivatives. - */ - - -int wifi_manager_ap_create(wifi_manager_h wifi, const char* essid, wifi_manager_ap_h* ap); - -int wifi_manager_ap_hidden_create(wifi_manager_h wifi, const char* essid, wifi_manager_ap_h* ap); - -int wifi_manager_ap_destroy(wifi_manager_ap_h ap); - -int wifi_manager_ap_clone(wifi_manager_ap_h* cloned_ap, wifi_manager_ap_h origin); - -int wifi_manager_ap_refresh(wifi_manager_ap_h ap); - -int wifi_manager_ap_get_essid(wifi_manager_ap_h ap, char** essid); - -int wifi_manager_ap_get_rssi(wifi_manager_ap_h ap, int* rssi); - -int wifi_manager_ap_get_frequency(wifi_manager_ap_h ap, int* frequency); - -int wifi_manager_ap_get_max_speed(wifi_manager_ap_h ap, int* max_speed); - -int wifi_manager_ap_is_favorite(wifi_manager_ap_h ap, bool* favorite); - -int wifi_manager_ap_is_passpoint(wifi_manager_ap_h ap, bool* passpoint); - -int wifi_manager_ap_get_connection_state(wifi_manager_ap_h ap, wifi_manager_connection_state_e* state); - -int wifi_manager_ap_get_ip_config_type(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, wifi_manager_ip_config_type_e* type); - -int wifi_manager_ap_set_ip_config_type(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, wifi_manager_ip_config_type_e type); - -int wifi_manager_ap_get_ip_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** ip_address); - -int wifi_manager_ap_set_ip_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* ip_address); - -int wifi_manager_ap_get_subnet_mask(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** subnet_mask); - -int wifi_manager_ap_set_subnet_mask(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* subnet_mask); - -int wifi_manager_ap_get_gateway_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** gateway_address); - -int wifi_manager_ap_set_gateway_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* gateway_address); - -int wifi_manager_ap_get_proxy_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, char** proxy_address); - -int wifi_manager_ap_set_proxy_address(wifi_manager_ap_h ap, wifi_manager_address_family_e address_family, const char* proxy_address); - -int wifi_manager_ap_get_proxy_type(wifi_manager_ap_h ap, wifi_manager_proxy_type_e* type); - -int wifi_manager_ap_set_proxy_type(wifi_manager_ap_h ap, wifi_manager_proxy_type_e proxy_type); - -int wifi_manager_ap_get_dns_address(wifi_manager_ap_h ap, int order, wifi_manager_address_family_e address_family, char** dns_address); - -int wifi_manager_ap_set_dns_address(wifi_manager_ap_h ap, int order, wifi_manager_address_family_e address_family, const char* dns_address); - -int wifi_manager_ap_get_security_type(wifi_manager_ap_h ap, wifi_manager_security_type_e* type); - -int wifi_manager_ap_set_security_type(wifi_manager_ap_h ap, wifi_manager_security_type_e type); - -int wifi_manager_ap_get_encryption_type(wifi_manager_ap_h ap, wifi_manager_encryption_type_e* type); - -int wifi_manager_ap_set_encryption_type(wifi_manager_ap_h ap, wifi_manager_encryption_type_e type); - -int wifi_manager_ap_is_passphrase_required(wifi_manager_ap_h ap, bool* required); - -int wifi_manager_ap_set_passphrase(wifi_manager_ap_h ap, const char* passphrase); - -int wifi_manager_ap_is_wps_supported(wifi_manager_ap_h ap, bool* supported); - -int wifi_manager_ap_get_eap_type(wifi_manager_ap_h ap, wifi_manager_eap_type_e* type); - -int wifi_manager_ap_set_eap_type(wifi_manager_ap_h ap, wifi_manager_eap_type_e type); - -int wifi_manager_initialize(wifi_manager_h *wifi); - -int wifi_manager_deinitialize(wifi_manager_h wifi); - -int wifi_manager_activate(wifi_manager_h wifi, wifi_manager_activated_cb callback, void* user_data); - -int wifi_manager_deactivate(wifi_manager_h wifi, wifi_manager_deactivated_cb callback, void* user_data); - -int wifi_manager_is_activated(wifi_manager_h wifi, bool* activated); - -int wifi_manager_scan(wifi_manager_h wifi, wifi_manager_scan_finished_cb callback, void* user_data); - -int wifi_manager_get_connected_ap(wifi_manager_h wifi, wifi_manager_ap_h *ap); - -int wifi_manager_foreach_found_aps(wifi_manager_found_ap_cb callback, void* user_data); - -int wifi_manager_forget_ap(wifi_manager_h wifi, wifi_manager_ap_h ap); - -int wifi_manager_get_connection_state(wifi_manager_h wifi, wifi_manager_connection_state_e *connection_state); - -int wifi_manager_set_device_state_changed_cb(wifi_manager_h wifi, wifi_manager_device_state_changed_cb callback, void* user_data); - -int wifi_manager_unset_device_state_changed_cb(wifi_manager_h wifi); - -int wifi_manager_set_background_scan_cb(wifi_manager_h wifi, wifi_manager_scan_finished_cb callback, void* user_data); - -int wifi_manager_unset_background_scan_cb(wifi_manager_h wifi); - -int wifi_manager_set_connection_state_changed_cb(wifi_manager_h wifi, wifi_manager_connection_state_changed_cb callback, void* user_data); - -int wifi_manager_unset_connection_state_changed_cb(wifi_manager_h wifi); - -int wifi_manager_config_clone(wifi_manager_config_h origin, wifi_manager_config_h *cloned_config); - -int wifi_manager_config_destroy(wifi_manager_config_h config); - -int wifi_manager_config_foreach_configuration(wifi_manager_h wifi, wifi_manager_config_list_cb callback, void *user_data); - -int wifi_manager_config_get_name(wifi_manager_config_h config, char **name); - -int wifi_manager_config_get_security_type(wifi_manager_config_h config, wifi_manager_security_type_e *security_type); diff --git a/sources/wearable/src/net/wifi_manager.c b/sources/wearable/src/net/wifi_manager.c index e8e9621..9649c60 100755 --- a/sources/wearable/src/net/wifi_manager.c +++ b/sources/wearable/src/net/wifi_manager.c @@ -20,12 +20,13 @@ #include <glib.h> #include "util.h" +#include "util/device.h" #include "net/util/vconf_helper.h" #include "net/wifi_manager.h" #include "net/wifi_generate_pin.h" -#ifdef TIZEN_EMULATOR -#include "emulator.h" -#endif +#include "net/emulator.h" + +#define IS_EMU(expr) _is_emulator() ? _##expr : expr typedef enum { WIFI_MANAGER_CB_DEVICE_STATE_CHANGED, @@ -141,9 +142,9 @@ static bool __wifi_config_list_cb(const wifi_manager_config_h config, void *user config_obj = g_new0(wifi_config_object, 1); WIFI_RET_VAL_IF_FAIL(config_obj != NULL, true); - wifi_manager_config_clone(config, &(config_obj->handle)); - wifi_manager_config_get_name(config, &(config_obj->name)); - wifi_manager_config_get_security_type(config, &(config_obj->security_type)); + IS_EMU(wifi_manager_config_clone(config, &(config_obj->handle))); + IS_EMU(wifi_manager_config_get_name(config, &(config_obj->name))); + IS_EMU(wifi_manager_config_get_security_type(config, &(config_obj->security_type))); manager->config_list = g_list_append(manager->config_list, config_obj); __WIFI_FUNC_EXIT__; @@ -154,7 +155,7 @@ static void _wifi_config_destory(gpointer data) { wifi_config_object *config = data; if (config->handle) - wifi_manager_config_destroy(config->handle); + IS_EMU(wifi_manager_config_destroy(config->handle)); if (config->name) g_free(config->name); if (config->passphrase) @@ -186,7 +187,7 @@ static void _update_wifi_config_list(wifi_manager_object *manager) if (manager->config_list) _clear_wifi_config_list(manager); - err = wifi_manager_config_foreach_configuration(manager->wifi, __wifi_config_list_cb, manager); + err = IS_EMU(wifi_manager_config_foreach_configuration(manager->wifi, __wifi_config_list_cb, manager)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_config_foreach_configuration() is failed. error = %s", wifi_error_to_string(err)); @@ -239,19 +240,19 @@ static wifi_ap_object *_create_ap_object_by_ap_h(wifi_manager_ap_h ap) if (!ap_obj) return NULL; - if (WIFI_MANAGER_ERROR_NONE != wifi_manager_ap_clone(&(ap_obj->ap), ap)) { + if (WIFI_MANAGER_ERROR_NONE != IS_EMU(wifi_manager_ap_clone(&(ap_obj->ap), ap))) { WIFI_LOG_ERR("Failed to clone AP handle"); g_free(ap_obj); return NULL; } - if (WIFI_MANAGER_ERROR_NONE != wifi_manager_ap_get_rssi(ap, &(ap_obj->rssi))) { + if (WIFI_MANAGER_ERROR_NONE != IS_EMU(wifi_manager_ap_get_rssi(ap, &(ap_obj->rssi)))) { WIFI_LOG_ERR("Failed to get rssi of AP"); wifi_ap_destroy(ap_obj); return NULL; } - if (WIFI_MANAGER_ERROR_NONE != wifi_manager_ap_is_wps_supported(ap, &(ap_obj->wps_mode))) { + if (WIFI_MANAGER_ERROR_NONE != IS_EMU(wifi_manager_ap_is_wps_supported(ap, &(ap_obj->wps_mode)))) { WIFI_LOG_ERR("Failed to get wps mode of AP"); wifi_ap_destroy(ap_obj); return NULL; @@ -271,8 +272,8 @@ gint wifi_manager_default_compare_ap(gconstpointer a, gconstpointer b) bool favorite1 = false; bool favorite2 = false; - wifi_manager_ap_get_connection_state(ap_obj1->ap, &state1); - wifi_manager_ap_get_connection_state(ap_obj2->ap, &state2); + IS_EMU(wifi_manager_ap_get_connection_state(ap_obj1->ap, &state1)); + IS_EMU(wifi_manager_ap_get_connection_state(ap_obj2->ap, &state2)); if (state1 != state2) { if (state1 == WIFI_MANAGER_CONNECTION_STATE_CONNECTED) return -1; @@ -333,7 +334,7 @@ static bool __update_ap_list_foreach(wifi_manager_ap_h ap, void *user_data) wifi_ap_object *ap_obj = NULL; WIFI_RET_VAL_IF_FAIL(ap_list != NULL, true); - err = wifi_manager_ap_get_security_type(ap, &sec_type); + err = IS_EMU(wifi_manager_ap_get_security_type(ap, &sec_type)); WIFI_RET_VAL_IF_FAIL(err == WIFI_MANAGER_ERROR_NONE, true); if (sec_type == WIFI_MANAGER_SECURITY_TYPE_EAP) { WIFI_LOG_INFO("EAP type AP skip(No SIM model)."); @@ -369,8 +370,8 @@ static gchar *_ap_get_proxy_address(wifi_ap_object *ap_obj) wifi_manager_error_e err; WIFI_RET_VAL_IF_FAIL(ap_obj != NULL, NULL); - err = wifi_manager_ap_get_proxy_address(ap_obj->ap, - WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &proxy_address); + err = IS_EMU(wifi_manager_ap_get_proxy_address(ap_obj->ap, + WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &proxy_address)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_proxy_address() is failed. error = %s", wifi_error_to_string(err)); @@ -409,7 +410,7 @@ wifi_manager_error_e wifi_init(wifi_manager_object *manager) bool is_activate; WIFI_RET_VAL_IF_FAIL(manager, WIFI_MANAGER_ERROR_INVALID_PARAMETER); - err = wifi_manager_initialize(&(manager->wifi)); + err = IS_EMU(wifi_manager_initialize(&(manager->wifi))); if (err != WIFI_MANAGER_ERROR_NONE) return err; @@ -435,17 +436,17 @@ wifi_manager_error_e wifi_deinit(wifi_manager_object *manager) while (cb_data_list) { wifi_manager_cb_data *cb_data = cb_data_list->data; if (cb_data->type == WIFI_MANAGER_CB_DEVICE_STATE_CHANGED) - wifi_manager_unset_device_state_changed_cb(manager->wifi); + IS_EMU(wifi_manager_unset_device_state_changed_cb(manager->wifi)); else if (cb_data->type == WIFI_MANAGER_CB_CONNECTION_STATE_CHANGED) - wifi_manager_unset_connection_state_changed_cb(manager->wifi); + IS_EMU(wifi_manager_unset_connection_state_changed_cb(manager->wifi)); else if (cb_data->type == WIFI_MANAGER_CB_BACKGROUND_SCAN) - wifi_manager_unset_background_scan_cb(manager->wifi); + IS_EMU(wifi_manager_unset_background_scan_cb(manager->wifi)); cb_data_list = cb_data_list->next; } g_list_free_full(manager->cb_data_list, g_free); } - return wifi_manager_deinitialize(manager->wifi); + return IS_EMU(wifi_manager_deinitialize(manager->wifi)); } wifi_manager_error_e wifi_generate_wps_pin(wifi_manager_object *manager, char **pin) @@ -512,7 +513,7 @@ wifi_manager_error_e wifi_scan(wifi_manager_object *manager, cb_data->user_data = user_data; WIFI_LOG_INFO("Wi-Fi Scan start."); - return wifi_manager_scan(manager->wifi, __wifi_common_cb, cb_data); + return IS_EMU(wifi_manager_scan(manager->wifi, __wifi_common_cb, cb_data)); } return WIFI_MANAGER_ERROR_OUT_OF_MEMORY; } @@ -523,7 +524,7 @@ wifi_manager_error_e wifi_get_found_ap_list(wifi_manager_object *manager, wifi_manager_error_e error = WIFI_MANAGER_ERROR_INVALID_PARAMETER; WIFI_RET_VAL_IF_FAIL(manager, WIFI_MANAGER_ERROR_INVALID_PARAMETER); - error = wifi_manager_foreach_found_ap(manager->wifi, __update_ap_list_foreach, ap_list); + error = IS_EMU(wifi_manager_foreach_found_ap(manager->wifi, __update_ap_list_foreach, ap_list)); if (error != WIFI_MANAGER_ERROR_NONE) { if (*ap_list) { g_list_free(*ap_list); @@ -546,7 +547,7 @@ wifi_manager_error_e wifi_activate(wifi_manager_object *manager, cb_data->manager = manager; cb_data->cb = callback; cb_data->user_data = user_data; - return wifi_manager_activate(manager->wifi, __wifi_common_cb, cb_data); + return IS_EMU(wifi_manager_activate(manager->wifi, __wifi_common_cb, cb_data)); } return WIFI_MANAGER_ERROR_OUT_OF_MEMORY; } @@ -564,7 +565,7 @@ wifi_manager_error_e wifi_deactivate(wifi_manager_object *manager, cb_data->manager = manager; cb_data->cb = callback; cb_data->user_data = user_data; - return wifi_manager_deactivate(manager->wifi, __wifi_common_cb, cb_data); + return IS_EMU(wifi_manager_deactivate(manager->wifi, __wifi_common_cb, cb_data)); } return WIFI_MANAGER_ERROR_OUT_OF_MEMORY; } @@ -572,7 +573,7 @@ wifi_manager_error_e wifi_deactivate(wifi_manager_object *manager, wifi_manager_error_e wifi_is_activated(wifi_manager_object *manager, bool *activated) { WIFI_RET_VAL_IF_FAIL(manager, WIFI_MANAGER_ERROR_INVALID_PARAMETER); - return wifi_manager_is_activated(manager->wifi, activated); + return IS_EMU(wifi_manager_is_activated(manager->wifi, activated)); } wifi_manager_error_e wifi_set_device_state_changed_cb(wifi_manager_object *manager, @@ -589,8 +590,8 @@ wifi_manager_error_e wifi_set_device_state_changed_cb(wifi_manager_object *manag cb_data->type = WIFI_MANAGER_CB_DEVICE_STATE_CHANGED; cb_data->state_changed_cb = callback; cb_data->user_data = user_data; - err = wifi_manager_set_device_state_changed_cb(manager->wifi, - __wifi_device_state_changed_cb, cb_data); + err = IS_EMU(wifi_manager_set_device_state_changed_cb(manager->wifi, + __wifi_device_state_changed_cb, cb_data)); if (err == WIFI_MANAGER_ERROR_NONE) manager->cb_data_list = g_list_append(manager->cb_data_list, cb_data); return err; @@ -601,7 +602,7 @@ wifi_manager_error_e wifi_unset_device_state_changed_cb(wifi_manager_object *man wifi_manager_error_e err = WIFI_MANAGER_ERROR_INVALID_PARAMETER; WIFI_RET_VAL_IF_FAIL(manager, WIFI_MANAGER_ERROR_INVALID_PARAMETER); - err = wifi_manager_unset_device_state_changed_cb(manager->wifi); + err = IS_EMU(wifi_manager_unset_device_state_changed_cb(manager->wifi)); _delete_cb_data_by_type(manager, WIFI_MANAGER_CB_DEVICE_STATE_CHANGED); return err; } @@ -620,7 +621,7 @@ wifi_manager_error_e wifi_set_background_scan_cb(wifi_manager_object *manager, cb_data->type = WIFI_MANAGER_CB_BACKGROUND_SCAN; cb_data->cb = callback; cb_data->user_data = user_data; - err = wifi_manager_set_background_scan_cb(manager->wifi, __wifi_background_scan_cb, cb_data); + err = IS_EMU(wifi_manager_set_background_scan_cb(manager->wifi, __wifi_background_scan_cb, cb_data)); if (err == WIFI_MANAGER_ERROR_NONE) manager->cb_data_list = g_list_append(manager->cb_data_list, cb_data); return err; @@ -631,7 +632,7 @@ wifi_manager_error_e wifi_unset_background_scan_cb(wifi_manager_object *manager) wifi_manager_error_e err = WIFI_MANAGER_ERROR_INVALID_PARAMETER; WIFI_RET_VAL_IF_FAIL(manager, WIFI_MANAGER_ERROR_INVALID_PARAMETER); - err = wifi_manager_unset_background_scan_cb(manager->wifi); + err = IS_EMU(wifi_manager_unset_background_scan_cb(manager->wifi)); _delete_cb_data_by_type(manager, WIFI_MANAGER_CB_BACKGROUND_SCAN); return err; } @@ -650,8 +651,8 @@ wifi_manager_error_e wifi_set_connection_state_changed_cb(wifi_manager_object *m cb_data->type = WIFI_MANAGER_CB_CONNECTION_STATE_CHANGED; cb_data->state_changed_cb = callback; cb_data->user_data = user_data; - err = wifi_manager_set_connection_state_changed_cb(manager->wifi, - __wifi_connection_state_changed_cb, cb_data); + err = IS_EMU(wifi_manager_set_connection_state_changed_cb(manager->wifi, + __wifi_connection_state_changed_cb, cb_data)); if (err == WIFI_MANAGER_ERROR_NONE) manager->cb_data_list = g_list_append(manager->cb_data_list, cb_data); return err; @@ -662,7 +663,7 @@ wifi_manager_error_e wifi_unset_connection_state_changed_cb(wifi_manager_object wifi_manager_error_e err = WIFI_MANAGER_ERROR_INVALID_PARAMETER; WIFI_RET_VAL_IF_FAIL(manager, WIFI_MANAGER_ERROR_INVALID_PARAMETER); - err = wifi_manager_unset_connection_state_changed_cb(manager->wifi); + err = IS_EMU(wifi_manager_unset_connection_state_changed_cb(manager->wifi)); _delete_cb_data_by_type(manager, WIFI_MANAGER_CB_CONNECTION_STATE_CHANGED); return err; } @@ -671,7 +672,7 @@ wifi_manager_error_e wifi_get_connection_state(wifi_manager_object *manager, wifi_manager_connection_state_e *connection_state) { WIFI_RET_VAL_IF_FAIL(manager, WIFI_MANAGER_ERROR_INVALID_PARAMETER); - return wifi_manager_get_connection_state(manager->wifi, connection_state); + return IS_EMU(wifi_manager_get_connection_state(manager->wifi, connection_state)); } wifi_manager_error_e wifi_connect(wifi_manager_object *manager, @@ -754,7 +755,7 @@ wifi_manager_error_e wifi_get_connected_ap(wifi_manager_object *manager, wifi_manager_error_e err = WIFI_MANAGER_ERROR_INVALID_PARAMETER; WIFI_RET_VAL_IF_FAIL(manager, WIFI_MANAGER_ERROR_INVALID_PARAMETER); - err = wifi_manager_get_connected_ap(manager->wifi, &ap_h); + err = IS_EMU(wifi_manager_get_connected_ap(manager->wifi, &ap_h)); if (err != WIFI_MANAGER_ERROR_NONE) { if (ap_h) wifi_ap_destroy(ap_h); @@ -762,7 +763,7 @@ wifi_manager_error_e wifi_get_connected_ap(wifi_manager_object *manager, return err; } *ap = _create_ap_object_by_ap_h(ap_h); - wifi_manager_ap_destroy(ap_h); + IS_EMU(wifi_manager_ap_destroy(ap_h)); if (!(*ap)) return WIFI_MANAGER_ERROR_OUT_OF_MEMORY; @@ -783,7 +784,7 @@ void wifi_ap_destroy(wifi_ap_object *ap_obj) { WIFI_RET_IF_FAIL(ap_obj != NULL); - wifi_manager_ap_destroy(ap_obj->ap); + IS_EMU(wifi_manager_ap_destroy(ap_obj->ap)); g_free(ap_obj); } @@ -813,7 +814,7 @@ void wifi_ap_refresh(wifi_ap_object *ap_obj) { WIFI_RET_IF_FAIL(ap_obj); - wifi_manager_error_e err = wifi_manager_ap_refresh(ap_obj->ap); + wifi_manager_error_e err = IS_EMU(wifi_manager_ap_refresh(ap_obj->ap)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_ap_refresh() is failed. error = %s", wifi_error_to_string(err)); @@ -871,7 +872,7 @@ wifi_manager_error_e wifi_ap_forget(wifi_manager_object *manager, wifi_ap_object wifi_manager_error_e err; WIFI_RET_VAL_IF_FAIL(ap_obj != NULL, WIFI_MANAGER_ERROR_INVALID_PARAMETER); - err = wifi_manager_forget_ap(manager->wifi, ap_obj->ap); + err = IS_EMU(wifi_manager_forget_ap(manager->wifi, ap_obj->ap)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_forget_ap() is failed. error = %s", wifi_error_to_string(err)); @@ -884,7 +885,7 @@ gchar *wifi_ap_get_ssid(wifi_ap_object *ap_obj) gchar *ssid = NULL; WIFI_RET_VAL_IF_FAIL(ap_obj, NULL); - wifi_manager_error_e err = wifi_manager_ap_get_essid(ap_obj->ap, &ssid); + wifi_manager_error_e err = IS_EMU(wifi_manager_ap_get_essid(ap_obj->ap, &ssid)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_essid() is failed. error = %s", wifi_error_to_string(err)); @@ -931,7 +932,7 @@ gint wifi_ap_get_max_speed(wifi_ap_object *ap_obj) gint max_speed = 0; WIFI_RET_VAL_IF_FAIL(ap_obj, 0); - wifi_manager_error_e err = wifi_manager_ap_get_max_speed(ap_obj->ap, &max_speed); + wifi_manager_error_e err = IS_EMU(wifi_manager_ap_get_max_speed(ap_obj->ap, &max_speed)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_max_speed() is failed. error = %s", wifi_error_to_string(err)); @@ -956,7 +957,7 @@ void wifi_ap_set_password(wifi_ap_object *ap_obj, const gchar *password) wifi_manager_error_e err; WIFI_RET_IF_FAIL(ap_obj); - err = wifi_manager_ap_set_passphrase(ap_obj->ap, password); + err = IS_EMU(wifi_manager_ap_set_passphrase(ap_obj->ap, password)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_set_passphrase() is failed. error = %s", wifi_error_to_string(err)); @@ -969,7 +970,7 @@ wifi_manager_eap_type_e wifi_ap_get_eap_type(wifi_ap_object *ap_obj) wifi_manager_error_e err; WIFI_RET_VAL_IF_FAIL(ap_obj, eap_type); - err = wifi_manager_ap_get_eap_type(ap_obj->ap, &eap_type); + err = IS_EMU(wifi_manager_ap_get_eap_type(ap_obj->ap, &eap_type)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_eap_type() is failed. error = %s", wifi_error_to_string(err)); @@ -982,7 +983,7 @@ void wifi_ap_set_eap_type(wifi_ap_object *ap_obj, wifi_manager_eap_type_e type) wifi_manager_error_e err; WIFI_RET_IF_FAIL(ap_obj); - err = wifi_manager_ap_set_eap_type(ap_obj->ap, type); + err = IS_EMU(wifi_manager_ap_set_eap_type(ap_obj->ap, type)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_set_eap_type() is failed. error = %s", wifi_error_to_string(err)); @@ -995,7 +996,7 @@ wifi_manager_security_type_e wifi_ap_get_security_type(wifi_ap_object *ap_obj) wifi_manager_error_e err; WIFI_RET_VAL_IF_FAIL(ap_obj, sec_type); - err = wifi_manager_ap_get_security_type(ap_obj->ap, &sec_type); + err = IS_EMU(wifi_manager_ap_get_security_type(ap_obj->ap, &sec_type)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_security_type() is failed. error = %s", wifi_error_to_string(err)); @@ -1034,7 +1035,7 @@ wifi_manager_connection_state_e wifi_ap_get_connection_state(wifi_ap_object *ap_ wifi_manager_connection_state_e conn_state = WIFI_MANAGER_CONNECTION_STATE_FAILURE; wifi_manager_error_e err; WIFI_RET_VAL_IF_FAIL(ap_obj, WIFI_MANAGER_CONNECTION_STATE_FAILURE); - err = wifi_manager_ap_get_connection_state(ap_obj->ap, &conn_state); + err = IS_EMU(wifi_manager_ap_get_connection_state(ap_obj->ap, &conn_state)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_connection_state() is failed. error = %s", wifi_error_to_string(err)); @@ -1047,8 +1048,8 @@ gchar *wifi_ap_get_ip_address(wifi_ap_object *ap_obj) gchar *ip_address = NULL; WIFI_RET_VAL_IF_FAIL(ap_obj, NULL); - wifi_manager_error_e err = wifi_manager_ap_get_ip_address(ap_obj->ap, - WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &ip_address); + wifi_manager_error_e err = IS_EMU(wifi_manager_ap_get_ip_address(ap_obj->ap, + WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &ip_address)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_ip_address() is failed. error = %s", wifi_error_to_string(err)); @@ -1065,7 +1066,7 @@ void wifi_ap_set_ip_address(wifi_ap_object *ap_obj, const gchar *ip_address) wifi_manager_error_e err; WIFI_RET_IF_FAIL(ap_obj); - err = wifi_manager_ap_set_ip_address(ap_obj->ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, ip_address); + err = IS_EMU(wifi_manager_ap_set_ip_address(ap_obj->ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, ip_address)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_set_ip_address() is failed. error = %s", wifi_error_to_string(err)); @@ -1077,8 +1078,8 @@ gchar *wifi_ap_get_gateway_address(wifi_ap_object *ap_obj) gchar *gateway = NULL; WIFI_RET_VAL_IF_FAIL(ap_obj, NULL); - wifi_manager_error_e err = wifi_manager_ap_get_gateway_address(ap_obj->ap, - WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &gateway); + wifi_manager_error_e err = IS_EMU(wifi_manager_ap_get_gateway_address(ap_obj->ap, + WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &gateway)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_gateway_address() is failed. error = %s", wifi_error_to_string(err)); @@ -1095,7 +1096,7 @@ void wifi_ap_set_gateway_address(wifi_ap_object *ap_obj, const gchar *gateway_ad wifi_manager_error_e err; WIFI_RET_IF_FAIL(ap_obj); - err = wifi_manager_ap_set_gateway_address(ap_obj->ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, gateway_address); + err = IS_EMU(wifi_manager_ap_set_gateway_address(ap_obj->ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, gateway_address)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_set_gateway_address() is failed. error = %s", wifi_error_to_string(err)); @@ -1107,8 +1108,8 @@ gchar *wifi_ap_get_subnet_mask(wifi_ap_object *ap_obj) gchar *subnet_mask = NULL; WIFI_RET_VAL_IF_FAIL(ap_obj, NULL); - wifi_manager_error_e err = wifi_manager_ap_get_subnet_mask(ap_obj->ap, - WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &subnet_mask); + wifi_manager_error_e err = IS_EMU(wifi_manager_ap_get_subnet_mask(ap_obj->ap, + WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &subnet_mask)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_subnet_mask() is failed. error = %s", wifi_error_to_string(err)); @@ -1125,7 +1126,7 @@ void wifi_ap_set_subnet_mask(wifi_ap_object *ap_obj, const gchar *subnet_mask) wifi_manager_error_e err; WIFI_RET_IF_FAIL(ap_obj); - err = wifi_manager_ap_set_subnet_mask(ap_obj->ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, subnet_mask); + err = IS_EMU(wifi_manager_ap_set_subnet_mask(ap_obj->ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, subnet_mask)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_set_subnet_mask() is failed. error = %s", wifi_error_to_string(err)); @@ -1137,8 +1138,8 @@ gchar *wifi_ap_get_dns_address(wifi_ap_object *ap_obj, gint order) gchar *dns_address = NULL; WIFI_RET_VAL_IF_FAIL(ap_obj, NULL); - wifi_manager_error_e err = wifi_manager_ap_get_dns_address(ap_obj->ap, - order, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &dns_address); + wifi_manager_error_e err = IS_EMU(wifi_manager_ap_get_dns_address(ap_obj->ap, + order, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &dns_address)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_dns_address() is failed. error = %s", wifi_error_to_string(err)); @@ -1155,7 +1156,7 @@ void wifi_ap_set_dns_address(wifi_ap_object *ap_obj, const gchar *dns_address, g wifi_manager_error_e err; WIFI_RET_IF_FAIL(ap_obj); - err = wifi_manager_ap_set_dns_address(ap_obj->ap, order, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, dns_address); + err = IS_EMU(wifi_manager_ap_set_dns_address(ap_obj->ap, order, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, dns_address)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_set_dns_address() is failed. error = %s", wifi_error_to_string(err)); @@ -1168,8 +1169,8 @@ wifi_manager_ip_config_type_e wifi_ap_get_ip_config(wifi_ap_object *ap_obj) wifi_manager_error_e err; WIFI_RET_VAL_IF_FAIL(ap_obj, WIFI_MANAGER_IP_CONFIG_TYPE_NONE); - err = wifi_manager_ap_get_ip_config_type(ap_obj->ap, - WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &config_type); + err = IS_EMU(wifi_manager_ap_get_ip_config_type(ap_obj->ap, + WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &config_type)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_ip_config_type() is failed. error = %s", wifi_error_to_string(err)); @@ -1181,8 +1182,8 @@ void wifi_ap_set_ip_config(wifi_ap_object *ap_obj, wifi_manager_ip_config_type_e { wifi_manager_error_e err; WIFI_RET_IF_FAIL(ap_obj); - err = wifi_manager_ap_set_ip_config_type(ap_obj->ap, - WIFI_MANAGER_ADDRESS_FAMILY_IPV4, config_type); + err = IS_EMU(wifi_manager_ap_set_ip_config_type(ap_obj->ap, + WIFI_MANAGER_ADDRESS_FAMILY_IPV4, config_type)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_set_ip_config_type() is failed. error = %s", wifi_error_to_string(err)); @@ -1205,7 +1206,7 @@ wifi_manager_proxy_type_e wifi_ap_get_proxy_type(wifi_ap_object *ap_obj) wifi_manager_error_e err; WIFI_RET_VAL_IF_FAIL(ap_obj, WIFI_MANAGER_PROXY_TYPE_AUTO); - err = wifi_manager_ap_get_proxy_type(ap_obj->ap, &proxy_type); + err = IS_EMU(wifi_manager_ap_get_proxy_type(ap_obj->ap, &proxy_type)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_get_proxy_type() is failed. error = %s", wifi_error_to_string(err)); @@ -1218,7 +1219,7 @@ void wifi_ap_set_proxy_type(wifi_ap_object *ap_obj, wifi_manager_proxy_type_e pr wifi_manager_error_e err; WIFI_RET_IF_FAIL(ap_obj); - err = wifi_manager_ap_set_proxy_type(ap_obj->ap, proxy_type); + err = IS_EMU(wifi_manager_ap_set_proxy_type(ap_obj->ap, proxy_type)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_set_proxy_type() is failed. error = %s", wifi_error_to_string(err)); @@ -1271,7 +1272,7 @@ void wifi_ap_set_proxy_address(wifi_ap_object *ap_obj, const gchar *proxy_addres wifi_manager_error_e err; WIFI_RET_IF_FAIL(ap_obj); - err = wifi_manager_ap_set_proxy_address(ap_obj->ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, proxy_address); + err = IS_EMU(wifi_manager_ap_set_proxy_address(ap_obj->ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, proxy_address)); if (err != WIFI_MANAGER_ERROR_NONE) { WIFI_LOG_ERR("wifi_manager_ap_set_proxy_address() is failed. error = %s", wifi_error_to_string(err)); @@ -1280,9 +1281,8 @@ void wifi_ap_set_proxy_address(wifi_ap_object *ap_obj, const gchar *proxy_addres bool wifi_ap_is_wps_mode(wifi_ap_object *ap_obj) { -#ifdef TIZEN_EMULATOR - return true; -#endif + if (_is_emulator()) + return true; return ap_obj->wps_mode; } @@ -1292,7 +1292,7 @@ bool wifi_ap_is_favorite(wifi_manager_object *manager, wifi_ap_object *ap_obj) wifi_manager_error_e err; WIFI_RET_VAL_IF_FAIL(ap_obj != NULL, false); - err = wifi_manager_ap_is_favorite(ap_obj->ap, &is_favorite); + err = IS_EMU(wifi_manager_ap_is_favorite(ap_obj->ap, &is_favorite)); if (err != WIFI_MANAGER_ERROR_NONE) WIFI_LOG_ERR("wifi_ap_is_favorite() is failed. error = %d", err); diff --git a/sources/wearable/src/util/device.c b/sources/wearable/src/util/device.c new file mode 100644 index 0000000..b8d78ac --- /dev/null +++ b/sources/wearable/src/util/device.c @@ -0,0 +1,113 @@ +#include <efl_extension.h> +#include <libxml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/tree.h> + +#include "util/device.h" + +#define MODEL_CONFIG_FILE "/etc/config/model-config.xml" +#define TYPE_FIELD "string" +#define FEATURE_TAG "platform" +#define MODEL_CONFIG_TAG "model-config" + +typedef enum { + TIZEN_MODEL_UNKNOWN = 0, + TIZEN_MODEL_EMULATOR = 0x1, + TIZEN_MODEL_NOT_EMULATOR = 0x2, +} tizen_model_t; + +static tizen_model_t emulator = TIZEN_MODEL_UNKNOWN; + +static inline int __get_model_from_model_config_xml(const char *field, char **value) +{ + char *node_name = NULL; + char *node_value = NULL; + xmlNode *cur_node = NULL; + xmlNodePtr cur_ptr = NULL; + xmlNodePtr model_ptr = NULL; + xmlDocPtr xml_doc = NULL; + + xml_doc = xmlParseFile(MODEL_CONFIG_FILE); + if (xml_doc == NULL) + return -1; + + cur_ptr = xmlDocGetRootElement(xml_doc); + if (cur_ptr == NULL) { + xmlFreeDoc(xml_doc); + return -1; + } + + for (cur_node = cur_ptr; cur_node; cur_node = cur_node->next) { + if (!xmlStrcmp(cur_ptr->name, (const xmlChar*)MODEL_CONFIG_TAG)) + break; + } + + if (cur_ptr == NULL) { + xmlFreeDoc(xml_doc); + return -1; + } + + cur_ptr = cur_ptr->xmlChildrenNode; + for (cur_node = cur_ptr; cur_node; cur_node = cur_node->next) { + if (!xmlStrcmp(cur_node->name, (const xmlChar*)FEATURE_TAG)) { + model_ptr = cur_node; + break; + } + } + + if (model_ptr == NULL) { + xmlFreeDoc(xml_doc); + return -1; + } + + if (model_ptr) { + cur_ptr = model_ptr->xmlChildrenNode; + + for (cur_node = cur_ptr; cur_node; cur_node = cur_node->next) { + if (cur_node->type == XML_ELEMENT_NODE) { + node_name = (char *)xmlGetProp(cur_node, (const xmlChar*)"name"); + + if (!strncmp(node_name, field, strlen(node_name))) { + node_value = (char *)xmlNodeListGetString(xml_doc, cur_node->xmlChildrenNode, 1); + if (node_value) { + *value = strdup(node_value); + free(node_name); + free(node_value); + break; + } + } + free(node_name); + } + } + } + + xmlFreeDoc(xml_doc); + return 0; +} + +Eina_Bool _is_emulator(void) +{ + char *model_name = NULL; + + if (emulator == TIZEN_MODEL_EMULATOR) + return EINA_TRUE; + else if (emulator == TIZEN_MODEL_NOT_EMULATOR) + return EINA_FALSE; + + if (__get_model_from_model_config_xml("tizen.org/system/model_name", &model_name) < 0) + return EINA_FALSE; + + if (model_name == NULL) + return EINA_FALSE; + + if (strncmp(model_name, "Emulator", strlen("Emulator")) == 0) { + free(model_name); + emulator = TIZEN_MODEL_EMULATOR; + return EINA_TRUE; + } else { + free(model_name); + emulator = TIZEN_MODEL_NOT_EMULATOR; + return EINA_FALSE; + } +} + diff --git a/sources/wearable/src/wearable-circle/app_main.c b/sources/wearable/src/wearable-circle/app_main.c index cb4b3bd..4325767 100644 --- a/sources/wearable/src/wearable-circle/app_main.c +++ b/sources/wearable/src/wearable-circle/app_main.c @@ -26,6 +26,7 @@ #include <gio/gio.h> #include "util.h" +#include "util/device.h" #include "view.h" #include "view/util/efl_helper.h" #include "net/wifi_manager.h" @@ -296,18 +297,17 @@ static void __wifi_manager_scan_finished_cb(wifi_manager_object *manager, app_object *app_obj = user_data; __WIFI_FUNC_ENTER__; -#ifndef TIZEN_EMULATOR - WIFI_RET_IF_FAIL(manager != NULL); -#endif + if (!_is_emulator()) + WIFI_RET_IF_FAIL(manager != NULL); WIFI_RET_IF_FAIL(app_obj != NULL); if (app_obj->is_first_scan) { -#ifdef TIZEN_EMULATOR + if (_is_emulator()) app_obj->scan = _scan_create(app_obj->base, app_obj); -#else - if (!app_obj->scan) - app_obj->scan = _scan_create(app_obj->base, app_obj); -#endif + else { + if (!app_obj->scan) + app_obj->scan = _scan_create(app_obj->base, app_obj); + } if (idler_util_managed_idle_add(_wifi_manager_scan_start_for_idle, app_obj) > 0) { return; @@ -392,17 +392,17 @@ static void __wifi_manager_device_state_changed_cb(wifi_manager_object *manager, WIFI_RET_IF_FAIL(app_obj != NULL); if (is_wifi_device_activated) { -#ifndef TIZEN_EMULATOR - if (app_obj->is_scanning_for_wifi_activate && !app_obj->popup_scanning) { - WIFI_LOG_ERR("Scanning popup(for Wi-Fi activate) closed by user."); - wifi_manager_error_e err = wifi_scan(app_obj->wifi_manager, NULL, NULL); - if (err != WIFI_MANAGER_ERROR_NONE) { - WIFI_LOG_ERR("Wi-Fi Scan failed. error code = %s", - wifi_error_to_string(err)); + if (!_is_emulator()) { + if (app_obj->is_scanning_for_wifi_activate && !app_obj->popup_scanning) { + WIFI_LOG_ERR("Scanning popup(for Wi-Fi activate) closed by user."); + wifi_manager_error_e err = wifi_scan(app_obj->wifi_manager, NULL, NULL); + if (err != WIFI_MANAGER_ERROR_NONE) { + WIFI_LOG_ERR("Wi-Fi Scan failed. error code = %s", + wifi_error_to_string(err)); + } + return; } - return; } -#endif if (_wifi_manager_scan_start_for_wifi_activated(app_obj)) _popup_scanning_show(app_obj, FALSE); } else { @@ -3716,9 +3716,8 @@ static void __scan_button_tap_cb(void *data, Evas_Object *obj, void *event_info) } if (_wifi_manager_scan_start_by_scan_button(app_obj)) { -#ifndef TIZEN_EMULATOR - _popup_scanning_show(app_obj, FALSE); -#endif + if (!_is_emulator()) + _popup_scanning_show(app_obj, FALSE); } } diff --git a/sources/wearable/src/wearable-circle/view/layout_scan.c b/sources/wearable/src/wearable-circle/view/layout_scan.c index 389b0c8..f22a463 100755 --- a/sources/wearable/src/wearable-circle/view/layout_scan.c +++ b/sources/wearable/src/wearable-circle/view/layout_scan.c @@ -24,6 +24,7 @@ #include <glib.h> #include "util.h" +#include "util/device.h" #include "view/util/efl_helper.h" #include "view/base.h" #include "view/layout_scan.h" @@ -217,17 +218,19 @@ static inline Elm_Genlist_Item_Class *_create_wifi_ap_itc(layout_scan_object *se static void _ap_list_append_ap_item(layout_scan_object *self, Elm_Genlist_Item_Class *itc, gpointer data) { -#ifndef TIZEN_EMULATOR - Elm_Object_Item *item = elm_genlist_item_append(self->ap_list, itc, - data, NULL, ELM_GENLIST_ITEM_NONE, - self->menu_cb[SCAN_MENU_WIFI_AP_ITEM].tap, - self->menu_cb[SCAN_MENU_WIFI_AP_ITEM].data); -#else - Elm_Object_Item *item = elm_genlist_item_append(self->ap_list, itc, - data, NULL, - ELM_GENLIST_ITEM_NONE, - NULL, NULL); -#endif + Elm_Object_Item *item; + if (!_is_emulator()) { + item = elm_genlist_item_append(self->ap_list, itc, + data, NULL, ELM_GENLIST_ITEM_NONE, + self->menu_cb[SCAN_MENU_WIFI_AP_ITEM].tap, + self->menu_cb[SCAN_MENU_WIFI_AP_ITEM].data); + } else { + item = elm_genlist_item_append(self->ap_list, itc, + data, NULL, + ELM_GENLIST_ITEM_NONE, + NULL, NULL); + } + Evas_Object *obj = elm_object_item_widget_get(item); if (obj) { evas_object_data_set(obj, LAYOUT_SCAN_DATA_KEY_WIFI_AP_ITEM_SELECT, |