summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
Diffstat (limited to 'sources')
-rw-r--r--sources/libraries/Common/common_datamodel.c749
-rw-r--r--sources/libraries/Common/common_eap_connect.c1493
-rw-r--r--sources/libraries/Common/common_invalid_password.c149
-rw-r--r--sources/libraries/Common/common_ip_info.c851
-rw-r--r--sources/libraries/Common/common_pswd_popup.c365
-rw-r--r--sources/libraries/Common/common_utils.c458
-rw-r--r--sources/libraries/Common/include/common.h94
-rw-r--r--sources/libraries/Common/include/common_datamodel.h102
-rw-r--r--sources/libraries/Common/include/common_eap_connect.h50
-rw-r--r--sources/libraries/Common/include/common_invalid_password.h39
-rw-r--r--sources/libraries/Common/include/common_ip_info.h46
-rw-r--r--sources/libraries/Common/include/common_pswd_popup.h53
-rw-r--r--sources/libraries/Common/include/common_utils.h110
-rw-r--r--sources/libraries/WlanManager/EngineManager/connman-profile-manager.c211
-rw-r--r--sources/libraries/WlanManager/EngineManager/connman-request.c72
-rw-r--r--sources/libraries/WlanManager/EngineManager/connman-response.c92
-rw-r--r--sources/libraries/WlanManager/EngineManager/include/connman-profile-manager.h38
-rw-r--r--sources/libraries/WlanManager/EngineManager/include/connman-request.h39
-rw-r--r--sources/libraries/WlanManager/EngineManager/include/connman-response.h46
-rw-r--r--sources/libraries/WlanManager/wlan-manager/include/wlan_manager.h254
-rw-r--r--sources/libraries/WlanManager/wlan-manager/wlan_manager.c820
-rw-r--r--sources/libraries/appcoreWrapper/appcoreWrapper.c69
-rw-r--r--sources/libraries/appcoreWrapper/include/appcoreWrapper.h38
-rw-r--r--sources/libraries/i18nManager/i18nmanager.c227
-rw-r--r--sources/libraries/i18nManager/include/i18nmanager.h130
-rw-r--r--sources/libraries/settingWrapper/include/wifi-setting.h34
-rw-r--r--sources/libraries/settingWrapper/wifi-setting.c75
-rw-r--r--sources/ui-gadget/CMakeLists.txt56
-rw-r--r--sources/ui-gadget/edcs/custom_editfield.edc442
-rw-r--r--sources/ui-gadget/edcs/wifi_ug_edj_etc.edc33
-rw-r--r--sources/ui-gadget/include/motion_control.h44
-rw-r--r--sources/ui-gadget/include/ug_wifi.h89
-rw-r--r--sources/ui-gadget/include/viewer_list.h74
-rw-r--r--sources/ui-gadget/include/viewer_manager.h85
-rw-r--r--sources/ui-gadget/include/wifi-engine-callback.h35
-rw-r--r--sources/ui-gadget/include/wifi-ui-list-callbacks.h38
-rw-r--r--sources/ui-gadget/include/wifi.h88
-rw-r--r--sources/ui-gadget/include/winset_popup.h54
-rw-r--r--sources/ui-gadget/motion_control.c103
-rw-r--r--sources/ui-gadget/viewers-layout/include/view_detail.h50
-rw-r--r--sources/ui-gadget/viewers-layout/include/view_ime_hidden.h39
-rw-r--r--sources/ui-gadget/viewers-layout/view_detail.c339
-rw-r--r--sources/ui-gadget/viewers-layout/view_ime_hidden.c201
-rw-r--r--sources/ui-gadget/viewers-layout/viewer_manager.c1267
-rw-r--r--sources/ui-gadget/viewers-layout/wifi_viewer_list.c840
-rw-r--r--sources/ui-gadget/wifi-efl-UG.c431
-rw-r--r--sources/ui-gadget/wifi-ui-list-callbacks.c312
-rw-r--r--sources/ui-gadget/wifi-wlan-callbacks.c199
-rw-r--r--sources/ui-gadget/winset_popup.c346
-rw-r--r--sources/wifi-syspopup/CMakeLists.txt56
-rw-r--r--sources/wifi-syspopup/include/wifi-syspopup-engine-callback.h37
-rw-r--r--sources/wifi-syspopup/include/wifi-syspopup.h98
-rw-r--r--sources/wifi-syspopup/net.wifi-qs.xml9
-rw-r--r--sources/wifi-syspopup/viewer-popups/include/view-alerts.h36
-rw-r--r--sources/wifi-syspopup/viewer-popups/include/view-main.h44
-rw-r--r--sources/wifi-syspopup/viewer-popups/view-alerts.c112
-rw-r--r--sources/wifi-syspopup/viewer-popups/view-main.c520
-rw-r--r--sources/wifi-syspopup/wifi-qs.ini2
-rw-r--r--sources/wifi-syspopup/wifi-syspopup-engine-callback.c157
-rw-r--r--sources/wifi-syspopup/wifi-syspopup.c641
60 files changed, 13581 insertions, 0 deletions
diff --git a/sources/libraries/Common/common_datamodel.c b/sources/libraries/Common/common_datamodel.c
new file mode 100644
index 0000000..5432a0b
--- /dev/null
+++ b/sources/libraries/Common/common_datamodel.c
@@ -0,0 +1,749 @@
+/*
+* Wi-Fi UG
+*
+* Copyright 2012 Samsung Electronics Co., Ltd
+
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+
+* http://www.tizenopensource.org/license
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+
+
+#include "common.h"
+#include "common_datamodel.h"
+
+
+struct view_datamodel_basic_info {
+ char *profile_name; /* Profile name */
+ char *ap_name; /* AP name */
+ wlan_security_mode_type_t security_mode; /* Security mode */
+ unsigned int signal_strength; /* Signal strength */
+ unsigned int channel_freq; /* channel frequency */
+ boolean is_favourite; /* Favourite */
+ char wps_support;
+};
+
+struct view_datamodel_ip_info {
+ char *profile_name; /* Profile name */
+ net_ip_config_type_t ip_and_dns_type;
+ char* proxy_addr;
+ char* ip;
+ char* subnet;
+ char* gateway;
+ char* dns1;
+ char* dns2;
+
+ char* MAC_address; /* MAC address */
+};
+
+struct view_datamodel_eap_info {
+ char *profile_name; /* Profile name */
+ char *ap_name; /* AP name */
+ wlan_eap_type_t eap_method; /* EAP method */
+ int eap_provision; /* Provisioning */
+ wlan_eap_auth_type_t auth_type; /* EAP phase 2 Authentication */
+ char *user_id; /* User id */
+ char *anonymous_id; /* Anonymous id */
+ char *ca_cert; /* CA certificate */
+ char *user_cert; /* User certificate */
+ char *pswd;
+};
+
+static void view_detail_datamodel_init_default_profile(net_profile_info_t *profile_info)
+{
+ if (profile_info) {
+ wlan_eap_info_t *eap_sec_info = &(profile_info->ProfileInfo.Wlan.security_info.authentication.eap);
+ eap_sec_info->eap_type = WLAN_SEC_EAP_TYPE_PEAP;
+ eap_sec_info->eap_auth = WLAN_SEC_EAP_AUTH_NONE;
+ }
+ return;
+}
+
+view_datamodel_basic_info_t *view_basic_detail_datamodel_create(const char *profile_name)
+{
+ __COMMON_FUNC_ENTER__;
+ view_datamodel_basic_info_t *data_object = NULL;
+ net_profile_info_t *profile_info = g_malloc0(sizeof(net_profile_info_t));
+ assertm_if(NULL == profile_name, "NULL!!");
+ view_detail_datamodel_init_default_profile(profile_info);
+ if (!connman_profile_manager_profile_info_get(profile_name, profile_info)) {
+ ERROR_LOG(UG_NAME_ERR, "Fatal Could not get the profile info!!!");
+ g_free(profile_info);
+ return NULL;
+ }
+
+ data_object = g_malloc0(sizeof(view_datamodel_basic_info_t));
+ assertm_if(NULL == data_object, "NULL!!");
+
+ data_object->profile_name = g_strdup(profile_name);
+ data_object->channel_freq = profile_info->ProfileInfo.Wlan.frequency;
+ data_object->ap_name = g_strdup(profile_info->ProfileInfo.Wlan.essid);
+ data_object->signal_strength = profile_info->ProfileInfo.Wlan.Strength;
+ data_object->security_mode = profile_info->ProfileInfo.Wlan.security_info.sec_mode;
+ data_object->is_favourite = profile_info->Favourite;
+ data_object->wps_support = profile_info->ProfileInfo.Wlan.security_info.wps_support;
+
+ INFO_LOG(UG_NAME_NORMAL, "Profile name : %s", data_object->profile_name);
+ INFO_LOG(UG_NAME_NORMAL, "ap name : %s", data_object->ap_name);
+ INFO_LOG(UG_NAME_NORMAL, "Signal strength : %u", data_object->signal_strength);
+ INFO_LOG(UG_NAME_NORMAL, "Security mode : %u", data_object->security_mode);
+ INFO_LOG(UG_NAME_NORMAL, "Channel Freq : %u", data_object->channel_freq);
+ INFO_LOG(UG_NAME_NORMAL, "WPS Support : %d", data_object->wps_support);
+
+ g_free(profile_info);
+ profile_info = NULL;
+
+ __COMMON_FUNC_EXIT__;
+
+ return data_object;
+}
+
+view_datamodel_ip_info_t *view_detail_datamodel_ip_info_create(const char *profile_name)
+{
+ __COMMON_FUNC_ENTER__;
+ view_datamodel_ip_info_t *data_object = NULL;
+ net_profile_info_t *profile_info = g_malloc0(sizeof(net_profile_info_t));
+ assertm_if(NULL == profile_name, "NULL!!");
+ view_detail_datamodel_init_default_profile(profile_info);
+ if (!connman_profile_manager_profile_info_get(profile_name, profile_info)) {
+ ERROR_LOG(UG_NAME_ERR, "Fatal Could not get the profile info!!!");
+ /* Lets continue and create a default data object */
+ }
+
+ data_object = g_malloc0(sizeof(view_datamodel_ip_info_t));
+ assertm_if(NULL == data_object, "NULL!!");
+
+ data_object->profile_name = g_strdup(profile_name);
+ data_object->ip_and_dns_type = profile_info->ProfileInfo.Wlan.net_info.IpConfigType;
+ if (strlen(profile_info->ProfileInfo.Wlan.net_info.ProxyAddr) <= 0) {
+ data_object->proxy_addr = NULL;
+ } else {
+ data_object->proxy_addr = g_strdup(profile_info->ProfileInfo.Wlan.net_info.ProxyAddr);
+ }
+
+ data_object->ip = g_strdup(inet_ntoa(profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4));
+ data_object->subnet = g_strdup(inet_ntoa(profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4));
+ data_object->gateway = g_strdup(inet_ntoa(profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4));
+ data_object->dns1 = g_strdup(inet_ntoa(profile_info->ProfileInfo.Wlan.net_info.DnsAddr[0].Data.Ipv4));
+ data_object->dns2 = g_strdup(inet_ntoa(profile_info->ProfileInfo.Wlan.net_info.DnsAddr[1].Data.Ipv4));
+ data_object->MAC_address = g_strdup(profile_info->ProfileInfo.Wlan.bssid);
+
+ INFO_LOG(UG_NAME_NORMAL, "Profile name : %s", data_object->profile_name);
+ INFO_LOG(UG_NAME_NORMAL, "ip_and_dns_type : %d", data_object->ip_and_dns_type);
+ INFO_LOG(UG_NAME_NORMAL, "ip : %s", data_object->ip);
+ INFO_LOG(UG_NAME_NORMAL, "subnet : %s", data_object->subnet);
+ INFO_LOG(UG_NAME_NORMAL, "gateway : %s", data_object->gateway);
+ INFO_LOG(UG_NAME_NORMAL, "dns1 : %s", data_object->dns1);
+ INFO_LOG(UG_NAME_NORMAL, "dns2 : %s", data_object->dns2);
+ if (data_object->proxy_addr)
+ INFO_LOG(UG_NAME_NORMAL, "proxy addr : %s", data_object->proxy_addr);
+ INFO_LOG(UG_NAME_NORMAL, "MAC addr : %s", data_object->MAC_address);
+
+ g_free(profile_info);
+ profile_info = NULL;
+
+ __COMMON_FUNC_EXIT__;
+
+ return data_object;
+}
+
+view_datamodel_eap_info_t *view_detail_datamodel_eap_info_create(const char *profile_name)
+{
+ __COMMON_FUNC_ENTER__;
+ view_datamodel_eap_info_t *data_object = NULL;
+ net_profile_info_t *profile_info = g_malloc0(sizeof(net_profile_info_t));
+ assertm_if(NULL == profile_name, "NULL!!");
+ view_detail_datamodel_init_default_profile(profile_info);
+ if (!connman_profile_manager_profile_info_get(profile_name, profile_info)) {
+ ERROR_LOG(UG_NAME_ERR, "Fatal Could not get the profile info!!!");
+ /* Lets continue and create a default data object */
+ }
+
+ /* The EAP info data object would be created only if the device is remembered / connected */
+ data_object = g_malloc0(sizeof(view_datamodel_eap_info_t));
+ assertm_if(NULL == data_object, "NULL!!");
+
+ data_object->profile_name = g_strdup(profile_name);
+ data_object->ap_name = g_strdup(profile_info->ProfileInfo.Wlan.essid);
+
+ /* If the device is connected / remembered only then create and fill the eap_details structure */
+ wlan_eap_info_t *eap_sec_info = &(profile_info->ProfileInfo.Wlan.security_info.authentication.eap);
+ data_object->eap_method = eap_sec_info->eap_type;
+ data_object->eap_provision = 0; /* This is not yet supported by libnet. So setting it to 0. */
+ data_object->auth_type = eap_sec_info->eap_auth;
+
+ if (strlen(eap_sec_info->username))
+ data_object->user_id = g_strdup(eap_sec_info->username);
+
+ data_object->anonymous_id = NULL; /* This is not yet supported by libnet. So setting it to NULL. */
+
+ if (strlen(eap_sec_info->password))
+ data_object->pswd = g_strdup(eap_sec_info->password);
+
+ if (strlen(eap_sec_info->ca_cert_filename))
+ data_object->ca_cert = g_strdup(eap_sec_info->ca_cert_filename);
+
+ if (strlen(eap_sec_info->client_cert_filename))
+ data_object->user_cert = g_strdup(eap_sec_info->client_cert_filename);
+
+ INFO_LOG(UG_NAME_NORMAL, "Profile name : %s", data_object->profile_name);
+ INFO_LOG(UG_NAME_NORMAL, "EAP method : %u", data_object->eap_method);
+ INFO_LOG(UG_NAME_NORMAL, "Provisioning : %u", data_object->eap_provision);
+ INFO_LOG(UG_NAME_NORMAL, "Auth type : %u", data_object->auth_type);
+ INFO_LOG(UG_NAME_NORMAL, "Id : %s", data_object->user_id);
+ INFO_LOG(UG_NAME_NORMAL, "Anonymous id : %s", data_object->anonymous_id);
+ INFO_LOG(UG_NAME_NORMAL, "Password : %s", data_object->pswd );
+ INFO_LOG(UG_NAME_NORMAL, "CA certificate : %s", data_object->ca_cert);
+ INFO_LOG(UG_NAME_NORMAL, "User certificate : %s", data_object->user_cert);
+
+ g_free(profile_info);
+ profile_info = NULL;
+
+ __COMMON_FUNC_EXIT__;
+
+ return data_object;
+}
+
+void view_basic_detail_datamodel_destroy(view_datamodel_basic_info_t *data_object)
+{
+ __COMMON_FUNC_ENTER__;
+
+ assertm_if(NULL == data_object, "NULL!!");
+
+ g_free(data_object->profile_name);
+ g_free(data_object->ap_name);
+ g_free(data_object);
+ data_object = NULL;
+
+ __COMMON_FUNC_EXIT__;
+
+ return;
+}
+
+void view_detail_datamodel_ip_info_destroy(view_datamodel_ip_info_t *data_object)
+{
+ __COMMON_FUNC_ENTER__;
+
+ assertm_if(NULL == data_object, "NULL!!");
+
+ g_free(data_object->profile_name);
+ g_free(data_object->proxy_addr);
+ g_free(data_object->ip);
+ g_free(data_object->subnet);
+ g_free(data_object->gateway);
+ g_free(data_object->dns1);
+ g_free(data_object->dns2);
+ g_free(data_object->MAC_address);
+ g_free(data_object);
+ data_object = NULL;
+
+ __COMMON_FUNC_EXIT__;
+
+ return;
+}
+
+void view_detail_datamodel_eap_info_destroy(view_datamodel_eap_info_t *data_object)
+{
+ __COMMON_FUNC_ENTER__;
+
+ assertm_if(NULL == data_object, "NULL!!");
+
+ g_free(data_object->profile_name);
+ g_free(data_object->ap_name);
+ g_free(data_object->user_id);
+ g_free(data_object->anonymous_id);
+ g_free(data_object->pswd);
+ g_free(data_object->ca_cert);
+ g_free(data_object->user_cert);
+ g_free(data_object);
+ data_object = NULL;
+
+ __COMMON_FUNC_EXIT__;
+
+ return;
+}
+
+boolean view_detail_datamodel_save_ip_info_if_modified(const view_datamodel_ip_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+
+ boolean changed = FALSE;
+ net_profile_info_t *profile_info = g_malloc0(sizeof(net_profile_info_t));
+ assertm_if(NULL == profile_info, "NULL!!");
+ view_detail_datamodel_init_default_profile(profile_info);
+ if (!connman_profile_manager_profile_info_get(data_object->profile_name, profile_info)) {
+ ERROR_LOG(UG_NAME_ERR, "Fatal Could not get the profile info!!!");
+ g_free(profile_info);
+ return FALSE;
+ }
+
+ if (data_object->ip_and_dns_type != profile_info->ProfileInfo.Wlan.net_info.IpConfigType) {
+ profile_info->ProfileInfo.Wlan.net_info.IpConfigType = data_object->ip_and_dns_type;
+ changed = TRUE;
+ }
+
+ if (data_object->proxy_addr == NULL) {
+ if (profile_info->ProfileInfo.Wlan.net_info.ProxyMethod != NET_PROXY_TYPE_DIRECT) {
+ profile_info->ProfileInfo.Wlan.net_info.ProxyMethod = NET_PROXY_TYPE_DIRECT;
+ changed = TRUE;
+ }
+ } else if (g_strcmp0(data_object->proxy_addr, profile_info->ProfileInfo.Wlan.net_info.ProxyAddr) != 0) {
+ profile_info->ProfileInfo.Wlan.net_info.ProxyMethod = NET_PROXY_TYPE_MANUAL;
+ g_strlcpy(profile_info->ProfileInfo.Wlan.net_info.ProxyAddr, data_object->proxy_addr, WLAN_PROXY_LEN_MAX);
+ changed = TRUE;
+ }
+
+ if (data_object->ip_and_dns_type == NET_IP_CONFIG_TYPE_STATIC) {
+ char *temp_str = NULL;
+
+ temp_str = inet_ntoa(profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4);
+ if (g_strcmp0(data_object->ip, temp_str) != 0) {
+ INFO_LOG(UG_NAME_NORMAL, "IP : %s", temp_str);
+
+ if (inet_aton(data_object->ip, &(profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4)) == 0) {
+ INFO_LOG(UG_NAME_NORMAL, "Failed inet_aton");
+
+ return FALSE;
+ }
+
+ changed = TRUE;
+ }
+
+ temp_str = inet_ntoa(profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4);
+ if (g_strcmp0(data_object->subnet, temp_str) != 0) {
+ INFO_LOG(UG_NAME_NORMAL, "Subnet : %s", temp_str);
+
+ if (inet_aton(data_object->subnet, &(profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4)) == 0) {
+ INFO_LOG(UG_NAME_NORMAL, "Failed inet_aton");
+
+ return FALSE;
+ }
+
+ changed = TRUE;
+ }
+
+ temp_str = inet_ntoa(profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4);
+ if (g_strcmp0(data_object->gateway, temp_str) != 0) {
+ INFO_LOG(UG_NAME_NORMAL, "Gateway : %s", temp_str);
+
+ if (inet_aton(data_object->gateway, &(profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4)) == 0) {
+ INFO_LOG(UG_NAME_NORMAL, "Failed inet_aton");
+
+ return FALSE;
+ }
+
+ changed = TRUE;
+ }
+
+ temp_str = inet_ntoa(profile_info->ProfileInfo.Wlan.net_info.DnsAddr[0].Data.Ipv4);
+ if (g_strcmp0(data_object->dns1, temp_str) != 0) {
+ INFO_LOG(UG_NAME_NORMAL, "DNS1 : %s", temp_str);
+
+ if (inet_aton(data_object->dns1, &(profile_info->ProfileInfo.Wlan.net_info.DnsAddr[0].Data.Ipv4)) == 0) {
+ INFO_LOG(UG_NAME_NORMAL, "Failed inet_aton");
+
+ return FALSE;
+ }
+
+ profile_info->ProfileInfo.Wlan.net_info.DnsCount = 1;
+ changed = TRUE;
+ }
+
+ temp_str = inet_ntoa(profile_info->ProfileInfo.Wlan.net_info.DnsAddr[1].Data.Ipv4);
+ if (g_strcmp0(data_object->dns2, temp_str) != 0) {
+ INFO_LOG(UG_NAME_NORMAL, "DNS2 : %s", temp_str);
+
+ if (inet_aton(data_object->dns2, &(profile_info->ProfileInfo.Wlan.net_info.DnsAddr[1].Data.Ipv4)) == 0) {
+ INFO_LOG(UG_NAME_NORMAL, "Failed inet_aton");
+
+ return FALSE;
+ }
+
+ profile_info->ProfileInfo.Wlan.net_info.DnsCount = 2;
+ changed = TRUE;
+ }
+
+ INFO_LOG(UG_NAME_NORMAL, "DNS count : %d", profile_info->ProfileInfo.Wlan.net_info.DnsCount);
+ }
+
+ if (changed == TRUE)
+ wlan_manager_profile_modify_by_device_info(profile_info);
+
+ g_free(profile_info);
+
+ return changed;
+}
+
+boolean view_detail_datamodel_save_eap_info_if_modified(const view_datamodel_eap_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+
+ boolean changed = FALSE;
+ net_profile_info_t *profile_info = g_malloc0(sizeof(net_profile_info_t));
+ assertm_if(NULL == profile_info, "NULL!!");
+ view_detail_datamodel_init_default_profile(profile_info);
+ if (!connman_profile_manager_profile_info_get(data_object->profile_name, profile_info)) {
+ ERROR_LOG(UG_NAME_ERR, "Fatal Could not get the profile info!!!");
+ g_free(profile_info);
+ return FALSE;
+ }
+
+ wlan_eap_info_t *eap_sec_info = &(profile_info->ProfileInfo.Wlan.security_info.authentication.eap);
+ if (data_object->eap_method != eap_sec_info->eap_type) {
+ eap_sec_info->eap_type = data_object->eap_method;
+ changed = TRUE;
+ }
+
+ if (data_object->auth_type != eap_sec_info->eap_auth) {
+ eap_sec_info->eap_auth = data_object->auth_type;
+ changed = TRUE;
+ }
+
+ if (g_strcmp0(data_object->user_id, eap_sec_info->username)) {
+ g_strlcpy(eap_sec_info->username, data_object->user_id, NETPM_WLAN_USERNAME_LEN);
+ changed = TRUE;
+ }
+
+ if (g_strcmp0(data_object->pswd, eap_sec_info->password)) {
+ g_strlcpy(eap_sec_info->password, data_object->pswd, NETPM_WLAN_PASSWORD_LEN);
+ changed = TRUE;
+ }
+
+ if (changed) {
+ INFO_LOG(UG_NAME_NORMAL, "EAP type : %d", eap_sec_info->eap_type);
+ INFO_LOG(UG_NAME_NORMAL, "EAP auth : %d", eap_sec_info->eap_auth);
+ INFO_LOG(UG_NAME_NORMAL, "User name : %s", eap_sec_info->username);
+ INFO_LOG(UG_NAME_NORMAL, "Password : %s", eap_sec_info->password);
+
+ wlan_manager_profile_modify_by_device_info(profile_info);
+ }
+
+ g_free(profile_info);
+
+ return changed;
+}
+
+int view_detail_datamodel_ip_and_dns_type_set(view_datamodel_ip_info_t *data_object, const IP_TYPES type)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ data_object->ip_and_dns_type = type;
+ return TRUE;
+}
+
+int view_detail_datamodel_proxy_address_set(view_datamodel_ip_info_t *data_object, const char* proxy)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+
+ g_free(data_object->proxy_addr);
+ if(proxy)
+ data_object->proxy_addr = g_strdup(proxy);
+ else
+ data_object->proxy_addr = NULL;
+
+ return TRUE;
+}
+
+int view_detail_datamodel_static_ip_address_set(view_datamodel_ip_info_t *data_object, const char* addr)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ if(NULL != addr) {
+ DEBUG_LOG(UG_NAME_NORMAL, "* set as [%s]", addr);
+ g_free(data_object->ip);
+ data_object->ip = g_strdup(addr);
+ }
+ return TRUE;
+}
+
+int view_detail_datamodel_static_gateway_address_set(view_datamodel_ip_info_t *data_object, const char* addr)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ if(NULL != addr) {
+ g_free(data_object->gateway);
+ data_object->gateway = g_strdup(addr);
+ }
+ return TRUE;
+}
+
+int view_detail_datamodel_static_subnet_mask_set(view_datamodel_ip_info_t *data_object, const char* addr)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ if(NULL != addr) {
+ g_free(data_object->subnet);
+ data_object->subnet = g_strdup(addr);
+ }
+ return TRUE;
+}
+
+int view_detail_datamodel_static_dns1_address_set(view_datamodel_ip_info_t *data_object, const char* addr)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ if(NULL != addr) {
+ g_free(data_object->dns1);
+ data_object->dns1 = g_strdup(addr);
+ }
+ return TRUE;
+}
+
+int view_detail_datamodel_static_dns2_address_set(view_datamodel_ip_info_t *data_object, const char* addr)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ if (NULL != addr) {
+ g_free(data_object->dns2);
+ data_object->dns2 = g_strdup(addr);
+ }
+ return TRUE;
+}
+
+int view_detail_datamodel_eap_ap_name_set(view_datamodel_eap_info_t *data_object, const char *ssid)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ g_free(data_object->ap_name);
+ data_object->ap_name = g_strdup(ssid);
+ return TRUE;
+}
+
+int view_detail_datamodel_eap_method_set(view_datamodel_eap_info_t *data_object, const wlan_eap_type_t eap_method)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ data_object->eap_method = eap_method;
+ return TRUE;
+}
+
+int view_detail_datamodel_eap_provision_set(view_datamodel_eap_info_t *data_object, const int provision)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ data_object->eap_provision = provision;
+ return TRUE;
+}
+
+int view_detail_datamodel_eap_auth_set(view_datamodel_eap_info_t *data_object, const wlan_eap_auth_type_t auth_type)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ data_object->auth_type = auth_type;
+ return TRUE;
+}
+
+int view_detail_datamodel_eap_user_id_set(view_datamodel_eap_info_t *data_object, const char* user_id)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ g_free(data_object->user_id);
+ data_object->user_id = g_strdup(user_id);
+ return TRUE;
+}
+
+int view_detail_datamodel_eap_anonymous_id_set(view_datamodel_eap_info_t *data_object, const char* anonymous_id)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ g_free(data_object->anonymous_id);
+ data_object->anonymous_id = g_strdup(anonymous_id);
+ return TRUE;
+}
+
+int view_detail_datamodel_eap_pswd_set(view_datamodel_eap_info_t *data_object, const char* pswd)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ g_free(data_object->pswd);
+ data_object->pswd = g_strdup(pswd);
+ return TRUE;
+}
+
+int view_detail_datamodel_eap_ca_cert_set(view_datamodel_eap_info_t *data_object, const char* ca_cert)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ g_free(data_object->ca_cert);
+ data_object->ca_cert = g_strdup(ca_cert);
+ return TRUE;
+}
+
+int view_detail_datamodel_eap_user_cert_set(view_datamodel_eap_info_t *data_object, const char* user_cert)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ g_free(data_object->user_cert);
+ data_object->user_cert = g_strdup(user_cert);
+ return TRUE;
+}
+
+IP_TYPES view_detail_datamodel_ip_and_dns_type_get(view_datamodel_ip_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return data_object->ip_and_dns_type;
+}
+
+char *view_detail_datamodel_static_ip_address_get(view_datamodel_ip_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->ip);
+}
+
+char *view_detail_datamodel_static_gateway_address_get(view_datamodel_ip_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->gateway);
+}
+
+char *view_detail_datamodel_static_subnet_mask_get(view_datamodel_ip_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->subnet);
+}
+
+char *view_detail_datamodel_static_dns1_address_get(view_datamodel_ip_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->dns1);
+}
+
+char *view_detail_datamodel_static_dns2_address_get(view_datamodel_ip_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->dns2);
+}
+
+char* view_detail_datamodel_proxy_address_get(view_datamodel_ip_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ if (data_object->proxy_addr)
+ return g_strdup(data_object->proxy_addr);
+ else
+ return NULL;
+}
+
+char* view_detail_datamodel_MAC_addr_get(view_datamodel_ip_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ char* ret = g_strdup(data_object->MAC_address);
+ return ret;
+}
+#if 0
+int view_detail_datamodel_channel_freq_get(view_datamodel_ip_info_t *data_object)
+{
+ view_detail_datamodel_t *data_object = (view_detail_datamodel_t *)mvc_object;
+ assertm_if(NULL == data_object, "NULL!!");
+ switch (data_object->channel_freq) {
+ default:
+ case 2412:
+ return 1;
+ case 2417:
+ return 2;
+ case 2422:
+ return 3;
+ case 2427:
+ return 4;
+ case 2432:
+ return 5;
+ case 2437:
+ return 6;
+ case 2442:
+ return 7;
+ case 2447:
+ return 8;
+ case 2452:
+ return 9;
+ case 2457:
+ return 10;
+ case 2462:
+ return 11;
+ }
+ return 0;
+}
+#endif
+
+wlan_eap_type_t view_detail_datamodel_eap_method_get(view_datamodel_eap_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return data_object->eap_method;
+}
+
+int view_detail_datamodel_eap_provision_get(view_datamodel_eap_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return data_object->eap_provision;
+}
+
+wlan_eap_auth_type_t view_detail_datamodel_eap_auth_get(view_datamodel_eap_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return data_object->auth_type;
+}
+
+char *view_detail_datamodel_user_id_get(view_datamodel_eap_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->user_id);
+}
+
+char *view_detail_datamodel_anonymous_id_get(view_datamodel_eap_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->anonymous_id);
+}
+
+char *view_detail_datamodel_pswd_get(view_datamodel_eap_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->pswd);
+}
+
+char *view_detail_datamodel_ca_cert_get(view_datamodel_eap_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->ca_cert);
+}
+
+char *view_detail_datamodel_user_cert_get(view_datamodel_eap_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->user_cert);
+}
+
+char *view_detail_datamodel_eap_ap_name_get(view_datamodel_eap_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->ap_name);
+}
+
+char *view_detail_datamodel_basic_info_profile_name_get(view_datamodel_basic_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->profile_name);
+}
+
+char *view_detail_datamodel_ap_name_get(view_datamodel_basic_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return g_strdup(data_object->ap_name);
+}
+
+unsigned int view_detail_datamodel_sig_strength_get(view_datamodel_basic_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return data_object->signal_strength;
+}
+
+unsigned int view_detail_datamodel_sec_mode_get(view_datamodel_basic_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return data_object->security_mode;
+}
+
+char view_detail_datamodel_wps_support_get(view_datamodel_basic_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return data_object->wps_support;
+}
+
+boolean view_detail_datamodel_is_favourite_get(view_datamodel_basic_info_t *data_object)
+{
+ assertm_if(NULL == data_object, "NULL!!");
+ return data_object->is_favourite;
+}
diff --git a/sources/libraries/Common/common_eap_connect.c b/sources/libraries/Common/common_eap_connect.c
new file mode 100644
index 0000000..2b5c81e
--- /dev/null
+++ b/sources/libraries/Common/common_eap_connect.c
@@ -0,0 +1,1493 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "common.h"
+#include "common_eap_connect.h"
+#include "i18nmanager.h"
+#include "common_utils.h"
+#include "common_ip_info.h"
+
+#define EAP_CONNECT_POPUP "popup_view"
+
+#define MAX_EAP_PROVISION_NUMBER 3
+
+#define EAP_METHOD_EXP_MENU_ID 0
+#define EAP_PROVISION_EXP_MENU_ID 1
+#define EAP_AUTH_TYPE_EXP_MENU_ID 2
+
+static bool g_eap_id_show_keypad = FALSE;
+static Elm_Genlist_Item_Class g_eap_type_itc;
+static Elm_Genlist_Item_Class g_eap_type_sub_itc;
+static Elm_Genlist_Item_Class g_eap_provision_itc;
+static Elm_Genlist_Item_Class g_eap_provision_sub_itc;
+static Elm_Genlist_Item_Class g_eap_auth_itc;
+static Elm_Genlist_Item_Class g_eap_auth_sub_itc;
+static Elm_Genlist_Item_Class g_eap_ca_cert_itc;
+static Elm_Genlist_Item_Class g_eap_user_cert_itc;
+static Elm_Genlist_Item_Class g_eap_entry_itc;
+
+typedef enum {
+ EAP_SEC_TYPE_UNKNOWN = 0,
+ EAP_SEC_TYPE_PEAP,
+ EAP_SEC_TYPE_TLS,
+ EAP_SEC_TYPE_TTLS,
+ EAP_SEC_TYPE_SIM,
+ EAP_SEC_TYPE_AKA,
+ EAP_SEC_TYPE_FAST,
+ EAP_SEC_TYPE_NULL
+} eap_type_t;
+
+typedef enum {
+ EAP_SEC_AUTH_NONE = 0,
+ EAP_SEC_AUTH_PAP,
+ EAP_SEC_AUTH_MSCHAP,
+ EAP_SEC_AUTH_MSCHAPV2,
+ EAP_SEC_AUTH_GTC,
+ EAP_SEC_AUTH_MD5,
+ EAP_SEC_AUTH_NULL
+} eap_auth_t;
+
+typedef struct {
+ char depth;
+ char *name;
+ Elm_Genlist_Item_Type flags;
+} _Expand_List_t;
+
+struct eap_info_list {
+ wifi_ap_h ap;
+ Elm_Object_Item *pswd_item;
+};
+
+static const _Expand_List_t list_eap_type[] = {
+ {1, "UNKNOWN", ELM_GENLIST_ITEM_NONE},
+ {1, "PEAP", ELM_GENLIST_ITEM_NONE},
+ {1, "TLS", ELM_GENLIST_ITEM_NONE},
+ {1, "TTLS", ELM_GENLIST_ITEM_NONE},
+ {1, "SIM", ELM_GENLIST_ITEM_NONE},
+ {1, "AKA", ELM_GENLIST_ITEM_NONE},
+#ifndef DISABLE_FAST_EAP_METHOD
+ {1, "FAST", ELM_GENLIST_ITEM_NONE},
+#endif
+ {1, NULL, ELM_GENLIST_ITEM_NONE}
+};
+
+static const _Expand_List_t list_eap_auth[] = {
+ {1, "NONE", ELM_GENLIST_ITEM_NONE},
+ {1, "PAP", ELM_GENLIST_ITEM_NONE},
+ {1, "MSCHAP", ELM_GENLIST_ITEM_NONE},
+ {1, "MSCHAPV2", ELM_GENLIST_ITEM_NONE},
+ {1, "GTC", ELM_GENLIST_ITEM_NONE},
+ {1, "MD5", ELM_GENLIST_ITEM_NONE},
+ {1, NULL, ELM_GENLIST_ITEM_NONE}
+};
+
+static Evas_Object *radio_main = NULL;
+
+struct common_eap_connect_data {
+ int expandable_list_index;
+
+ Elm_Object_Item *eap_type_item;
+ Elm_Object_Item *eap_provision_item;
+ Elm_Object_Item *eap_auth_item;
+ Elm_Object_Item *eap_ca_cert_item;
+ Elm_Object_Item *eap_user_cert_item;
+ Elm_Object_Item *eap_id_item;
+ Elm_Object_Item *eap_anonyid_item;
+ Elm_Object_Item *eap_pw_item;
+ Evas_Object *popup;
+
+ Evas_Object *genlist;
+ Eina_Bool eap_done_ok;
+ Evas_Object *win;
+ const char *str_pkg_name;
+ wifi_ap_h ap;
+ ip_info_list_t *ip_info_list;
+ Evas_Object* navi_frame;
+
+ int visible_area_width;
+ int visible_area_height;
+};
+
+static void _gl_eap_provision_sel(void *data, Evas_Object *obj, void *event_info);
+static void _gl_eap_auth_sel(void *data, Evas_Object *obj, void *event_info);
+static void _create_and_update_list_items_based_on_rules(eap_type_t new_type, common_eap_connect_data_t *eap_data);
+static void _delete_eap_entry_items(common_eap_connect_data_t *eap_data);
+static eap_type_t __common_eap_connect_popup_get_eap_type(wifi_ap_h ap);
+static eap_auth_t __common_eap_connect_popup_get_auth_type(wifi_ap_h ap);
+static wifi_eap_type_e __common_eap_connect_popup_get_wlan_eap_type(eap_type_t eap_type);
+static wifi_eap_auth_type_e __common_eap_connect_popup_get_wlan_auth_type(eap_auth_t auth_type);
+
+static void _gl_editbox_sel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ elm_genlist_item_selected_set(item, FALSE);
+}
+
+static void _gl_eap_type_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *) data;
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ Eina_Bool expanded = EINA_FALSE;
+ if (item)
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ expanded = elm_genlist_item_expanded_get(item);
+ if (expanded == FALSE) {
+ eap_data->expandable_list_index = EAP_METHOD_EXP_MENU_ID;
+ }
+
+ /* Expand/Contract the sub items list */
+ elm_genlist_item_expanded_set(item, !expanded);
+}
+
+static void _gl_eap_type_sub_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *) data;
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ Elm_Object_Item *parent_item = elm_genlist_item_parent_get(item);
+
+ eap_type_t pre_index = __common_eap_connect_popup_get_eap_type(eap_data->ap);
+ eap_type_t selected_item_index = elm_genlist_item_index_get(item) - elm_genlist_item_index_get(parent_item);
+
+ DEBUG_LOG( UG_NAME_NORMAL, "previous index = %d; selected index = %d;", pre_index, selected_item_index);
+
+ /* Contract the sub items list */
+ elm_genlist_item_expanded_set(parent_item, EINA_FALSE);
+
+ if (pre_index != selected_item_index) {
+// selected_item_index = __common_eap_connect_popup_get_eap_type(__common_eap_connect_popup_get_wlan_eap_type(selected_item_index));
+ _create_and_update_list_items_based_on_rules(selected_item_index, data);
+ wifi_eap_type_e type;
+ wifi_ap_set_eap_type(eap_data->ap, __common_eap_connect_popup_get_wlan_eap_type(selected_item_index));
+ wifi_ap_get_eap_type(eap_data->ap, &type);
+ DEBUG_LOG( UG_NAME_NORMAL, "set to new index = %d", type);
+ elm_genlist_item_update(parent_item);
+ } else {
+ DEBUG_LOG( UG_NAME_NORMAL, "pre_index == selected_item_index[%d]", selected_item_index);
+ }
+}
+
+static void _gl_eap_provision_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *) data;
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ Eina_Bool expanded = EINA_FALSE;
+ if (item)
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ expanded = elm_genlist_item_expanded_get(item);
+ if (expanded == FALSE) {
+ eap_data->expandable_list_index = EAP_PROVISION_EXP_MENU_ID;
+ }
+
+ /* Expand/Contract the sub items list */
+ elm_genlist_item_expanded_set(item, !expanded);
+}
+
+static void _gl_eap_provision_sub_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ Elm_Object_Item *parent_item = elm_genlist_item_parent_get(item);
+
+ /* TODO: Set the EAP provision. No CAPI available now. */
+
+ /* Contract the sub items list */
+ elm_genlist_item_expanded_set(parent_item, EINA_FALSE);
+
+ elm_genlist_item_update(parent_item);
+}
+
+static void _gl_eap_auth_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *) data;
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ Eina_Bool expanded = EINA_FALSE;
+ if (item)
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ expanded = elm_genlist_item_expanded_get(item);
+ if (expanded == FALSE) {
+ eap_data->expandable_list_index = EAP_AUTH_TYPE_EXP_MENU_ID;
+ }
+ /* Expand/Contract the sub items list */
+ elm_genlist_item_expanded_set(item, !expanded);
+}
+
+static void _gl_eap_auth_sub_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *) data;
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ Elm_Object_Item *parent_item = elm_genlist_item_parent_get(item);
+ eap_auth_t selected_item_index = elm_genlist_item_index_get(item) - elm_genlist_item_index_get(parent_item) - 1;
+
+ wifi_ap_set_eap_auth_type(eap_data->ap, __common_eap_connect_popup_get_wlan_auth_type(selected_item_index));
+
+ /* Contract the sub items list */
+ elm_genlist_item_expanded_set(parent_item, EINA_FALSE);
+
+ elm_genlist_item_update(parent_item);
+}
+
+static char *_gl_eap_type_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *)data;
+ eap_type_t sel_sub_item_id = __common_eap_connect_popup_get_eap_type(eap_data->ap);
+ DEBUG_LOG(UG_NAME_NORMAL, "current selected subitem = %d", sel_sub_item_id);
+
+ if (!strcmp(part, "elm.text.1")) {
+ return g_strdup(list_eap_type[sel_sub_item_id].name);
+ } else if (!strcmp(part, "elm.text.2")) {
+ return g_strdup(sc(eap_data->str_pkg_name, I18N_TYPE_EAP_method));
+ }
+
+ return NULL;
+}
+
+static char *_gl_eap_subtext_get(void *data, Evas_Object *obj, const char *part)
+{
+ wlan_eap_type_t eap_type = (wlan_eap_type_t)elm_radio_state_value_get(data);
+ if (!strcmp(part, "elm.text")) {
+ return g_strdup(list_eap_type[eap_type].name);
+ }
+
+ return NULL;
+}
+
+static Evas_Object *_gl_eap_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (!strcmp(part, "elm.icon") || !strcmp(part, "elm.swallow.icon")) {
+ return data;
+ }
+
+ return NULL;
+}
+
+static void _gl_eap_type_sub_menu_item_del(void *data, Evas_Object *obj)
+{
+ evas_object_unref(data);
+}
+
+static char *_gl_eap_provision_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *)data;
+ int sel_sub_item_id = 0;
+
+ /* TODO: Fetch the EAP provision. No CAPI available now. */
+
+ DEBUG_LOG(UG_NAME_NORMAL, "current selected subitem = %d", sel_sub_item_id);
+
+ if (!strcmp(part, "elm.text.1")) {
+ return g_strdup_printf("%d", sel_sub_item_id);
+ } else if (!strcmp(part, "elm.text.2")) {
+ return g_strdup(sc(eap_data->str_pkg_name, I18N_TYPE_Provisioning));
+ }
+
+ return NULL;
+}
+
+static char *_gl_eap_provision_subtext_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (!strcmp(part, "elm.text")) {
+ return g_strdup_printf("%d", (int)elm_radio_state_value_get(data));
+ }
+
+ return NULL;
+}
+
+static Evas_Object *_gl_eap_provision_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (!strcmp(part, "elm.icon") || !strcmp(part, "elm.swallow.icon")) {
+ return data;
+ }
+
+ return NULL;
+}
+
+static void _gl_eap_provision_sub_menu_item_del(void *data, Evas_Object *obj)
+{
+ evas_object_unref(data);
+}
+
+static char *_gl_eap_auth_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *)data;
+ eap_auth_t sel_sub_item_id = __common_eap_connect_popup_get_auth_type(eap_data->ap);
+ if (!strcmp(part, "elm.text.1")) {
+ return g_strdup(list_eap_auth[sel_sub_item_id].name);
+ } else if (!strcmp(part, "elm.text.2")) {
+ return g_strdup(sc(eap_data->str_pkg_name, I18N_TYPE_Phase_2_authentication));
+ }
+
+ return NULL;
+}
+
+static char *_gl_eap_auth_subtext_get(void *data, Evas_Object *obj, const char *part)
+{
+ wlan_eap_auth_type_t eap_auth = (wlan_eap_auth_type_t)elm_radio_state_value_get(data);
+ if (!strcmp(part, "elm.text")) {
+ return g_strdup(list_eap_auth[eap_auth].name);
+ }
+
+ return NULL;
+}
+
+static Evas_Object *_gl_eap_auth_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (!strcmp(part, "elm.icon") || !strcmp(part, "elm.swallow.icon")) {
+ return data;
+ }
+
+ return NULL;
+}
+
+static void _gl_eap_auth_sub_menu_item_del(void *data, Evas_Object *obj)
+{
+ evas_object_unref(data);
+}
+
+static char *_gl_eap_ca_cert_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *)data;
+ if (!strcmp(part, "elm.text.2")) {
+ return g_strdup(sc(eap_data->str_pkg_name, I18N_TYPE_Ca_Certificate));
+ } else if (!strcmp(part, "elm.text.1")) {
+ return g_strdup(sc(eap_data->str_pkg_name, I18N_TYPE_Unspecified));
+ }
+
+ return NULL;
+}
+
+static char *_gl_eap_user_cert_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *)data;
+ if (!strcmp(part, "elm.text.2")) {
+ return g_strdup(sc(eap_data->str_pkg_name, I18N_TYPE_User_Certificate));
+ } else if (!strcmp(part, "elm.text.1")) {
+ return g_strdup(sc(eap_data->str_pkg_name, I18N_TYPE_Unspecified));
+ }
+
+ return NULL;
+}
+
+static void _gl_eap_entry_cursor_changed_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ if (data == NULL)
+ return;
+
+ common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
+
+ if (entry_info) {
+ g_free(entry_info->entry_txt);
+ entry_info->entry_txt = NULL;
+
+ char *entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
+
+ if (entry_text != NULL && entry_text[0] != '\0')
+ entry_info->entry_txt = g_strdup(elm_entry_entry_get(obj));
+
+ g_free(entry_text);
+ }
+}
+
+static void _gl_eap_entry_changed_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ if (obj == NULL)
+ return;
+
+ if (elm_object_focus_get(data)) {
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+ else
+ elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
+ }
+}
+
+static void _gl_eap_entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (!elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
+ elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
+}
+
+static void _gl_eap_entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ INFO_LOG(UG_NAME_NORMAL, "_gl_eap_entry_unfocused_cb entered");
+
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,guidetext,show", "elm");
+ else {
+ elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
+ }
+
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+}
+
+static void _gl_eap_entry_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ elm_entry_entry_set(data, "");
+}
+
+static Evas_Object *_gl_eap_entry_item_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (g_strcmp0(part, "elm.icon")) {
+ return NULL;
+ }
+
+ common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
+ if (!entry_info)
+ return NULL;
+
+ Evas_Object *layout = NULL;
+ Evas_Object *entry = NULL;
+ char *title = NULL;
+ char *guide_txt = NULL;
+ char *accepted = NULL;
+ Eina_Bool hide_entry_txt = EINA_FALSE;
+ Elm_Input_Panel_Layout panel_type = ELM_INPUT_PANEL_LAYOUT_URL;
+
+ Elm_Entry_Filter_Limit_Size limit_filter_data;
+
+ layout = elm_layout_add(obj);
+ elm_layout_theme_set(layout, "layout", "editfield", "title");
+
+ entry = elm_entry_add(layout);
+ elm_entry_scrollable_set(entry, EINA_TRUE);
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ elm_object_part_content_set(layout, "elm.swallow.content", entry);
+
+ switch (entry_info->entry_id)
+ {
+ case ENTRY_TYPE_USER_ID:
+ title = entry_info->title_txt;
+ guide_txt = entry_info->guide_txt;
+ break;
+ case ENTRY_TYPE_ANONYMOUS_ID:
+ title = entry_info->title_txt;
+ guide_txt = entry_info->guide_txt;
+ break;
+ case ENTRY_TYPE_PASSWORD:
+ title = entry_info->title_txt;
+ guide_txt = entry_info->guide_txt;
+ hide_entry_txt = EINA_TRUE;
+ break;
+ default:
+ return NULL;
+ }
+ elm_object_part_text_set(layout, "elm.text", title);
+ elm_object_part_text_set(layout, "elm.guidetext", guide_txt);
+ elm_entry_password_set(entry, hide_entry_txt);
+ if (entry_info->entry_txt && (strlen(entry_info->entry_txt) > 0)) {
+ elm_entry_entry_set(entry, entry_info->entry_txt);
+ elm_object_signal_emit(layout, "elm,state,guidetext,hide", "elm");
+ }
+ elm_entry_input_panel_layout_set(entry, panel_type);
+ limit_filter_data.max_char_count = 32;
+ elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data);
+
+ Elm_Entry_Filter_Accept_Set digits_filter_data;
+ memset(&digits_filter_data, 0, sizeof(Elm_Entry_Filter_Accept_Set));
+ digits_filter_data.accepted = accepted;
+ elm_entry_markup_filter_append(entry, elm_entry_filter_accept_set, &digits_filter_data);
+
+ Ecore_IMF_Context *imf_ctxt = elm_entry_imf_context_get(entry);
+ if (imf_ctxt) {
+ ecore_imf_context_input_panel_event_callback_add(imf_ctxt, ECORE_IMF_INPUT_PANEL_STATE_EVENT, entry_info->input_panel_cb, entry_info->input_panel_cb_data);
+ DEBUG_LOG(UG_NAME_NORMAL, "set the imf ctxt cbs");
+ }
+
+ evas_object_smart_callback_add(entry, "cursor,changed", _gl_eap_entry_cursor_changed_cb, entry_info);
+ evas_object_smart_callback_add(entry, "changed", _gl_eap_entry_changed_cb, layout);
+ evas_object_smart_callback_add(entry, "focused", _gl_eap_entry_focused_cb, layout);
+ evas_object_smart_callback_add(entry, "unfocused", _gl_eap_entry_unfocused_cb, layout);
+ elm_object_signal_callback_add(layout, "elm,eraser,clicked", "elm", _gl_eap_entry_eraser_clicked_cb, entry);
+ evas_object_show(entry);
+
+ if (ENTRY_TYPE_USER_ID == entry_info->entry_id) {
+ if (TRUE == g_eap_id_show_keypad) {
+ elm_object_focus_set(entry, EINA_TRUE);
+ g_eap_id_show_keypad = FALSE;
+ }
+ }
+ entry_info->layout = layout;
+ return layout;
+}
+
+static void _gl_eap_entry_item_del(void *data, Evas_Object *obj)
+{
+ common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
+ if (entry_info == NULL)
+ return;
+
+ if (entry_info->entry_txt)
+ g_free(entry_info->entry_txt);
+
+ if (entry_info->input_panel_cb) {
+ Evas_Object *entry = common_utils_entry_layout_get_entry(entry_info->layout);
+ Ecore_IMF_Context *imf_ctxt = elm_entry_imf_context_get(entry);
+ if (imf_ctxt) {
+ ecore_imf_context_input_panel_event_callback_del(imf_ctxt, ECORE_IMF_INPUT_PANEL_STATE_EVENT, entry_info->input_panel_cb);
+ }
+ }
+
+ g_free(entry_info);
+}
+
+static void _gl_exp(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *radio;
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *)data;
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ Elm_Object_Item *sub_item = NULL;
+ Evas_Object *gl = elm_object_item_widget_get(item);
+ if (gl == NULL) {
+ ERROR_LOG(UG_NAME_NORMAL, "gl is NULL");
+ return;
+ }
+
+ evas_object_focus_set(gl, EINA_TRUE);
+
+ int i = 0;
+ eap_type_t eap_type;
+ eap_auth_t auth_type;
+ INFO_LOG(UG_NAME_RESP, "depth = %d", eap_data->expandable_list_index);
+ switch (eap_data->expandable_list_index) {
+ case EAP_METHOD_EXP_MENU_ID:
+ i = EAP_SEC_TYPE_PEAP;
+ eap_type = __common_eap_connect_popup_get_eap_type(eap_data->ap);
+ while(list_eap_type[i].name != NULL) {
+ radio = common_utils_create_radio_button(obj, i);
+ elm_radio_group_add(radio, radio_main);
+ evas_object_ref(radio);
+ if (i == eap_type)
+ elm_radio_value_set(radio, i);
+ sub_item = elm_genlist_item_append(gl, &g_eap_type_sub_itc, (void*)radio, item, list_eap_type[i].flags, _gl_eap_type_sub_sel, eap_data);
+#ifdef DISABLE_FAST_EAP_METHOD
+ if (!g_strcmp0(list_eap_type[i].name, "FAST")) {
+ elm_object_item_disabled_set(sub_item, TRUE);
+ }
+#endif
+ i++;
+ }
+ break;
+ case EAP_PROVISION_EXP_MENU_ID:
+ while(i <= MAX_EAP_PROVISION_NUMBER) {
+ radio = common_utils_create_radio_button(obj, i);
+ elm_radio_group_add(radio, radio_main);
+ evas_object_ref(radio);
+ if (i == 0) /* TODO: Fetch the EAP provision. CAPI not available now. */
+ elm_radio_value_set(radio, i);
+ elm_genlist_item_append(gl, &g_eap_provision_sub_itc, (void*)radio, item, ELM_GENLIST_ITEM_NONE, _gl_eap_provision_sub_sel, eap_data);
+ i++;
+ }
+ break;
+ case EAP_AUTH_TYPE_EXP_MENU_ID:
+ auth_type = __common_eap_connect_popup_get_auth_type(eap_data->ap);
+ while(list_eap_auth[i].name != NULL) {
+ radio = common_utils_create_radio_button(obj, i);
+ elm_radio_group_add(radio, radio_main);
+ evas_object_ref(radio);
+ if (i == auth_type)
+ elm_radio_value_set(radio, i);
+ elm_genlist_item_append(gl, &g_eap_auth_sub_itc, (void*)radio, item, list_eap_auth[i].flags, _gl_eap_auth_sub_sel, eap_data);
+ i++;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+static void _gl_con(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+
+ elm_genlist_item_subitems_clear(item);
+}
+
+static void __common_eap_connect_popup_init_item_class(void *data)
+{
+ g_eap_type_itc.item_style = "dialogue/2text.2/expandable";
+ g_eap_type_itc.func.text_get = _gl_eap_type_text_get;
+ g_eap_type_itc.func.content_get = NULL;
+ g_eap_type_itc.func.state_get = NULL;
+ g_eap_type_itc.func.del = NULL;
+
+ g_eap_type_sub_itc.item_style = "dialogue/1text.1icon.2/expandable2";
+ g_eap_type_sub_itc.func.text_get = _gl_eap_subtext_get;
+ g_eap_type_sub_itc.func.content_get = _gl_eap_content_get;
+ g_eap_type_sub_itc.func.state_get = NULL;
+ g_eap_type_sub_itc.func.del = _gl_eap_type_sub_menu_item_del;
+
+ g_eap_provision_itc.item_style = "dialogue/2text.2/expandable";
+ g_eap_provision_itc.func.text_get = _gl_eap_provision_text_get;
+ g_eap_provision_itc.func.content_get = NULL;
+ g_eap_provision_itc.func.state_get = NULL;
+ g_eap_provision_itc.func.del = NULL;
+
+ g_eap_provision_sub_itc.item_style = "dialogue/1text.1icon.2/expandable2";
+ g_eap_provision_sub_itc.func.text_get = _gl_eap_provision_subtext_get;
+ g_eap_provision_sub_itc.func.content_get = _gl_eap_provision_content_get;
+ g_eap_provision_sub_itc.func.state_get = NULL;
+ g_eap_provision_sub_itc.func.del = _gl_eap_provision_sub_menu_item_del;
+
+ g_eap_auth_itc.item_style = "dialogue/2text.2/expandable";
+ g_eap_auth_itc.func.text_get = _gl_eap_auth_text_get;
+ g_eap_auth_itc.func.content_get = NULL;
+ g_eap_auth_itc.func.state_get = NULL;
+ g_eap_auth_itc.func.del = NULL;
+
+ g_eap_auth_sub_itc.item_style = "dialogue/1text.1icon.2/expandable2";
+ g_eap_auth_sub_itc.func.text_get = _gl_eap_auth_subtext_get;
+ g_eap_auth_sub_itc.func.content_get = _gl_eap_auth_content_get;
+ g_eap_auth_sub_itc.func.state_get = NULL;
+ g_eap_auth_sub_itc.func.del = _gl_eap_auth_sub_menu_item_del;
+
+ g_eap_ca_cert_itc.item_style = "dialogue/2text.2";
+ g_eap_ca_cert_itc.func.text_get = _gl_eap_ca_cert_text_get;
+ g_eap_ca_cert_itc.func.content_get = NULL;
+ g_eap_ca_cert_itc.func.state_get = NULL;
+ g_eap_ca_cert_itc.func.del = NULL;
+
+ g_eap_user_cert_itc.item_style = "dialogue/2text.2";
+ g_eap_user_cert_itc.func.text_get = _gl_eap_user_cert_text_get;
+ g_eap_user_cert_itc.func.content_get = NULL;
+ g_eap_user_cert_itc.func.state_get = NULL;
+ g_eap_user_cert_itc.func.del = NULL;
+
+ g_eap_entry_itc.item_style = "dialogue/1icon";
+ g_eap_entry_itc.func.text_get = NULL;
+ g_eap_entry_itc.func.content_get = _gl_eap_entry_item_content_get;
+ g_eap_entry_itc.func.state_get = NULL;
+ g_eap_entry_itc.func.del = _gl_eap_entry_item_del;
+}
+
+static void __common_eap_connect_imf_ctxt_evnt_cb(void *data, Ecore_IMF_Context *ctx, int value)
+{
+ if (!data)
+ return;
+
+ if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
+ DEBUG_LOG(UG_NAME_NORMAL, "Key pad is now open");
+ elm_object_item_signal_emit(data, "elm,state,sip,shown", "");
+ } else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
+ DEBUG_LOG(UG_NAME_NORMAL, "Key pad is now close");
+ elm_object_item_signal_emit(data, "elm,state,sip,hidden", "");
+ }
+}
+
+static void __common_eap_connect_imf_ctxt_evnt_resize_cb(void *data, Ecore_IMF_Context *ctx, int value)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (!data)
+ return;
+
+ if (value == ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW)
+ return;
+
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *)data;
+ Evas_Object *box = elm_object_content_get(eap_data->popup);
+
+ __common_popup_size_get(ctx, &eap_data->visible_area_width, &eap_data->visible_area_height);
+ evas_object_size_hint_min_set(box, eap_data->visible_area_width * elm_config_scale_get(),
+ eap_data->visible_area_height * elm_config_scale_get());
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void __common_eap_view_set_imf_ctxt_evnt_cb(common_eap_connect_data_t *eap_data)
+{
+ if (!eap_data)
+ return;
+
+ Elm_Object_Item *navi_it = elm_naviframe_top_item_get(eap_data->navi_frame);
+
+ if (!navi_it)
+ return;
+
+ if (eap_data->eap_id_item)
+ common_utils_set_edit_box_imf_panel_evnt_cb(eap_data->eap_id_item, __common_eap_connect_imf_ctxt_evnt_cb, navi_it);
+ if (eap_data->eap_anonyid_item)
+ common_utils_set_edit_box_imf_panel_evnt_cb(eap_data->eap_anonyid_item, __common_eap_connect_imf_ctxt_evnt_cb, navi_it);
+ if (eap_data->eap_pw_item)
+ common_utils_set_edit_box_imf_panel_evnt_cb(eap_data->eap_pw_item, __common_eap_connect_imf_ctxt_evnt_cb, navi_it);
+}
+
+static void __common_eap_popup_set_imf_ctxt_evnt_cb(common_eap_connect_data_t *eap_data)
+{
+ if (!eap_data)
+ return;
+
+ if (eap_data->eap_id_item)
+ common_utils_set_edit_box_imf_panel_evnt_cb(eap_data->eap_id_item, __common_eap_connect_imf_ctxt_evnt_resize_cb, eap_data);
+ if (eap_data->eap_anonyid_item)
+ common_utils_set_edit_box_imf_panel_evnt_cb(eap_data->eap_anonyid_item, __common_eap_connect_imf_ctxt_evnt_resize_cb, eap_data);
+ if (eap_data->eap_pw_item)
+ common_utils_set_edit_box_imf_panel_evnt_cb(eap_data->eap_pw_item, __common_eap_connect_imf_ctxt_evnt_resize_cb, eap_data);
+}
+
+/*
+ * This creates EAP type, Auth type, CA certificate, User certificate, User Id, Anonymous Id and Password items.
+ */
+
+static void _create_and_update_list_items_based_on_rules(eap_type_t new_type, common_eap_connect_data_t *eap_data)
+{
+ __COMMON_FUNC_ENTER__;
+ Evas_Object* view_list = eap_data->genlist;
+ Elm_Object_Item *insert_after_item = NULL;
+ eap_type_t pre_type;
+
+ if (NULL == eap_data->eap_type_item) {
+ /* Create EAP method/type */
+ pre_type = EAP_SEC_TYPE_SIM;
+ eap_data->eap_type_item = elm_genlist_item_append(view_list, &g_eap_type_itc, eap_data, NULL, ELM_GENLIST_ITEM_TREE, _gl_eap_type_sel, eap_data);
+ } else {
+ pre_type = __common_eap_connect_popup_get_eap_type(eap_data->ap);
+ }
+
+ switch (new_type) {
+ case EAP_SEC_TYPE_PEAP:
+ case EAP_SEC_TYPE_TLS:
+ case EAP_SEC_TYPE_TTLS:
+ if (EAP_SEC_TYPE_UNKNOWN == pre_type || EAP_SEC_TYPE_SIM == pre_type || EAP_SEC_TYPE_AKA == pre_type) {
+ insert_after_item = eap_data->eap_type_item;
+ } else if (EAP_SEC_TYPE_FAST == pre_type) {
+ elm_object_item_del(eap_data->eap_provision_item);
+ eap_data->eap_provision_item = NULL;
+ }
+ break;
+ case EAP_SEC_TYPE_SIM:
+ case EAP_SEC_TYPE_AKA:
+ if (EAP_SEC_TYPE_PEAP == pre_type || EAP_SEC_TYPE_TLS == pre_type || EAP_SEC_TYPE_TTLS == pre_type) {
+ _delete_eap_entry_items(eap_data);
+ } else if (EAP_SEC_TYPE_FAST == pre_type) {
+ elm_object_item_del(eap_data->eap_provision_item);
+ eap_data->eap_provision_item = NULL;
+ _delete_eap_entry_items(eap_data);
+ }
+ break;
+ case EAP_SEC_TYPE_FAST:
+ /* Add EAP provision */
+ eap_data->eap_provision_item = elm_genlist_item_insert_after(view_list, &g_eap_provision_itc, eap_data, NULL, eap_data->eap_type_item, ELM_GENLIST_ITEM_TREE, _gl_eap_provision_sel, eap_data);
+ DEBUG_LOG(UG_NAME_NORMAL, "current selected provision = %d", 0); // TODO: Fetch the EAP provision. CAPI not yet available.
+ if (EAP_SEC_TYPE_UNKNOWN == pre_type || EAP_SEC_TYPE_SIM == pre_type || EAP_SEC_TYPE_AKA == pre_type) {
+ insert_after_item = eap_data->eap_provision_item;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (insert_after_item) {
+ common_utils_entry_info_t *edit_box_details;
+
+ /* Add EAP phase2 authentication */
+ eap_data->eap_auth_item = elm_genlist_item_insert_after(view_list, &g_eap_auth_itc, eap_data, NULL, insert_after_item, ELM_GENLIST_ITEM_TREE, _gl_eap_auth_sel, eap_data);
+
+ /* Add CA certificate */
+ eap_data->eap_ca_cert_item = elm_genlist_item_insert_after(view_list, &g_eap_ca_cert_itc, eap_data, NULL, eap_data->eap_auth_item, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(eap_data->eap_ca_cert_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ /* Add User certificate */
+ eap_data->eap_user_cert_item = elm_genlist_item_insert_after(view_list, &g_eap_user_cert_itc, eap_data, NULL, eap_data->eap_ca_cert_item, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(eap_data->eap_user_cert_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ /* Add EAP ID */
+ edit_box_details = g_new0(common_utils_entry_info_t, 1);
+ edit_box_details->entry_id = ENTRY_TYPE_USER_ID;
+ edit_box_details->title_txt = sc(eap_data->str_pkg_name, I18N_TYPE_Identity);
+ edit_box_details->guide_txt = sc(eap_data->str_pkg_name, I18N_TYPE_Enter_Identity);
+ eap_data->eap_id_item = elm_genlist_item_insert_after(view_list, &g_eap_entry_itc, edit_box_details, NULL, eap_data->eap_user_cert_item, ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ elm_genlist_item_select_mode_set(eap_data->eap_id_item, ELM_OBJECT_SELECT_MODE_NONE);
+ g_eap_id_show_keypad = FALSE;
+
+ /* Add EAP Anonymous Identity */
+ edit_box_details = g_new0(common_utils_entry_info_t, 1);
+ edit_box_details->entry_id = ENTRY_TYPE_ANONYMOUS_ID;
+ edit_box_details->title_txt = sc(eap_data->str_pkg_name, I18N_TYPE_Anonymous_Identity);
+ edit_box_details->guide_txt = sc(eap_data->str_pkg_name, I18N_TYPE_Enter_Anonymous_Identity);
+ eap_data->eap_anonyid_item = elm_genlist_item_insert_after(view_list, &g_eap_entry_itc, edit_box_details, NULL, eap_data->eap_id_item, ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ elm_genlist_item_select_mode_set(eap_data->eap_anonyid_item, ELM_OBJECT_SELECT_MODE_NONE);
+
+ /* Add EAP Password */
+ edit_box_details = g_new0(common_utils_entry_info_t, 1);
+ edit_box_details->entry_id = ENTRY_TYPE_PASSWORD;
+ edit_box_details->title_txt = sc(eap_data->str_pkg_name, I18N_TYPE_Password);
+ edit_box_details->guide_txt = sc(eap_data->str_pkg_name, I18N_TYPE_Enter_password);
+ eap_data->eap_pw_item = elm_genlist_item_insert_after(view_list, &g_eap_entry_itc, edit_box_details, NULL, eap_data->eap_anonyid_item, ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ elm_genlist_item_select_mode_set(eap_data->eap_pw_item, ELM_OBJECT_SELECT_MODE_NONE);
+
+ if (eap_data->popup) { /* Popup */
+ __common_eap_popup_set_imf_ctxt_evnt_cb(eap_data);
+ } else { /* View */
+ __common_eap_view_set_imf_ctxt_evnt_cb(eap_data);
+ }
+ }
+ __COMMON_FUNC_EXIT__;
+}
+
+void _delete_eap_entry_items(common_eap_connect_data_t *eap_data)
+{
+ __COMMON_FUNC_ENTER__;
+ elm_object_item_del(eap_data->eap_auth_item);
+ eap_data->eap_auth_item = NULL;
+ elm_object_item_del(eap_data->eap_ca_cert_item);
+ eap_data->eap_ca_cert_item = NULL;
+ elm_object_item_del(eap_data->eap_user_cert_item);
+ eap_data->eap_user_cert_item = NULL;
+ elm_object_item_del(eap_data->eap_id_item);
+ eap_data->eap_id_item = NULL;
+ elm_object_item_del(eap_data->eap_anonyid_item);
+ eap_data->eap_anonyid_item = NULL;
+ elm_object_item_del(eap_data->eap_pw_item);
+ eap_data->eap_pw_item = NULL;
+ __COMMON_FUNC_EXIT__;
+}
+
+static Evas_Object* _create_list(Evas_Object* parent, void *data)
+{
+ __COMMON_FUNC_ENTER__;
+ assertm_if(NULL == parent, "NULL!!");
+
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *)data;
+ const char* parent_view_name = evas_object_name_get(parent);
+ Evas_Object* view_list = NULL;
+
+ __common_eap_connect_popup_init_item_class(eap_data);
+ eap_data->eap_done_ok = FALSE;
+ eap_data->genlist = view_list = elm_genlist_add(parent);
+
+ if (g_strcmp0(EAP_CONNECT_POPUP, parent_view_name) != 0) {
+ elm_object_style_set(view_list, "dialogue");
+ common_utils_add_dialogue_separator(view_list, "dialogue/separator.2");
+ }
+
+ evas_object_size_hint_weight_set(view_list, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(view_list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ if (!radio_main) {
+ radio_main = elm_radio_add(view_list);
+ elm_radio_state_value_set(radio_main, 0);
+ elm_radio_value_set(radio_main, 0);
+ }
+
+ /* Set default values. eap type = PEAP, auth type = MSCHAPv2 */
+ wifi_ap_set_eap_type(eap_data->ap, WIFI_EAP_TYPE_PEAP);
+ wifi_ap_set_eap_auth_type(eap_data->ap, WIFI_EAP_AUTH_TYPE_MSCHAPV2);
+
+ /* Create the entry items */
+ _create_and_update_list_items_based_on_rules(EAP_SEC_TYPE_PEAP, eap_data);
+
+ evas_object_smart_callback_add(view_list, "expanded", _gl_exp, eap_data);
+ evas_object_smart_callback_add(view_list, "contracted", _gl_con, view_list);
+
+ __COMMON_FUNC_EXIT__;
+ return view_list;
+}
+
+static void __common_eap_connect_cleanup(common_eap_connect_data_t *eap_data)
+{
+ if (eap_data != NULL) {
+ ip_info_remove(eap_data->ip_info_list);
+ eap_data->ip_info_list = NULL;
+ evas_object_del(eap_data->genlist);
+ wifi_ap_destroy(eap_data->ap);
+ eap_data->ap = NULL;
+ evas_object_del(radio_main);
+ radio_main = NULL;
+ if (NULL == eap_data->navi_frame) {
+ evas_object_del(eap_data->popup);
+ /* Lets enable the scan updates */
+ wlan_manager_enable_scan_result_update();
+ }
+ g_free(eap_data);
+
+ }
+}
+
+static void __common_eap_connect_destroy(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *) data;
+ __common_eap_connect_cleanup(eap_data);
+ __COMMON_FUNC_EXIT__;
+}
+
+static void __common_eap_connect_done_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *)data;
+
+ if(eap_data->eap_done_ok == TRUE) {
+ return;
+ }
+ eap_data->eap_done_ok = TRUE;
+
+ char* str_id = NULL;
+ char* str_pw = NULL;
+
+ wifi_eap_type_e eap_type;
+
+ wifi_ap_set_eap_ca_cert_file(eap_data->ap, "");
+ wifi_ap_set_eap_client_cert_file(eap_data->ap, "");
+ wifi_ap_set_eap_private_key_info(eap_data->ap, "", "");
+
+ wifi_ap_get_eap_type(eap_data->ap, &eap_type);
+ switch (eap_type) {
+ case WIFI_EAP_TYPE_PEAP:
+ case WIFI_EAP_TYPE_TTLS:
+ str_id = common_utils_get_list_item_entry_txt(eap_data->eap_id_item);
+ if (!str_id || strlen(str_id) <= 0) {
+ common_utils_show_info_ok_popup(eap_data->win, eap_data->str_pkg_name, EAP_CHECK_YOUR_ID_STR);
+ eap_data->eap_done_ok = FALSE;
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ str_pw = common_utils_get_list_item_entry_txt(eap_data->eap_pw_item);
+ if (!str_pw || strlen(str_pw) <= 0) {
+ common_utils_show_info_ok_popup(eap_data->win, eap_data->str_pkg_name, EAP_CHECK_YOUR_PASWD_STR);
+ eap_data->eap_done_ok = FALSE;
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ char *temp_str = common_utils_get_list_item_entry_txt(eap_data->eap_anonyid_item);
+ /* TODO: Set the anonymous id. CAPI not yet available. */
+ g_free(temp_str);
+
+ wifi_ap_set_eap_passphrase(eap_data->ap, str_id, str_pw);
+ break;
+
+ case WIFI_EAP_TYPE_TLS:
+// g_strlcpy(p_conn_info->security_info.authentication.eap.username, str_id, NETPM_WLAN_USERNAME_LEN);
+// g_strlcpy(p_conn_info->security_info.authentication.eap.password, str_pw, NETPM_WLAN_USERNAME_LEN);
+ wifi_ap_set_eap_ca_cert_file(eap_data->ap, "/mnt/ums/Certification/ca2.pem");
+ wifi_ap_set_eap_client_cert_file(eap_data->ap, "/mnt/ums/Certification/user2.pem");
+ wifi_ap_set_eap_private_key_info(eap_data->ap, "/mnt/ums/Certification/user2.prv", "wifi");
+ break;
+
+ case WIFI_EAP_TYPE_SIM:
+ case WIFI_EAP_TYPE_AKA:
+ break;
+
+ default:
+ /* This case should never occur */
+ ERROR_LOG(UG_NAME_NORMAL, "Err!");
+ break;
+ }
+
+ /* Before we proceed to make a connection, lets save the entered IP data */
+ ip_info_save_data(eap_data->ip_info_list);
+
+ int ret = wlan_manager_connect_with_wifi_info(eap_data->ap);
+ if (WLAN_MANAGER_ERR_NONE != ret) {
+ ERROR_LOG(UG_NAME_NORMAL, "EAP connect request failed!!! Err = %d", ret);
+ }
+
+ if (eap_data->navi_frame) {
+ eap_view_close(eap_data);
+ } else {
+ __common_eap_connect_destroy(eap_data, NULL, NULL);
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static Eina_Bool __common_eap_connect_show_ime(void *data)
+{
+ Elm_Object_Item *list_entry_item = (Elm_Object_Item *)data;
+ if (!list_entry_item)
+ return ECORE_CALLBACK_CANCEL;
+
+ common_utils_entry_info_t *entry_info = elm_object_item_data_get(list_entry_item);
+ Evas_Object *lyt = entry_info->layout;
+ Evas_Object *entry = common_utils_entry_layout_get_entry(lyt);
+ if (!lyt || !entry)
+ return ECORE_CALLBACK_CANCEL;
+
+ g_eap_id_show_keypad = TRUE;
+ elm_genlist_item_update(list_entry_item);
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool __common_eap_connect_load_ip_info_list_cb(void *data)
+{
+ common_eap_connect_data_t *eap_data = (common_eap_connect_data_t *)data;
+ Elm_Object_Item *navi_it = NULL;
+ Evas_Object *list = NULL;
+
+ if (!eap_data)
+ return ECORE_CALLBACK_CANCEL;
+
+ if (eap_data->navi_frame) {
+ Evas_Object *layout = NULL;
+ navi_it = elm_naviframe_top_item_get(eap_data->navi_frame);
+ layout = elm_object_item_part_content_get(navi_it, "elm.swallow.content");
+ list = elm_object_part_content_get(layout, "elm.swallow.content");
+ eap_data->ip_info_list = ip_info_append_items(eap_data->ap, eap_data->str_pkg_name, list, __common_eap_connect_imf_ctxt_evnt_cb, navi_it);
+ } else {
+ Evas_Object *box = elm_object_content_get(eap_data->popup);
+ Eina_List *box_childs = elm_box_children_get(box);
+ list = eina_list_nth(box_childs, 0);
+ eap_data->ip_info_list = ip_info_append_items(eap_data->ap, eap_data->str_pkg_name, list, __common_eap_connect_imf_ctxt_evnt_resize_cb, eap_data);
+ }
+
+ /* Add a separator */
+ common_utils_add_dialogue_separator(list, "dialogue/separator");
+
+ ecore_idler_add(__common_eap_connect_show_ime, eap_data->eap_id_item);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+common_eap_connect_data_t *create_eap_connect_view(Evas_Object *win_main, Evas_Object *navi_frame, const char *pkg_name, wifi_device_info_t *device_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (!win_main || !device_info || !pkg_name)
+ return NULL;
+
+ common_eap_connect_data_t *eap_data = g_new0(common_eap_connect_data_t, 1);
+ eap_data->str_pkg_name = pkg_name;
+ eap_data->win = win_main;
+
+ /* Clone the WiFi AP handle */
+ wifi_ap_clone(&(eap_data->ap), device_info->ap);
+
+ /* Create eap connect view */
+ Elm_Object_Item* navi_it;
+ Evas_Object* button_back;
+ Evas_Object *connect_button;
+ Evas_Object *layout;
+ Evas_Object *list = NULL;
+
+ eap_data->navi_frame = navi_frame;
+
+ layout = common_utils_create_layout(navi_frame);
+ /* Create an EAP connect view list */
+ list = _create_list(layout, eap_data);
+ elm_object_part_content_set(layout, "elm.swallow.content", list);
+ navi_it = elm_naviframe_item_push(navi_frame, device_info->ssid, NULL, NULL, layout, NULL);
+ evas_object_data_set(navi_frame, SCREEN_TYPE_ID_KEY, (void *)VIEW_MANAGER_VIEW_TYPE_EAP);
+
+ /* Tool bar Connect button */
+ connect_button = elm_button_add(navi_frame);
+ elm_object_style_set(connect_button, "naviframe/toolbar/default");
+ elm_object_text_set(connect_button, sc(pkg_name, I18N_TYPE_Connect));
+ evas_object_smart_callback_add(connect_button, "clicked", __common_eap_connect_done_cb, eap_data);
+ elm_object_item_part_content_set(navi_it, "toolbar_button1", connect_button);
+
+ /* Tool bar Back button */
+ button_back = elm_object_item_part_content_get(navi_it, "prev_btn");
+ evas_object_smart_callback_add(button_back, "clicked", __common_eap_connect_destroy, eap_data);
+
+ /* Append ip info items and add a seperator */
+ ecore_idler_add(__common_eap_connect_load_ip_info_list_cb, eap_data);
+
+ /* Title Connect button */
+ connect_button = elm_button_add(navi_frame);
+ elm_object_style_set(connect_button, "naviframe/toolbar/default");
+ elm_object_text_set(connect_button, sc(pkg_name, I18N_TYPE_Connect));
+ evas_object_smart_callback_add(connect_button, "clicked", __common_eap_connect_done_cb, eap_data);
+ elm_object_item_part_content_set(navi_it, "title_toolbar_button1", connect_button);
+
+ /* Title Back button */
+ button_back = elm_button_add(navi_frame);
+ elm_object_style_set(button_back, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(button_back, "clicked", (Evas_Smart_Cb)eap_view_close, eap_data);
+ elm_object_item_part_content_set(navi_it, "title_prev_btn", button_back);
+
+ /* Register imf event cbs */
+ __common_eap_view_set_imf_ctxt_evnt_cb(eap_data);
+
+ __COMMON_FUNC_EXIT__;
+
+ return eap_data;
+}
+
+common_eap_connect_data_t *create_eap_connect_popup(Evas_Object *win_main, const char *pkg_name, wifi_device_info_t *device_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ Evas_Object *list = NULL;
+ if (!win_main || !device_info || !pkg_name)
+ return NULL;
+
+ common_eap_connect_data_t *eap_data = g_new0(common_eap_connect_data_t, 1);
+ eap_data->str_pkg_name = pkg_name;
+ eap_data->win = win_main;
+
+ /* Clone the WiFi AP handle */
+ wifi_ap_clone(&(eap_data->ap), device_info->ap);
+
+ /* Create eap connect popup */
+ Evas_Object *popup;
+ Evas_Object *box;
+ Evas_Object *btn;
+ int rotate_angle;
+ int visible_area_height;
+ int visible_area_width;
+
+ /* Lets disable the scan updates so that the UI is not refreshed un necessarily */
+ wlan_manager_disable_scan_result_update();
+
+ eap_data->popup = popup = elm_popup_add(win_main);
+ elm_object_style_set(popup, "min_menustyle");
+ elm_object_part_text_set(popup, "title,text", device_info->ssid);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(popup, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, sc(pkg_name, I18N_TYPE_Connect));
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", __common_eap_connect_done_cb, eap_data);
+
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, sc(pkg_name, I18N_TYPE_Cancel));
+ elm_object_part_content_set(popup, "button2", btn);
+ evas_object_smart_callback_add(btn, "clicked", __common_eap_connect_destroy, eap_data);
+
+ /* Create and add a box into the layout. */
+ box = elm_box_add(popup);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
+
+ rotate_angle = common_utils_get_rotate_angle(APPCORE_RM_UNKNOWN);
+
+ __common_popup_size_get(NULL ,&visible_area_width, &visible_area_height);
+ evas_object_size_hint_min_set(box, visible_area_width * elm_config_scale_get(), visible_area_height * elm_config_scale_get());
+ evas_object_name_set(box, EAP_CONNECT_POPUP);
+
+ /* Create an EAP connect view list */
+ list = _create_list(box, eap_data);
+
+ /* Append ip info items and add a seperator */
+ ecore_idler_add(__common_eap_connect_load_ip_info_list_cb, eap_data);
+
+
+ /* Pack the list into the box */
+ elm_box_pack_end(box, list);
+ elm_object_content_set(popup, box);
+ evas_object_show(list);
+ evas_object_show(box);
+ evas_object_show(popup);
+
+ __COMMON_FUNC_EXIT__;
+
+ return eap_data;
+}
+
+static wifi_eap_type_e __common_eap_connect_popup_get_wlan_eap_type(eap_type_t eap_type)
+{
+ wifi_eap_type_e wlan_eap_type = WLAN_SEC_EAP_TYPE_PEAP;
+ switch (eap_type) {
+ case EAP_SEC_TYPE_PEAP:
+ wlan_eap_type = WIFI_EAP_TYPE_PEAP;
+ break;
+ case EAP_SEC_TYPE_TLS:
+ wlan_eap_type = WIFI_EAP_TYPE_TLS;
+ break;
+ case EAP_SEC_TYPE_TTLS:
+ wlan_eap_type = WIFI_EAP_TYPE_TTLS;
+ break;
+ case EAP_SEC_TYPE_SIM:
+ wlan_eap_type = WIFI_EAP_TYPE_SIM;
+ break;
+ case EAP_SEC_TYPE_AKA:
+ wlan_eap_type = WIFI_EAP_TYPE_AKA;
+ break;
+#ifndef DISABLE_FAST_EAP_METHOD
+ /* Replace 6 with WLAN_SEC_EAP_TYPE_FAST, when libnet supports WLAN_SEC_EAP_TYPE_FAST enum */
+ case EAP_SEC_TYPE_FAST:
+ wlan_eap_type = 6;
+#endif
+ default:
+ /* This case should never occur */
+ ERROR_LOG(UG_NAME_NORMAL, "Err!");
+ break;
+ }
+ return wlan_eap_type;
+}
+
+static wifi_eap_auth_type_e __common_eap_connect_popup_get_wlan_auth_type(eap_auth_t auth_type)
+{
+ wifi_eap_auth_type_e wlan_auth_type = WIFI_EAP_AUTH_TYPE_NONE;
+ switch (auth_type) {
+ case EAP_SEC_AUTH_NONE:
+ wlan_auth_type = WIFI_EAP_AUTH_TYPE_NONE;
+ break;
+ case EAP_SEC_AUTH_PAP:
+ wlan_auth_type = WIFI_EAP_AUTH_TYPE_PAP;
+ break;
+ case EAP_SEC_AUTH_MSCHAP:
+ wlan_auth_type = WIFI_EAP_AUTH_TYPE_MSCHAP;
+ break;
+ case EAP_SEC_AUTH_MSCHAPV2:
+ wlan_auth_type = WIFI_EAP_AUTH_TYPE_MSCHAPV2;
+ break;
+ case EAP_SEC_AUTH_GTC:
+ wlan_auth_type = WIFI_EAP_AUTH_TYPE_GTC;
+ break;
+ case EAP_SEC_AUTH_MD5:
+ wlan_auth_type = WIFI_EAP_AUTH_TYPE_MD5;
+ break;
+ default:
+ /* This case should never occur */
+ ERROR_LOG(UG_NAME_NORMAL, "Err!");
+ break;
+ }
+ return wlan_auth_type;
+}
+
+static eap_type_t __common_eap_connect_popup_get_eap_type(wifi_ap_h ap)
+{
+ wifi_eap_type_e wlan_eap_type = 0;
+ int ret = wifi_ap_get_eap_type(ap, &wlan_eap_type);
+ if (WIFI_ERROR_OPERATION_FAILED == ret) {
+ ret = wifi_ap_set_eap_type(ap, WIFI_EAP_TYPE_PEAP); // Set to default
+ }
+
+ if (WIFI_ERROR_NONE != ret) {
+ ERROR_LOG(UG_NAME_ERR, "Unable to get the eap type. err = %d", ret);
+ return EAP_SEC_TYPE_UNKNOWN;
+ }
+ INFO_LOG(UG_NAME_NORMAL, "WiFi EAP type = %d", wlan_eap_type);
+ switch (wlan_eap_type) {
+ case WIFI_EAP_TYPE_PEAP: /**< EAP PEAP type */
+ return EAP_SEC_TYPE_PEAP;
+
+ case WIFI_EAP_TYPE_TLS: /**< EAP TLS type */
+ return EAP_SEC_TYPE_TLS;
+
+ case WIFI_EAP_TYPE_TTLS: /**< EAP TTLS type */
+ return EAP_SEC_TYPE_TTLS;
+
+ case WIFI_EAP_TYPE_SIM: /**< EAP SIM type */
+ return EAP_SEC_TYPE_SIM;
+
+ case WIFI_EAP_TYPE_AKA: /**< EAP AKA type */
+ return EAP_SEC_TYPE_AKA;
+
+#ifndef DISABLE_FAST_EAP_METHOD
+ /* Replace 6 with WLAN_SEC_EAP_TYPE_FAST, when libnet supports WLAN_SEC_EAP_TYPE_FAST enum */
+ case 6:
+ return EAP_SEC_TYPE_FAST;
+#endif
+
+ default:
+ return EAP_SEC_TYPE_PEAP;
+ }
+ return EAP_SEC_TYPE_PEAP;
+}
+
+static eap_auth_t __common_eap_connect_popup_get_auth_type(wifi_ap_h ap)
+{
+ wifi_eap_auth_type_e wlan_auth_type = 0;
+ int ret = wifi_ap_get_eap_auth_type(ap, &wlan_auth_type);
+ if (WIFI_ERROR_OPERATION_FAILED == ret) {
+ ret = wifi_ap_set_eap_auth_type(ap, EAP_SEC_AUTH_NONE); // Set to default
+ }
+
+ if (WIFI_ERROR_NONE != ret) {
+ ERROR_LOG(UG_NAME_ERR, "Unable to get the eap auth type. err = %d", ret);
+ return EAP_SEC_AUTH_NONE;
+ }
+ INFO_LOG(UG_NAME_NORMAL, "WiFi EAP auth type = %d", wlan_auth_type);
+
+ switch (wlan_auth_type) {
+ case WIFI_EAP_AUTH_TYPE_NONE: /**< EAP phase2 authentication none */
+ return EAP_SEC_AUTH_NONE;
+
+ case WIFI_EAP_AUTH_TYPE_PAP: /**< EAP phase2 authentication PAP */
+ return EAP_SEC_AUTH_PAP;
+
+ case WIFI_EAP_AUTH_TYPE_MSCHAP: /**< EAP phase2 authentication MSCHAP */
+ return EAP_SEC_AUTH_MSCHAP;
+
+ case WIFI_EAP_AUTH_TYPE_MSCHAPV2: /**< EAP phase2 authentication MSCHAPv2 */
+ return EAP_SEC_AUTH_MSCHAPV2;
+
+ case WIFI_EAP_AUTH_TYPE_GTC: /**< EAP phase2 authentication GTC */
+ return EAP_SEC_AUTH_GTC;
+
+ case WIFI_EAP_AUTH_TYPE_MD5: /**< EAP phase2 authentication MD5 */
+ return EAP_SEC_AUTH_MD5;
+
+ default:
+ return EAP_SEC_AUTH_NONE;
+ }
+ return EAP_SEC_AUTH_NONE;
+}
+
+/* This creates Auth type, ID, Anonymous Id and Password items
+ * This function should be called after creating the EAP type item
+ */
+eap_info_list_t *eap_info_append_items(wifi_ap_h ap, Evas_Object* view_list, const char *str_pkg_name, imf_ctxt_panel_cb_t input_panel_cb, void *input_panel_cb_data)
+{
+ __COMMON_FUNC_ENTER__;
+ eap_type_t eap_type;
+ eap_auth_t auth_type;
+ char *temp_str = NULL;
+ Eina_Bool append_continue = TRUE;
+ eap_info_list_t *eap_info_list_data = NULL;
+ if (!view_list || !str_pkg_name || !ap) {
+ ERROR_LOG(UG_NAME_ERR, "Invalid params passed!");
+ return NULL;
+ }
+
+ eap_info_list_data = g_new0(eap_info_list_t, 1);
+
+ eap_info_list_data->ap = ap;
+ eap_type = __common_eap_connect_popup_get_eap_type(ap);
+ auth_type = __common_eap_connect_popup_get_auth_type(ap);
+ common_utils_add_dialogue_separator(view_list, "dialogue/separator.2");
+
+ common_utils_add_2_line_txt_disabled_item(view_list, "dialogue/2text.2", sc(str_pkg_name, I18N_TYPE_EAP_method), list_eap_type[eap_type].name);
+
+ switch (eap_type) {
+ case EAP_SEC_TYPE_UNKNOWN:
+ case EAP_SEC_TYPE_PEAP:
+ case EAP_SEC_TYPE_TLS:
+ case EAP_SEC_TYPE_TTLS:
+ break;
+ case EAP_SEC_TYPE_FAST:
+ /* Add EAP provision */
+ /* TODO: Fetch EAP provisioning. CAPI not available. */
+ temp_str = g_strdup("");
+ common_utils_add_2_line_txt_disabled_item(view_list, "dialogue/2text.2", sc(str_pkg_name, I18N_TYPE_Provisioning), temp_str);
+ g_free(temp_str);
+ temp_str = NULL;
+ break;
+ case EAP_SEC_TYPE_SIM:
+ case EAP_SEC_TYPE_AKA:
+ default:
+ append_continue = FALSE;
+ break;
+ }
+
+ if (append_continue) {
+ common_utils_entry_info_t *edit_box_details;
+
+ /* Add EAP phase2 authentication */
+ common_utils_add_2_line_txt_disabled_item(view_list, "dialogue/2text.2", sc(str_pkg_name, I18N_TYPE_Phase_2_authentication), list_eap_auth[auth_type].name);
+
+ /* Add CA certificate */
+ temp_str = NULL;
+ wifi_ap_get_eap_ca_cert_file(ap, &temp_str);
+ temp_str = temp_str? temp_str : g_strdup(sc(str_pkg_name, I18N_TYPE_Unspecified));
+ common_utils_add_2_line_txt_disabled_item(view_list, "dialogue/2text.2", sc(str_pkg_name, I18N_TYPE_Ca_Certificate), temp_str);
+ g_free(temp_str);
+
+ /* Add User certificate */
+ temp_str = NULL;
+ wifi_ap_get_eap_client_cert_file(ap, &temp_str);
+ temp_str = temp_str? temp_str : g_strdup(sc(str_pkg_name, I18N_TYPE_Unspecified));
+ common_utils_add_2_line_txt_disabled_item(view_list, "dialogue/2text.2", sc(str_pkg_name, I18N_TYPE_User_Certificate),temp_str);
+ g_free(temp_str);
+
+ /* Add EAP ID */
+ bool is_paswd_set;
+ temp_str = NULL;
+ wifi_ap_get_eap_passphrase(ap, &temp_str, &is_paswd_set);
+ common_utils_add_2_line_txt_disabled_item(view_list, "dialogue/2text.2", sc(str_pkg_name, I18N_TYPE_Identity), temp_str);
+ g_free(temp_str);
+
+ /* Add EAP Anonymous Identity */
+ /* TODO: Fetch the anonymous user id. CAPI not available. */
+ temp_str = g_strdup("");
+ common_utils_add_2_line_txt_disabled_item(view_list, "dialogue/2text.2", sc(str_pkg_name, I18N_TYPE_Anonymous_Identity), temp_str);
+ g_free(temp_str);
+
+ /* Add EAP Password */
+ g_eap_entry_itc.item_style = "dialogue/1icon";
+ g_eap_entry_itc.func.text_get = NULL;
+ g_eap_entry_itc.func.content_get = _gl_eap_entry_item_content_get;
+ g_eap_entry_itc.func.state_get = NULL;
+ g_eap_entry_itc.func.del = _gl_eap_entry_item_del;
+
+ /* TODO: Fetch the password. CAPI not available. */
+ if (is_paswd_set)
+ temp_str = g_strdup("XXXXX");
+ else
+ temp_str = g_strdup("");
+
+ edit_box_details = g_new0(common_utils_entry_info_t, 1);
+ edit_box_details->entry_id = ENTRY_TYPE_PASSWORD;
+ edit_box_details->title_txt = sc(str_pkg_name, I18N_TYPE_Password);
+ edit_box_details->entry_txt = temp_str;
+ edit_box_details->input_panel_cb = input_panel_cb;
+ edit_box_details->input_panel_cb_data = input_panel_cb_data;
+ eap_info_list_data->pswd_item = elm_genlist_item_append(view_list, &g_eap_entry_itc, edit_box_details, NULL, ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ elm_genlist_item_select_mode_set(eap_info_list_data->pswd_item, ELM_OBJECT_SELECT_MODE_NONE);
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return eap_info_list_data;
+}
+
+void eap_info_save_data(eap_info_list_t *eap_info_list_data)
+{
+ if (!eap_info_list_data) {
+ ERROR_LOG(UG_NAME_ERR, "Invalid params passed!");
+ return;
+ }
+ char *txt = common_utils_get_list_item_entry_txt(eap_info_list_data->pswd_item);
+ DEBUG_LOG(UG_NAME_NORMAL, "Password [%s]", txt);
+
+ wifi_ap_set_eap_passphrase(eap_info_list_data->ap, NULL, txt);
+ g_free(txt);
+}
+
+void eap_info_remove(eap_info_list_t *eap_info_list_data)
+{
+ if (!eap_info_list_data) {
+ ERROR_LOG(UG_NAME_ERR, "Invalid params passed!");
+ return;
+ }
+
+ elm_object_item_del(eap_info_list_data->pswd_item);
+ eap_info_list_data->pswd_item = NULL;
+ g_free(eap_info_list_data);
+}
+
+void eap_view_close(common_eap_connect_data_t *eap_data)
+{
+ if (NULL == eap_data)
+ return;
+
+ Evas_Object *nf = eap_data->navi_frame;
+ __common_eap_connect_cleanup(eap_data);
+ elm_naviframe_item_pop(nf);
+}
+
+void eap_view_rotate_popup(common_eap_connect_data_t *eap_data, int rotate_angle)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (NULL == eap_data || NULL == eap_data->popup)
+ return;
+
+ Evas_Object *box = elm_object_content_get(eap_data->popup);
+ __common_popup_size_get(NULL, &eap_data->visible_area_width, &eap_data->visible_area_height);
+ evas_object_size_hint_min_set(box, eap_data->visible_area_width * elm_config_scale_get(), eap_data->visible_area_height* elm_config_scale_get());
+
+ __COMMON_FUNC_EXIT__;
+}
diff --git a/sources/libraries/Common/common_invalid_password.c b/sources/libraries/Common/common_invalid_password.c
new file mode 100644
index 0000000..00a07f1
--- /dev/null
+++ b/sources/libraries/Common/common_invalid_password.c
@@ -0,0 +1,149 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <wifi.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include "common.h"
+#include "common_invalid_password.h"
+
+#define SUPPLICANT_INTERFACE "fi.w1.wpa_supplicant1"
+#define SUPPLICANT_INTERFACE_SIGNAL_FILTER \
+ "type='signal',interface='fi.w1.wpa_supplicant1.Interface'"
+
+static gboolean invalid_key = FALSE;
+static DBusConnection *connection = NULL;
+
+static void __common_pop_invalid_password(void)
+{
+ invalid_key = TRUE;
+
+ ERROR_LOG(UG_NAME_NORMAL, "Invalid password");
+}
+
+static DBusHandlerResult __common_check_invalid_password(
+ DBusConnection* connection, DBusMessage* message, void* user_data)
+{
+ DBusMessageIter iter, dict, entry, value;
+ const char *key;
+ const char *state;
+ static char old_state[30] = { 0, };
+
+ if (dbus_message_is_signal(message,
+ SUPPLICANT_INTERFACE ".Interface", "PropertiesChanged") != TRUE)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (dbus_message_iter_init(message, &iter) == FALSE)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_recurse(&iter, &dict);
+ while (dbus_message_iter_get_arg_type(&dict) == DBUS_TYPE_DICT_ENTRY) {
+ dbus_message_iter_recurse(&dict, &entry);
+ if (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_STRING)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_get_basic(&entry, &key);
+ dbus_message_iter_next(&entry);
+
+ if (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_VARIANT)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_recurse(&entry, &value);
+
+ if (g_strcmp0(key, "State") == 0) {
+ dbus_message_iter_get_basic(&value, &state);
+ if (state == NULL)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (g_strcmp0(old_state, "4way_handshake") == 0 &&
+ g_strcmp0(state, "disconnected") == 0)
+ __common_pop_invalid_password();
+
+ g_strlcpy(old_state, state, 30);
+ }
+
+ dbus_message_iter_next(&dict);
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+int _common_register_invalid_password_popup(void)
+{
+ DBusError error;
+
+ invalid_key = FALSE;
+
+ if (connection != NULL)
+ return WIFI_ERROR_NONE;
+
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (connection == NULL)
+ return WIFI_ERROR_OUT_OF_MEMORY;
+
+ dbus_connection_setup_with_g_main(connection, NULL);
+
+ dbus_error_init(&error);
+ dbus_bus_add_match(connection, SUPPLICANT_INTERFACE_SIGNAL_FILTER, &error);
+ dbus_connection_flush(connection);
+ if (dbus_error_is_set(&error) == TRUE) {
+ dbus_error_free(&error);
+
+ dbus_connection_unref(connection);
+ connection = NULL;
+
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ }
+
+ if (dbus_connection_add_filter(connection,
+ __common_check_invalid_password, NULL, NULL) == FALSE) {
+ dbus_connection_unref(connection);
+ connection = NULL;
+
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ }
+
+ return WIFI_ERROR_NONE;
+}
+
+int _common_deregister_invalid_password_popup(void)
+{
+ if (connection == NULL)
+ return WIFI_ERROR_NONE;
+
+ dbus_bus_remove_match(connection, SUPPLICANT_INTERFACE_SIGNAL_FILTER, NULL);
+ dbus_connection_flush(connection);
+
+ dbus_connection_remove_filter(connection,
+ __common_check_invalid_password, NULL);
+
+ dbus_connection_unref(connection);
+ connection = NULL;
+
+ return WIFI_ERROR_NONE;
+}
+
+gboolean _common_is_invalid_password(void)
+{
+ return invalid_key;
+}
diff --git a/sources/libraries/Common/common_ip_info.c b/sources/libraries/Common/common_ip_info.c
new file mode 100644
index 0000000..ec02492
--- /dev/null
+++ b/sources/libraries/Common/common_ip_info.c
@@ -0,0 +1,851 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <glib.h>
+
+#include "common.h"
+#include "common_ip_info.h"
+#include "i18nmanager.h"
+
+#define DEFAULT_PROXY_ADDR "0.0.0.0:80"
+
+#define MAX_PORT_NUMBER 65535
+
+typedef struct {
+ char* title;
+ char* description;
+} _view_detail_description_data_t;
+
+struct ip_info_list {
+ const char *str_pkg_name;
+ Evas_Object *genlist;
+
+ Elm_Object_Item* ip_toggle_item;
+ Elm_Object_Item* ip_addr_item;
+ Elm_Object_Item* subnet_mask_item;
+ Elm_Object_Item* gateway_addr_item;
+ Elm_Object_Item* dns_1_item;
+ Elm_Object_Item* dns_2_item;
+ Elm_Object_Item* proxy_addr_item;
+ Elm_Object_Item* proxy_port_item;
+
+ imf_ctxt_panel_cb_t input_panel_cb;
+ void *input_panel_cb_data;
+
+ wifi_ap_h ap;
+};
+
+static Elm_Object_Item* _add_description(Evas_Object* genlist, char* title,
+ char* description, Elm_Object_Item* insert_after);
+
+static Elm_Genlist_Item_Class ip_toggle_itc ;
+static Elm_Genlist_Item_Class description_itc ;
+static Elm_Genlist_Item_Class ip_entry_itc;
+
+static void _gl_editbox_sel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ elm_genlist_item_selected_set(item, FALSE);
+}
+
+static void _ip_info_detail_description_del(void *data, Evas_Object *obj)
+{
+ __COMMON_FUNC_ENTER__;
+ _view_detail_description_data_t* det = (_view_detail_description_data_t*) data;
+ assertm_if(NULL == det, "NULL!!");
+ assertm_if(NULL == det->title, "NULL!!");
+ assertm_if(NULL == det->description, "NULL!!");
+ g_free(det->description);
+ g_free(det->title);
+ g_free(det);
+ det = NULL;
+ __COMMON_FUNC_EXIT__;
+}
+
+static char *_ip_info_detail_description_text_get(void *data,
+ Evas_Object *obj, const char *part)
+{
+ _view_detail_description_data_t* det = (_view_detail_description_data_t*) data;
+ assertm_if(NULL == det, "NULL!!");
+ assertm_if(NULL == det->title, "NULL!!");
+ assertm_if(NULL == det->description, "NULL!!");
+ assertm_if(NULL == part, "NULL!!");
+
+ if(0 == strncmp("elm.text.1", part, strlen(part))) {
+ return g_strdup(det->title);
+ } else if(0 == strncmp("elm.text.2", part, strlen(part))) {
+ return g_strdup(det->description);
+ }
+
+ return NULL;
+}
+
+static void _ip_info_entry_cursor_changed_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ if (data == NULL)
+ return;
+
+ common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
+
+ if (entry_info) {
+ g_free(entry_info->entry_txt);
+ entry_info->entry_txt = NULL;
+ char *entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
+
+ if (entry_text != NULL && entry_text[0] != '\0')
+ entry_info->entry_txt = g_strdup(elm_entry_entry_get(obj));
+
+ g_free(entry_text);
+ }
+}
+
+static void _ip_info_entry_changed_cb(void *data,
+ Evas_Object *obj, void *event_info)
+{
+ int entry_pos = 0;
+ char *entry_text = NULL;
+ char **ip_text = NULL;
+ int panel_type = 0;
+
+ if (obj == NULL)
+ return;
+
+ if (elm_object_focus_get(data)) {
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+ else
+ elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
+ }
+
+ panel_type = elm_entry_input_panel_layout_get(obj);
+ if (panel_type == ELM_INPUT_PANEL_LAYOUT_IP) {
+ int i = 0;
+ int ip_addr[4] = {0};
+ char entry_ip_text[16] = {0,};
+ gboolean fixed = FALSE;
+ entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
+ ip_text = g_strsplit(entry_text, ".", 5);
+
+ for (i=0; i<5; i++) {
+ if (ip_text[i] == NULL)
+ break;
+
+ if (i == 4) {
+ fixed = TRUE;
+ break;
+ }
+
+ ip_addr[i] = atoi(ip_text[i]);
+ if (ip_addr[i] > 255) {
+ ip_addr[i] = 255;
+ fixed = TRUE;
+ }
+
+ if (i < 3)
+ sprintf(entry_text, "%d.", ip_addr[i]);
+ else
+ sprintf(entry_text, "%d", ip_addr[i]);
+
+ g_strlcat(entry_ip_text, entry_text, sizeof(entry_ip_text));
+ }
+ g_free(entry_text);
+ g_strfreev(ip_text);
+
+ if (fixed == TRUE) {
+ entry_pos = elm_entry_cursor_pos_get(obj);
+ elm_entry_entry_set(obj, entry_ip_text);
+ elm_entry_cursor_pos_set(obj, entry_pos+1);
+ }
+ } else if (panel_type == ELM_INPUT_PANEL_LAYOUT_NUMBERONLY) {
+ int port_num = 0;
+
+ entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
+ sscanf(entry_text, "%d", &port_num);
+
+ if (port_num > MAX_PORT_NUMBER) {
+ entry_pos = elm_entry_cursor_pos_get(obj);
+ sprintf(entry_text, "%d", MAX_PORT_NUMBER);
+ elm_entry_entry_set(obj, entry_text);
+ elm_entry_cursor_pos_set(obj, entry_pos);
+ }
+
+ g_free(entry_text);
+ }
+}
+
+static void _ip_info_entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (!elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
+ elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
+}
+
+static void _ip_info_entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ INFO_LOG(UG_NAME_NORMAL, "_ip_info_entry_unfocused_cb entered");
+
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,guidetext,show", "elm");
+ else {
+ elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
+ int panel_type = elm_entry_input_panel_layout_get(obj);
+ if (panel_type == ELM_INPUT_PANEL_LAYOUT_IP) {
+ int ip_addr[4] = {0};
+ char *entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
+ sscanf(entry_text, "%d.%d.%d.%d", &ip_addr[0], &ip_addr[1], &ip_addr[2], &ip_addr[3]);
+ sprintf(entry_text, "%d.%d.%d.%d", ip_addr[0], ip_addr[1], ip_addr[2], ip_addr[3]);
+ elm_entry_entry_set(obj, entry_text);
+ g_free(entry_text);
+ }
+ }
+
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+}
+
+static void _ip_info_entry_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ elm_entry_entry_set(data, "");
+}
+
+static Evas_Object *_ip_info_entry_item_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (g_strcmp0(part, "elm.icon")) {
+ return NULL;
+ }
+
+ common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
+ if (!entry_info)
+ return NULL;
+
+ Evas_Object *layout = NULL;
+ Evas_Object *entry = NULL;
+ char *title = NULL;
+ char *guide_txt = NULL;
+ char *accepted = NULL;
+ Eina_Bool hide_entry_txt = EINA_FALSE;
+ Elm_Input_Panel_Layout panel_type;
+
+ Elm_Entry_Filter_Limit_Size limit_filter_data;
+
+ layout = elm_layout_add(obj);
+ elm_layout_theme_set(layout, "layout", "editfield", "title");
+
+ entry = elm_entry_add(layout);
+ elm_entry_scrollable_set(entry, EINA_TRUE);
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ elm_object_part_content_set(layout, "elm.swallow.content", entry);
+
+ switch (entry_info->entry_id)
+ {
+ case ENTRY_TYPE_IP_ADDR:
+ title = entry_info->title_txt;
+ guide_txt = entry_info->guide_txt;
+ panel_type = ELM_INPUT_PANEL_LAYOUT_IP;
+ accepted = "0123456789.";
+ break;
+ case ENTRY_TYPE_SUBNET_MASK:
+ title = entry_info->title_txt;
+ guide_txt = entry_info->guide_txt;
+ panel_type = ELM_INPUT_PANEL_LAYOUT_IP;
+ accepted = "0123456789.";
+ break;
+ case ENTRY_TYPE_GATEWAY:
+ title = entry_info->title_txt;
+ guide_txt = entry_info->guide_txt;
+ panel_type = ELM_INPUT_PANEL_LAYOUT_IP;
+ accepted = "0123456789.";
+ break;
+ case ENTRY_TYPE_DNS_1:
+ title = entry_info->title_txt;
+ guide_txt = entry_info->guide_txt;
+ panel_type = ELM_INPUT_PANEL_LAYOUT_IP;
+ accepted = "0123456789.";
+ break;
+ case ENTRY_TYPE_DNS_2:
+ title = entry_info->title_txt;
+ guide_txt = entry_info->guide_txt;
+ panel_type = ELM_INPUT_PANEL_LAYOUT_IP;
+ accepted = "0123456789.";
+ break;
+ case ENTRY_TYPE_PROXY_ADDR:
+ title = entry_info->title_txt;
+ guide_txt = DEFAULT_GUIDE_PROXY_IP;
+ panel_type = ELM_INPUT_PANEL_LAYOUT_URL;
+ break;
+ case ENTRY_TYPE_PROXY_PORT:
+ title = entry_info->title_txt;
+ guide_txt = DEFAULT_GUIDE_PROXY_PORT;
+ panel_type = ELM_INPUT_PANEL_LAYOUT_NUMBERONLY;
+ break;
+ default:
+ return NULL;
+ }
+
+ elm_object_part_text_set(layout, "elm.text", title);
+ elm_object_part_text_set(layout, "elm.guidetext", guide_txt);
+ elm_entry_password_set(entry, hide_entry_txt);
+ if (entry_info->entry_txt && (strlen(entry_info->entry_txt) > 0)) {
+ elm_entry_entry_set(entry, entry_info->entry_txt);
+ elm_object_signal_emit(layout, "elm,state,guidetext,hide", "elm");
+ }
+ elm_entry_input_panel_layout_set(entry, panel_type);
+ limit_filter_data.max_char_count = 32;
+ elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data);
+
+ Elm_Entry_Filter_Accept_Set digits_filter_data;
+ memset(&digits_filter_data, 0, sizeof(Elm_Entry_Filter_Accept_Set));
+ digits_filter_data.accepted = accepted;
+ elm_entry_markup_filter_append(entry, elm_entry_filter_accept_set, &digits_filter_data);
+
+ if (entry_info->input_panel_cb) {
+ Ecore_IMF_Context *imf_ctxt = elm_entry_imf_context_get(entry);
+ if (imf_ctxt) {
+ ecore_imf_context_input_panel_event_callback_add(imf_ctxt, ECORE_IMF_INPUT_PANEL_STATE_EVENT, entry_info->input_panel_cb, entry_info->input_panel_cb_data);
+ }
+ }
+ evas_object_smart_callback_add(entry, "cursor,changed", _ip_info_entry_cursor_changed_cb, entry_info);
+ evas_object_smart_callback_add(entry, "changed", _ip_info_entry_changed_cb, layout);
+ evas_object_smart_callback_add(entry, "focused", _ip_info_entry_focused_cb, layout);
+ evas_object_smart_callback_add(entry, "unfocused", _ip_info_entry_unfocused_cb, layout);
+ elm_object_signal_callback_add(layout, "elm,eraser,clicked", "elm", _ip_info_entry_eraser_clicked_cb, entry);
+ evas_object_show(entry);
+
+ entry_info->layout = layout;
+ return layout;
+}
+
+static void _ip_info_entry_item_del(void *data, Evas_Object *obj)
+{
+ common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
+ if (entry_info == NULL)
+ return;
+
+ if (entry_info->entry_txt)
+ g_free(entry_info->entry_txt);
+
+ if (entry_info->input_panel_cb) {
+ Evas_Object *entry = common_utils_entry_layout_get_entry(entry_info->layout);
+ Ecore_IMF_Context *imf_ctxt = elm_entry_imf_context_get(entry);
+ if (imf_ctxt) {
+ ecore_imf_context_input_panel_event_callback_del(imf_ctxt, ECORE_IMF_INPUT_PANEL_STATE_EVENT, entry_info->input_panel_cb);
+ }
+ }
+
+ g_free(entry_info);
+}
+
+static void _create_static_ip_table(ip_info_list_t *ip_info_list_data)
+{
+ char *txt = NULL;
+ wifi_ap_h ap = ip_info_list_data->ap;
+ common_utils_entry_info_t *edit_box_details;
+
+ __COMMON_FUNC_ENTER__;
+
+ /* IP Address */
+ wifi_ap_get_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ edit_box_details = g_new0(common_utils_entry_info_t, 1);
+ edit_box_details->entry_id = ENTRY_TYPE_IP_ADDR;
+ edit_box_details->title_txt = sc(ip_info_list_data->str_pkg_name, I18N_TYPE_IP_address);
+ edit_box_details->entry_txt = txt;
+ edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
+ edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
+ ip_info_list_data->ip_addr_item = elm_genlist_item_insert_after(ip_info_list_data->genlist, &ip_entry_itc, edit_box_details, NULL, ip_info_list_data->ip_toggle_item, ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ elm_genlist_item_select_mode_set(ip_info_list_data->ip_addr_item, ELM_OBJECT_SELECT_MODE_NONE);
+
+ /* Subnet Mask */
+ wifi_ap_get_subnet_mask(ap, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ edit_box_details = g_new0(common_utils_entry_info_t, 1);
+ edit_box_details->entry_id = ENTRY_TYPE_SUBNET_MASK;
+ edit_box_details->title_txt = sc(ip_info_list_data->str_pkg_name, I18N_TYPE_Subnet_mask);
+ edit_box_details->entry_txt = txt;
+ edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
+ edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
+ ip_info_list_data->subnet_mask_item = elm_genlist_item_insert_after(ip_info_list_data->genlist, &ip_entry_itc, edit_box_details, NULL, ip_info_list_data->ip_addr_item, ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ elm_genlist_item_select_mode_set(ip_info_list_data->subnet_mask_item, ELM_OBJECT_SELECT_MODE_NONE);
+
+ /* Gateway Address */
+ wifi_ap_get_gateway_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ edit_box_details = g_new0(common_utils_entry_info_t, 1);
+ edit_box_details->entry_id = ENTRY_TYPE_GATEWAY;
+ edit_box_details->title_txt = sc(ip_info_list_data->str_pkg_name, I18N_TYPE_Gateway_address);
+ edit_box_details->entry_txt = txt;
+ edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
+ edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
+ ip_info_list_data->gateway_addr_item = elm_genlist_item_insert_after(ip_info_list_data->genlist, &ip_entry_itc, edit_box_details, NULL, ip_info_list_data->subnet_mask_item, ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ elm_genlist_item_select_mode_set(ip_info_list_data->gateway_addr_item, ELM_OBJECT_SELECT_MODE_NONE);
+
+ /* DNS 1 */
+ wifi_ap_get_dns_address(ap, 1, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ edit_box_details = g_new0(common_utils_entry_info_t, 1);
+ edit_box_details->entry_id = ENTRY_TYPE_DNS_1;
+ edit_box_details->title_txt = sc(ip_info_list_data->str_pkg_name, I18N_TYPE_DNS_1);
+ edit_box_details->entry_txt = txt;
+ edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
+ edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
+ ip_info_list_data->dns_1_item = elm_genlist_item_insert_after(ip_info_list_data->genlist, &ip_entry_itc, edit_box_details, NULL, ip_info_list_data->gateway_addr_item, ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ elm_genlist_item_select_mode_set(ip_info_list_data->dns_1_item, ELM_OBJECT_SELECT_MODE_NONE);
+
+ /* DNS 2 */
+ wifi_ap_get_dns_address(ap, 2, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ edit_box_details = g_new0(common_utils_entry_info_t, 1);
+ edit_box_details->entry_id = ENTRY_TYPE_DNS_2;
+ edit_box_details->title_txt = sc(ip_info_list_data->str_pkg_name, I18N_TYPE_DNS_2);
+ edit_box_details->entry_txt = txt;
+ edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
+ edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
+ ip_info_list_data->dns_2_item = elm_genlist_item_insert_after(ip_info_list_data->genlist, &ip_entry_itc, edit_box_details, NULL, ip_info_list_data->dns_1_item, ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ elm_genlist_item_select_mode_set(ip_info_list_data->dns_2_item, ELM_OBJECT_SELECT_MODE_NONE);
+
+ __COMMON_FUNC_EXIT__;
+
+ return;
+}
+
+static void _delete_static_ip_table(ip_info_list_t *ip_info_list_data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ elm_object_item_del(ip_info_list_data->ip_addr_item);
+ ip_info_list_data->ip_addr_item = NULL;
+ elm_object_item_del(ip_info_list_data->subnet_mask_item);
+ ip_info_list_data->subnet_mask_item = NULL;
+ elm_object_item_del(ip_info_list_data->gateway_addr_item);
+ ip_info_list_data->gateway_addr_item = NULL;
+ elm_object_item_del(ip_info_list_data->dns_1_item);
+ ip_info_list_data->dns_1_item = NULL;
+ elm_object_item_del(ip_info_list_data->dns_2_item);
+ ip_info_list_data->dns_2_item = NULL;
+
+ __COMMON_FUNC_EXIT__;
+
+ return;
+}
+
+static int _genlist_item_disable_later(void* data)
+{
+ elm_genlist_item_selected_set((Elm_Object_Item*) data, FALSE);
+ return FALSE;
+}
+
+static void _gl_deselect_callback(void* data, Evas_Object* obj,
+ void* event_info)
+{
+ ecore_idler_add( (Ecore_Task_Cb) _genlist_item_disable_later, event_info);
+}
+
+static char* _ip_info_iptoggle_text_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ __COMMON_FUNC_ENTER__;
+
+ assertm_if(NULL == data, "NULL!!");
+ assertm_if(NULL == obj, "NULL!!");
+ assertm_if(NULL == part, "NULL!!");
+ if (part != NULL) {
+ if (!strncmp(part, "elm.text", strlen(part))) {
+ __COMMON_FUNC_EXIT__;
+ ip_info_list_t *ip_info_list_data = (ip_info_list_t *)data;
+ return (char*)g_strdup(sc(ip_info_list_data->str_pkg_name, I18N_TYPE_Static_IP));
+ }
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return NULL;
+}
+
+static Elm_Object_Item* _add_description(Evas_Object* genlist, char* title,
+ char* description, Elm_Object_Item* insert_after)
+{
+ assertm_if(NULL == genlist, "NULL!!");
+ assertm_if(NULL == title, "NULL!!");
+ assertm_if(NULL == description, "NULL!!");
+
+ _view_detail_description_data_t* description_data = g_new0(_view_detail_description_data_t, 1);
+ assertm_if(NULL == description_data, "NULL!!");
+
+ description_data->title = g_strdup(title);
+ description_data->description = g_strdup(description);
+
+ Elm_Object_Item* det = NULL;
+ if (insert_after) {
+ det = elm_genlist_item_insert_after(
+ genlist, /*obj*/
+ &description_itc,/*itc*/
+ description_data,/*data*/
+ NULL,/*parent*/
+ insert_after, /*after than*/
+ ELM_GENLIST_ITEM_NONE, /*flags*/
+ _gl_deselect_callback,/*func*/
+ NULL);/*func_data*/
+ } else {
+ det = elm_genlist_item_append(
+ genlist,
+ &description_itc,
+ description_data,
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ _gl_deselect_callback,
+ NULL);
+ }
+ assertm_if(NULL == det, "NULL!!");
+
+ elm_genlist_item_select_mode_set(det, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ return det;
+}
+
+static void _ip_info_toggle_item_sel_cb(void* data, Evas_Object* obj,
+ void* event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (!data)
+ return;
+
+ ip_info_list_t *ip_info_list_data = (ip_info_list_t *)data;
+ wifi_ap_h ap = ip_info_list_data->ap;
+ elm_object_item_disabled_set(ip_info_list_data->ip_toggle_item, TRUE);
+ wifi_ip_config_type_e type = WIFI_IP_CONFIG_TYPE_NONE;
+ wifi_ap_get_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4, &type);
+ if (WIFI_IP_CONFIG_TYPE_STATIC == type) { /* Static IP */
+ char *ip_addr = NULL;
+
+ ip_info_save_data(ip_info_list_data);
+ _delete_static_ip_table(ip_info_list_data);
+
+ wifi_ap_get_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &ip_addr);
+ /* Dynamic IP Address */
+ ip_info_list_data->ip_addr_item =
+ _add_description(ip_info_list_data->genlist,
+ sc(ip_info_list_data->str_pkg_name, I18N_TYPE_IP_address),
+ ip_addr, ip_info_list_data->ip_toggle_item);
+ elm_object_item_disabled_set(ip_info_list_data->ip_addr_item, TRUE);
+ g_free(ip_addr);
+
+ wifi_ap_set_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4,
+ WIFI_IP_CONFIG_TYPE_DYNAMIC);
+ } else if (WIFI_IP_CONFIG_TYPE_DYNAMIC == type) { /* Dynamic IP */
+
+ elm_object_item_del(ip_info_list_data->ip_addr_item);
+ ip_info_list_data->ip_addr_item = NULL;
+
+ /* Create the entry layouts */
+ _create_static_ip_table(ip_info_list_data);
+ wifi_ap_set_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4,
+ WIFI_IP_CONFIG_TYPE_STATIC);
+ }
+ type = WIFI_IP_CONFIG_TYPE_NONE;
+ wifi_ap_get_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4, &type);
+ DEBUG_LOG(UG_NAME_NORMAL, "AP[0x%x] ip config type: %d", ap, type);
+ elm_genlist_item_update(ip_info_list_data->ip_toggle_item);
+ elm_object_item_disabled_set(ip_info_list_data->ip_toggle_item, FALSE);
+ ecore_idler_add( (Ecore_Task_Cb) _genlist_item_disable_later, event_info);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static Evas_Object *_ip_info_iptoggle_content_get(void *data,
+ Evas_Object *obj, const char *part)
+{
+ if (NULL == data || obj == NULL || part == NULL) {
+ return NULL;
+ }
+
+ ip_info_list_t *ip_info_list_data = (ip_info_list_t *)data;
+ wifi_ap_h ap = ip_info_list_data->ap;
+
+ Evas_Object *toggle_btn = elm_check_add(obj);
+ assertm_if(NULL == toggle_btn, "NULL!!");
+ elm_object_style_set(toggle_btn, "on&off");
+ evas_object_propagate_events_set(toggle_btn, EINA_TRUE);
+ wifi_ip_config_type_e type;
+ wifi_ap_get_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4, &type);
+ if (WIFI_IP_CONFIG_TYPE_STATIC == type) { /* Static IP */
+ elm_check_state_set(toggle_btn, EINA_TRUE);
+ } else {
+ elm_check_state_set(toggle_btn, EINA_FALSE);
+ }
+ return toggle_btn;
+}
+
+static void ip_info_print_values(wifi_ap_h ap)
+{
+ char *txt;
+ wifi_ip_config_type_e type = WIFI_IP_CONFIG_TYPE_NONE;
+ wifi_ap_get_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4, &type);
+ if (WIFI_IP_CONFIG_TYPE_STATIC == type) { /* Static IP */
+
+ DEBUG_LOG(UG_NAME_NORMAL, "* STATIC CONFIGURATION *");
+
+ /* IP Address */
+ wifi_ap_get_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ DEBUG_LOG(UG_NAME_NORMAL, "* IP address [%s]", txt);
+ g_free(txt);
+
+ /* Subnet Mask */
+ wifi_ap_get_subnet_mask(ap, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ DEBUG_LOG(UG_NAME_NORMAL, "* Subnet Mask [%s]", txt);
+ g_free(txt);
+
+ /* Gateway Address */
+ wifi_ap_get_gateway_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ DEBUG_LOG(UG_NAME_NORMAL, "* Gateway address [%s]", txt);
+ g_free(txt);
+
+ /* DNS 1 */
+ wifi_ap_get_dns_address(ap, 1, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ DEBUG_LOG(UG_NAME_NORMAL, "* DNS-1 address [%s]", txt);
+ g_free(txt);
+
+ /* DNS 2 */
+ wifi_ap_get_dns_address(ap, 2, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ DEBUG_LOG(UG_NAME_NORMAL, "* DNS-2 address [%s]", txt);
+ g_free(txt);
+
+ } else if (WIFI_IP_CONFIG_TYPE_DYNAMIC == type) { /* Dynamic IP */
+
+ DEBUG_LOG(UG_NAME_NORMAL, "* DYNAMIC CONFIGURATION *");
+
+ /* Dynamic IP Address */
+ wifi_ap_get_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ DEBUG_LOG(UG_NAME_NORMAL, "* IP address [%s]", txt);
+ g_free(txt);
+ }
+
+ /* Mac address */
+ wifi_get_mac_address(&txt);
+ DEBUG_LOG(UG_NAME_NORMAL, "* MAC address [%s]", txt);
+ g_free(txt);
+
+ txt = NULL;
+ wifi_ap_get_proxy_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &txt);
+ assertm_if(NULL == txt, "NULL!!");
+
+ if (!txt || !strlen(txt)) {
+ if (txt)
+ g_free(txt);
+ txt = g_strdup(DEFAULT_PROXY_ADDR);
+ }
+ /* Proxy Address */
+ char *proxy_addr = strtok(txt, ":");
+ DEBUG_LOG(UG_NAME_NORMAL, "* PROXY ADDR [%s]", proxy_addr);
+
+ /* Proxy port */
+ char *proxy_port = strtok(NULL, ":");
+ DEBUG_LOG(UG_NAME_NORMAL, "* PROXY PORT [%s]", proxy_port);
+ g_free(txt);
+
+}
+
+ip_info_list_t *ip_info_append_items(wifi_ap_h ap, const char *pkg_name,
+ Evas_Object *genlist, imf_ctxt_panel_cb_t input_panel_cb, void *input_panel_cb_data)
+{
+ __COMMON_FUNC_ENTER__;
+ int ret = WIFI_ERROR_NONE;
+ char *proxy_data = NULL;
+ char *proxy_addr = NULL;
+ char *proxy_port = NULL;
+ Elm_Object_Item* item = NULL;
+ common_utils_entry_info_t *edit_box_details;
+
+ assertm_if(NULL == ap, "NULL!!");
+ assertm_if(NULL == pkg_name, "NULL!!");
+ assertm_if(NULL == genlist, "NULL!!");
+
+ ip_info_list_t *ip_info_list_data = g_new0(ip_info_list_t, 1);
+ ip_info_list_data->ap = ap;
+ ip_info_list_data->str_pkg_name = pkg_name;
+ ip_info_list_data->genlist = genlist;
+ ip_info_list_data->input_panel_cb = input_panel_cb;
+ ip_info_list_data->input_panel_cb_data = input_panel_cb_data;
+
+ ip_toggle_itc.item_style = "dialogue/1text.1icon";
+ ip_toggle_itc.func.text_get = _ip_info_iptoggle_text_get;
+ ip_toggle_itc.func.content_get = _ip_info_iptoggle_content_get;
+ ip_toggle_itc.func.state_get = NULL;
+ ip_toggle_itc.func.del = NULL;
+
+ description_itc.item_style = "dialogue/2text.3";
+ description_itc.func.text_get = _ip_info_detail_description_text_get;
+ description_itc.func.content_get = NULL;
+ description_itc.func.state_get = NULL;
+ description_itc.func.del = _ip_info_detail_description_del;
+
+ ip_entry_itc.item_style = "dialogue/1icon";
+ ip_entry_itc.func.text_get = NULL;
+ ip_entry_itc.func.content_get = _ip_info_entry_item_content_get;
+ ip_entry_itc.func.state_get = NULL;
+ ip_entry_itc.func.del = _ip_info_entry_item_del;
+
+ common_utils_add_dialogue_separator(genlist, "dialogue/separator.2");
+
+ /* Static/Dynamic switch button */
+ ip_info_list_data->ip_toggle_item =
+ elm_genlist_item_append(genlist,
+ &ip_toggle_itc, ip_info_list_data, NULL, ELM_GENLIST_ITEM_NONE,
+ _ip_info_toggle_item_sel_cb, ip_info_list_data);
+
+ /* IP address */
+ wifi_ip_config_type_e type = WIFI_IP_CONFIG_TYPE_NONE;
+ wifi_ap_get_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4, &type);
+ if (WIFI_IP_CONFIG_TYPE_STATIC == type) { /* Static IP */
+ /* Create the entry layouts */
+ _create_static_ip_table(ip_info_list_data);
+ } else if (WIFI_IP_CONFIG_TYPE_DYNAMIC == type) { /* Dynamic IP */
+ char *ip_addr = NULL;
+ /* Dynamic IP Address */
+ wifi_ap_get_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &ip_addr);
+ ip_info_list_data->ip_addr_item =
+ _add_description(genlist,
+ sc(ip_info_list_data->str_pkg_name, I18N_TYPE_IP_address),
+ ip_addr, NULL);
+ elm_object_item_disabled_set(ip_info_list_data->ip_addr_item, TRUE);
+ g_free(ip_addr);
+ }
+
+ common_utils_add_dialogue_separator(genlist, "dialogue/separator.2");
+
+#if 0
+ /* Channel Number */
+ int channel_number;
+ wifi_ap_get_frequency(ap, &channel_number);
+ char *channel_num_str = g_strdup_printf("%u", channel_number);
+ _add_description(genlist,
+ sc(ip_info_list_data->str_pkg_name, I18N_TYPE_Channel), channel_num_str,
+ NULL);
+ g_free(channel_num_str);
+#endif
+ /* Mac address */
+ char *mac_addr = NULL;
+ wifi_get_mac_address(&mac_addr);
+ item =
+ _add_description(genlist,
+ sc(ip_info_list_data->str_pkg_name, I18N_TYPE_MAC_addr), mac_addr,
+ NULL);
+ elm_object_item_disabled_set(item, TRUE);
+ g_free(mac_addr);
+
+ ret = wifi_ap_get_proxy_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &proxy_data);
+ assertm_if(NULL == proxy_data, "NULL!!");
+
+ if (WIFI_ERROR_NONE == ret && proxy_data && strlen(proxy_data)) {
+ DEBUG_LOG(UG_NAME_NORMAL, "* PROXY DATA [%s]", proxy_data);
+ /* Proxy Address */
+ proxy_addr = g_strdup(strtok(proxy_data, ":"));
+ DEBUG_LOG(UG_NAME_NORMAL, "* PROXY ADDR [%s]", proxy_addr);
+
+ /* Proxy port */
+ proxy_port = g_strdup(strtok(NULL, ":"));
+ DEBUG_LOG(UG_NAME_NORMAL, "* PROXY PORT [%s]", proxy_port);
+ } else {
+ ERROR_LOG(UG_NAME_ERR, "Error = %d", ret);
+ }
+
+ edit_box_details = g_new0(common_utils_entry_info_t, 1);
+ edit_box_details->entry_id = ENTRY_TYPE_PROXY_ADDR;
+ edit_box_details->title_txt = sc(pkg_name, I18N_TYPE_Proxy_address);
+ edit_box_details->entry_txt = proxy_addr;
+ edit_box_details->input_panel_cb = input_panel_cb;
+ edit_box_details->input_panel_cb_data = input_panel_cb_data;
+ ip_info_list_data->proxy_addr_item = elm_genlist_item_append(genlist, &ip_entry_itc, edit_box_details, NULL, ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ elm_genlist_item_select_mode_set(ip_info_list_data->proxy_addr_item, ELM_OBJECT_SELECT_MODE_NONE);
+
+ edit_box_details = g_new0(common_utils_entry_info_t, 1);
+ edit_box_details->entry_id = ENTRY_TYPE_PROXY_PORT;
+ edit_box_details->title_txt = sc(pkg_name, I18N_TYPE_Proxy_port);
+ edit_box_details->entry_txt = proxy_port;
+ edit_box_details->input_panel_cb = input_panel_cb;
+ edit_box_details->input_panel_cb_data = input_panel_cb_data;
+ ip_info_list_data->proxy_port_item = elm_genlist_item_append(genlist, &ip_entry_itc, edit_box_details, NULL, ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ elm_genlist_item_select_mode_set(ip_info_list_data->proxy_port_item, ELM_OBJECT_SELECT_MODE_NONE);
+
+ g_free(proxy_data);
+
+ __COMMON_FUNC_EXIT__;
+ return ip_info_list_data;
+}
+
+void ip_info_save_data(ip_info_list_t *ip_info_list_data)
+{
+ __COMMON_FUNC_ENTER__;
+ assertm_if(NULL == ip_info_list_data, "NULL!!");
+ char* txt = NULL;
+ char* proxy_addr = NULL;
+ char* proxy_port = NULL;
+ wifi_ap_h ap = ip_info_list_data->ap;
+
+ wifi_ip_config_type_e type = WIFI_IP_CONFIG_TYPE_NONE;
+ wifi_ap_get_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4, &type);
+ if (WIFI_IP_CONFIG_TYPE_STATIC == type) { /* Static IP */
+ txt = common_utils_get_list_item_entry_txt(ip_info_list_data->ip_addr_item);
+ DEBUG_LOG(UG_NAME_NORMAL, "IP [%s]", txt);
+ wifi_ap_set_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, txt);
+ g_free(txt);
+
+ txt =
+ common_utils_get_list_item_entry_txt(ip_info_list_data->subnet_mask_item);
+ DEBUG_LOG(UG_NAME_NORMAL, "Subnet [%s]", txt);
+ wifi_ap_set_subnet_mask(ap, WIFI_ADDRESS_FAMILY_IPV4, txt);
+ g_free(txt);
+
+ txt =
+ common_utils_get_list_item_entry_txt(ip_info_list_data->gateway_addr_item);
+ DEBUG_LOG(UG_NAME_NORMAL, "Gateway [%s]", txt);
+ wifi_ap_set_gateway_address(ap, WIFI_ADDRESS_FAMILY_IPV4, txt);
+ g_free(txt);
+
+ txt =
+ common_utils_get_list_item_entry_txt(ip_info_list_data->dns_1_item);
+ DEBUG_LOG(UG_NAME_NORMAL, "DNS1 [%s]", txt);
+ wifi_ap_set_dns_address(ap, 1, WIFI_ADDRESS_FAMILY_IPV4, txt);
+ g_free(txt);
+
+ txt =
+ common_utils_get_list_item_entry_txt(ip_info_list_data->dns_2_item);
+ DEBUG_LOG(UG_NAME_NORMAL, "DNS2 [%s]", txt);
+ wifi_ap_set_dns_address(ap, 2, WIFI_ADDRESS_FAMILY_IPV4, txt);
+ g_free(txt);
+ }
+ proxy_addr =
+ common_utils_get_list_item_entry_txt(ip_info_list_data->proxy_addr_item);
+ proxy_port =
+ common_utils_get_list_item_entry_txt(ip_info_list_data->proxy_port_item);
+ txt = g_strdup_printf("%s:%s", proxy_addr?proxy_addr:"", proxy_port?proxy_port:"");
+ DEBUG_LOG( UG_NAME_NORMAL, "Proxy addr:port [%s]", txt);
+ wifi_ap_set_proxy_type(ap, WIFI_PROXY_TYPE_MANUAL);
+ wifi_ap_set_proxy_address(ap, WIFI_ADDRESS_FAMILY_IPV4, txt);
+ g_free((gpointer)proxy_addr);
+ g_free((gpointer)proxy_port);
+ g_free((gpointer)txt);
+
+ ip_info_print_values(ap);
+
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+void ip_info_remove(ip_info_list_t *ip_info_list)
+{
+ __COMMON_FUNC_ENTER__;
+ assertm_if(NULL == ip_info_list, "NULL!!");
+ _delete_static_ip_table(ip_info_list);
+ g_free(ip_info_list);
+ __COMMON_FUNC_EXIT__;
+}
diff --git a/sources/libraries/Common/common_pswd_popup.c b/sources/libraries/Common/common_pswd_popup.c
new file mode 100644
index 0000000..0b32b6b
--- /dev/null
+++ b/sources/libraries/Common/common_pswd_popup.c
@@ -0,0 +1,365 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "common.h"
+#include "common_pswd_popup.h"
+#include "i18nmanager.h"
+#include "common_utils.h"
+#include "ug_wifi.h"
+
+#define PBC_TIMEOUT_MSG_STR "one click connection failed"
+#define MAX_PBC_TIMEOUT_SECS 120 // Time in seconds
+
+typedef struct {
+ /* PBC popup related attributes */
+ Evas_Object* popup;
+ Evas_Object* progressbar;
+ Evas_Object* timer_label;
+ Ecore_Timer *timer;
+ int checker;
+ double value;
+} pbc_popup_t;
+
+struct pswd_popup {
+ /* Password popup related attributes */
+ const char *str_pkg_name;
+ Evas_Object *win;
+ Evas_Object *popup;
+ Evas_Object *popup_entry_lyt;
+ pbc_popup_t *pbc_popup_data;
+ wifi_ap_h ap;
+};
+
+static void __popup_entry_changed_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ if (elm_object_focus_get(data)) {
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+ else
+ elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
+ }
+}
+
+static void __popup_entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (!elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
+ elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
+}
+
+static void __popup_entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,guidetext,show", "elm");
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+}
+
+static void __popup_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ elm_entry_entry_set(data, "");
+}
+
+static void _check_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (obj == NULL)
+ return;
+
+ Eina_Bool state = elm_check_state_get(obj);
+ common_utils_entry_password_set(data, !state);
+}
+
+static void __common_pbc_popup_destroy(pbc_popup_t *pbc_popup_data)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!pbc_popup_data)
+ return;
+
+ if (pbc_popup_data->checker == 0) {
+ pbc_popup_data->checker = 1;
+
+ if (pbc_popup_data->timer != NULL) {
+ ecore_timer_del(pbc_popup_data->timer);
+ pbc_popup_data->timer = NULL;
+ }
+ if (pbc_popup_data->popup != NULL) {
+ evas_object_hide(pbc_popup_data->popup);
+ evas_object_del(pbc_popup_data->popup);
+ pbc_popup_data->popup = NULL;
+ }
+ g_free(pbc_popup_data);
+ }
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+static Eina_Bool _fn_pb_timer_bar(void *data)
+{
+ pswd_popup_t *pswd_popup_data = (pswd_popup_t *)data;
+ pbc_popup_t *pbc_popup_data = pswd_popup_data->pbc_popup_data;
+ if (!pbc_popup_data || pbc_popup_data->timer == NULL || pbc_popup_data->progressbar == NULL) {
+ return ECORE_CALLBACK_CANCEL;
+ }
+ const double diff = (double)1/(double)MAX_PBC_TIMEOUT_SECS;
+ pbc_popup_data->value = elm_progressbar_value_get(pbc_popup_data->progressbar);
+ pbc_popup_data->value += diff;
+ if (pbc_popup_data->value >= 1) {
+ if (pbc_popup_data->checker == 0) {
+ __COMMON_FUNC_ENTER__;
+ common_utils_show_info_timeout_popup(pswd_popup_data->win, PBC_TIMEOUT_MSG_STR, 3.0f);
+ Evas_Object *cancel_btn = elm_object_part_content_get(pbc_popup_data->popup, "button1");
+ evas_object_smart_callback_call(cancel_btn, "clicked", NULL);
+ __COMMON_FUNC_EXIT__;
+ }
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ int remain_mins = (int)(MAX_PBC_TIMEOUT_SECS * (1 - pbc_popup_data->value));
+ int remain_secs = 0;
+ remain_secs = remain_mins % 60;
+ remain_mins /= 60;
+
+ char *remaining_time_str = g_strdup_printf("<font_size=40><align=center>%02d:%02d</align></font_size>", remain_mins, remain_secs);
+ elm_object_text_set(pbc_popup_data->timer_label, remaining_time_str);
+ //INFO_LOG(UG_NAME_NORMAL, "pbc_popup_data->value = %lf; remain_mins = %d; remain_secs = %d; remaining_time_str = %s", pbc_popup_data->value, remain_mins, remain_secs, remaining_time_str);
+ g_free(remaining_time_str);
+
+ elm_progressbar_value_set(pbc_popup_data->progressbar, pbc_popup_data->value);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool _enable_scan_updates_cb(void *data)
+{
+ /* Lets enable the scan updates */
+ wlan_manager_enable_scan_result_update();
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void common_pswd_popup_pbc_popup_create(pswd_popup_t *pswd_popup_data, Evas_Smart_Cb cancel_cb, void *cancel_cb_data)
+{
+ if (!pswd_popup_data) {
+ return;
+ }
+ Evas_Object *popup = NULL,*progressbar = NULL;
+ Evas_Object *label = NULL, *timer_label = NULL;
+ Evas_Object *separator1 = NULL, *separator2 = NULL;
+
+ pbc_popup_t *pbc_popup_data = NULL;
+ pbc_popup_data = g_new0(pbc_popup_t, 1);
+
+ popup_btn_info_t popup_btn_data;
+ memset(&popup_btn_data, 0, sizeof(popup_btn_data));
+ popup_btn_data.btn1_txt = sc(pswd_popup_data->str_pkg_name, I18N_TYPE_Cancel);
+ popup_btn_data.btn1_cb = cancel_cb;
+ popup_btn_data.btn1_data = cancel_cb_data;
+ popup = common_utils_show_info_popup(pswd_popup_data->win, &popup_btn_data);
+
+ label = elm_label_add(popup);
+ elm_object_style_set(label, "popup/default");
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ elm_object_text_set(label, sc(pswd_popup_data->str_pkg_name,I18N_TYPE_Press_WPS_On_Your_Wi_Fi_Access_Point));
+ evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(label);
+
+ separator1 = elm_separator_add(popup);
+
+ progressbar = elm_progressbar_add(popup);
+ elm_object_style_set(progressbar, "list_progress");
+ elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
+ evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_progressbar_value_set(progressbar, 0.0);
+
+ separator2 = elm_separator_add(popup);
+
+ timer_label = elm_label_add(popup);
+ elm_object_style_set(timer_label, "label3");
+ elm_label_line_wrap_set(timer_label, ELM_WRAP_MIXED);
+ elm_object_text_set(timer_label, _("<font_size=40><align=center>02:00</align></font_size>"));
+ evas_object_size_hint_weight_set(timer_label, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(timer_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(timer_label);
+
+ pbc_popup_data->checker = 0;
+ pbc_popup_data->value = 0.0;
+ pbc_popup_data->progressbar = progressbar;
+ pbc_popup_data->timer_label = timer_label;
+ pbc_popup_data->popup = popup;
+ pbc_popup_data->timer = ecore_timer_add(1.0, _fn_pb_timer_bar, pswd_popup_data);
+ evas_object_show(progressbar);
+
+ Evas_Object *box = elm_box_add(popup);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(box);
+ elm_box_pack_end(box, label);
+ elm_box_pack_end(box, separator1);
+ elm_box_pack_end(box, progressbar);
+ elm_box_pack_end(box, separator2);
+ elm_box_pack_end(box, timer_label);
+
+ evas_object_show(box);
+ elm_object_content_set(popup, box);
+ pswd_popup_data->pbc_popup_data = pbc_popup_data;
+
+ /* Delete the password popup */
+ evas_object_hide(pswd_popup_data->popup);
+ evas_object_del(pswd_popup_data->popup);
+
+ return;
+}
+
+pswd_popup_t *common_pswd_popup_create(Evas_Object *win_main, const char *pkg_name, pswd_popup_create_req_data_t *popup_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (!win_main || !popup_info || !pkg_name)
+ return NULL;
+
+ pswd_popup_t *pswd_popup_data = g_new0(pswd_popup_t, 1);
+
+ if (popup_info->ap) {
+ if (WIFI_ERROR_NONE != wifi_ap_clone(&(pswd_popup_data->ap), popup_info->ap)) {
+ g_free(pswd_popup_data);
+ return NULL;
+ }
+ } else {
+ /* It can be NULL in case of hidden AP */
+ }
+ /* Lets disable the scan updates so that the UI is not refreshed un necessarily */
+ wlan_manager_disable_scan_result_update();
+
+ popup_btn_info_t popup_btn_data;
+ memset(&popup_btn_data, 0, sizeof(popup_btn_data));
+ popup_btn_data.title_txt = popup_info->title;
+ popup_btn_data.btn1_cb = popup_info->ok_cb;
+ popup_btn_data.btn1_data = popup_info->cb_data;
+ popup_btn_data.btn2_cb = popup_info->cancel_cb;
+ popup_btn_data.btn2_data = popup_info->cb_data;
+ popup_btn_data.btn1_txt = sc(pkg_name, I18N_TYPE_Ok);
+ popup_btn_data.btn2_txt = sc(pkg_name, I18N_TYPE_Cancel);
+ Evas_Object *passpopup = common_utils_show_info_popup(win_main, &popup_btn_data);
+
+ Evas_Object *box = elm_box_add(passpopup);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(box);
+
+ Evas_Object *entry_ly = elm_layout_add(box);
+ Evas_Object *entry = NULL;
+ Elm_Entry_Filter_Limit_Size limit_filter_data;
+
+ elm_layout_file_set(entry_ly, CUSTOM_EDITFIELD_PATH, "custom_editfield");
+ evas_object_size_hint_weight_set(entry_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(entry_ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_text_set(entry_ly, "elm.text", sc(pkg_name, I18N_TYPE_Enter_password));
+
+ entry = elm_entry_add(entry_ly);
+ elm_entry_scrollable_set(entry, EINA_TRUE);
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_PASSWORD);
+ elm_object_part_content_set(entry_ly, "elm.swallow.content", entry);
+
+ limit_filter_data.max_char_count = 32;
+ elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data);
+
+ evas_object_smart_callback_add(entry, "changed", __popup_entry_changed_cb, entry_ly);
+ evas_object_smart_callback_add(entry, "focused", __popup_entry_focused_cb, entry_ly);
+ evas_object_smart_callback_add(entry, "unfocused", __popup_entry_unfocused_cb, entry_ly);
+ elm_object_signal_callback_add(entry_ly, "elm,eraser,clicked", "elm", __popup_eraser_clicked_cb, entry);
+ evas_object_show(entry);
+
+ elm_entry_password_set(entry, EINA_TRUE);
+ evas_object_show(entry_ly);
+ elm_box_pack_end(box, entry_ly);
+
+ Evas_Object *check = elm_check_add(box);
+ elm_object_text_set(check, sc(pkg_name, I18N_TYPE_Show_password));
+ elm_object_focus_allow_set(check, EINA_FALSE);
+ evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(check, "changed", _check_changed_cb, entry_ly);
+
+ evas_object_show(check);
+ elm_box_pack_end(box, check);
+
+ if (popup_info->show_wps_btn) {
+ Evas_Object *btn = elm_button_add(box);
+ elm_object_text_set(btn, sc(pkg_name, I18N_TYPE_WPS_Button_Connection));
+ evas_object_size_hint_weight_set(btn,
+ EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn,
+ EVAS_HINT_FILL,
+ EVAS_HINT_FILL);
+ evas_object_smart_callback_add(btn, "clicked", popup_info->wps_btn_cb, popup_info->cb_data);
+ elm_box_pack_end(box, btn);
+ evas_object_show(btn);
+ }
+
+ elm_object_content_set(passpopup, box);
+ evas_object_show(passpopup);
+ pswd_popup_data->win = win_main;
+ pswd_popup_data->str_pkg_name = pkg_name;
+ pswd_popup_data->popup = passpopup;
+ pswd_popup_data->popup_entry_lyt = entry_ly;
+ elm_object_focus_set(entry, EINA_TRUE);
+
+ __COMMON_FUNC_EXIT__;
+
+ return pswd_popup_data;
+}
+
+char *common_pswd_popup_get_txt(pswd_popup_t *pswd_popup_data)
+{
+ if (pswd_popup_data)
+ return common_utils_entry_layout_get_text(pswd_popup_data->popup_entry_lyt);
+
+ return NULL;
+}
+
+wifi_ap_h common_pswd_popup_get_ap(pswd_popup_t *pswd_popup_data)
+{
+ if (pswd_popup_data)
+ return pswd_popup_data->ap;
+
+ return NULL;
+}
+
+void common_pswd_popup_destroy(pswd_popup_t *pswd_popup_data)
+{
+ if (pswd_popup_data) {
+ if (pswd_popup_data->pbc_popup_data) {
+ __common_pbc_popup_destroy(pswd_popup_data->pbc_popup_data);
+ pswd_popup_data->pbc_popup_data = NULL;
+ }
+ evas_object_hide(pswd_popup_data->popup);
+ evas_object_del(pswd_popup_data->popup);
+ pswd_popup_data->popup = NULL;
+ pswd_popup_data->popup_entry_lyt = NULL;
+ wifi_ap_destroy(pswd_popup_data->ap);
+ g_free(pswd_popup_data);
+
+ /* A delay is needed to get the smooth Input panel closing animation effect */
+ ecore_timer_add(0.1, _enable_scan_updates_cb, NULL);
+ }
+ return;
+}
diff --git a/sources/libraries/Common/common_utils.c b/sources/libraries/Common/common_utils.c
new file mode 100644
index 0000000..a6413da
--- /dev/null
+++ b/sources/libraries/Common/common_utils.c
@@ -0,0 +1,458 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <vconf.h>
+#include <syspopup_caller.h>
+
+#include <aul.h>
+#include "common.h"
+#include "common_utils.h"
+#include "i18nmanager.h"
+
+#define POPUP_HEAD_AREA 134
+#define POPUP_BUTTON_AREA 80
+
+typedef struct {
+ char *title_str;
+ char *info_str;
+} two_line_disp_data_t;
+
+static char *__common_utils_2line_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ two_line_disp_data_t *item_data = (two_line_disp_data_t *)data;
+ if (!strcmp(part, "elm.text.1")) {
+ return g_strdup(item_data->info_str);
+ } else if (!strcmp(part, "elm.text.2")) {
+ return g_strdup(item_data->title_str);
+ }
+ return NULL;
+}
+
+static void __common_utils_2line_text_del(void *data, Evas_Object *obj)
+{
+ two_line_disp_data_t *item_data = (two_line_disp_data_t *)data;
+ if (item_data) {
+ g_free(item_data->info_str);
+ g_free(item_data->title_str);
+ g_free(item_data);
+ }
+}
+
+static void __common_utils_separator_del(void *data, Evas_Object *obj)
+{
+ elm_genlist_item_class_free(data);
+ return;
+}
+
+Elm_Object_Item* common_utils_add_dialogue_separator(Evas_Object* genlist, const char *separator_style)
+{
+ assertm_if(NULL == genlist, "NULL!!");
+
+ static Elm_Genlist_Item_Class *separator_itc;
+ separator_itc = elm_genlist_item_class_new();
+ separator_itc->item_style = separator_style;
+ separator_itc->func.text_get = NULL;
+ separator_itc->func.content_get = NULL;
+ separator_itc->func.state_get = NULL;
+ separator_itc->func.del = __common_utils_separator_del;
+
+ Elm_Object_Item* sep = elm_genlist_item_append(
+ genlist,
+ separator_itc,
+ separator_itc,
+ NULL,
+ ELM_GENLIST_ITEM_GROUP,
+ NULL,
+ NULL);
+
+ assertm_if(NULL == sep, "NULL!!");
+
+ elm_genlist_item_select_mode_set(sep, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ return sep;
+}
+
+char *common_utils_get_ap_security_type_info_txt(const char *pkg_name, wifi_device_info_t *device_info)
+{
+ char *status_txt = NULL;
+ switch (device_info->security_mode)
+ {
+ case WLAN_SEC_MODE_NONE: /** Security disabled */
+ status_txt = g_strdup(sc(pkg_name, I18N_TYPE_Open));
+ break;
+ case WLAN_SEC_MODE_IEEE8021X: /** EAP */
+ status_txt = g_strdup_printf("%s (%s)", sc(pkg_name, I18N_TYPE_Secured), sc(pkg_name, I18N_TYPE_EAP));
+ break;
+ case WLAN_SEC_MODE_WEP: /** WEP */
+ case WLAN_SEC_MODE_WPA_PSK: /** WPA-PSK */
+ case WLAN_SEC_MODE_WPA2_PSK: /** WPA2-PSK */
+ if (TRUE == device_info->wps_mode) {
+ status_txt = g_strdup_printf("%s (%s)", sc(pkg_name, I18N_TYPE_Secured), sc(pkg_name, I18N_TYPE_WPS_Available));
+ } else {
+ status_txt = g_strdup(sc(pkg_name, I18N_TYPE_Secured));
+ }
+ break;
+ default: /** Unknown */
+ status_txt = g_strdup(WIFI_UNKNOWN_DEVICE_STATUS_STR);
+ break;
+ }
+ return status_txt;
+}
+
+char *common_utils_get_device_icon(const char *image_path_dir, wifi_device_info_t *device_info)
+{
+ char tmp_str[MAX_DEVICE_ICON_PATH_STR_LEN] = {'\0', };
+ char *ret;
+
+ g_strlcpy(tmp_str, image_path_dir, sizeof(tmp_str));
+ g_strlcat(tmp_str, "/37_wifi_icon", sizeof(tmp_str));
+
+ if (device_info->security_mode != WLAN_SEC_MODE_NONE) {
+ g_strlcat(tmp_str, "_lock", sizeof(tmp_str));
+ }
+
+ switch (wlan_manager_get_signal_strength(device_info->rssi)) {
+ case SIGNAL_STRENGTH_TYPE_EXCELLENT:
+ g_strlcat(tmp_str, "_03", sizeof(tmp_str));
+ break;
+ case SIGNAL_STRENGTH_TYPE_GOOD:
+ g_strlcat(tmp_str, "_02", sizeof(tmp_str));
+ break;
+ case SIGNAL_STRENGTH_TYPE_WEAK:
+ g_strlcat(tmp_str, "_01", sizeof(tmp_str));
+ break;
+ case SIGNAL_STRENGTH_TYPE_VERY_WEAK:
+ case SIGNAL_STRENGTH_TYPE_NULL:
+ default:
+ g_strlcat(tmp_str, "_00", sizeof(tmp_str));
+ break;
+ }
+
+ /* Adding .png to the end of file */
+ g_strlcat(tmp_str, ".png", sizeof(tmp_str));
+
+ ret = g_strdup(tmp_str);
+ return ret;
+}
+
+Evas_Object *common_utils_entry_layout_get_entry(Evas_Object *layout)
+{
+ return elm_object_part_content_get(layout, "elm.swallow.content");
+}
+
+char *common_utils_entry_layout_get_text(Evas_Object *layout)
+{
+ Evas_Object *entry = elm_object_part_content_get(layout, "elm.swallow.content");
+ return elm_entry_markup_to_utf8(elm_entry_entry_get(entry));
+}
+
+void common_utils_entry_password_set(Evas_Object *layout, Eina_Bool pswd_set)
+{
+ Evas_Object *entry = elm_object_part_content_get(layout, "elm.swallow.content");
+ elm_entry_password_set(entry, pswd_set);
+}
+
+void __common_popup_size_get(Ecore_IMF_Context *target_imf, int *width, int *height)
+{
+ __COMMON_FUNC_ENTER__;
+
+ int window_width, window_height;
+ int start_x, start_y, imf_width, imf_height;
+ int rotate_angle;
+ float resize_scale = 0.7f;
+
+ rotate_angle = common_utils_get_rotate_angle(APPCORE_RM_UNKNOWN);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &window_width, &window_height);
+
+ *width = window_width;
+
+ if (rotate_angle == 0 || rotate_angle == 180)
+ {
+ *height = window_height * resize_scale;
+ }else
+ *height = window_width;
+
+ if (target_imf != NULL) {
+ ecore_imf_context_input_panel_geometry_get(target_imf, &start_x, &start_y, &imf_width, &imf_height);
+ *height = start_y * resize_scale;
+ }
+
+ *height = *height-POPUP_HEAD_AREA-POPUP_BUTTON_AREA;
+
+ __COMMON_FUNC_EXIT__;
+}
+
+void common_utils_set_edit_box_imf_panel_evnt_cb(Elm_Object_Item *item,
+ imf_ctxt_panel_cb_t input_panel_cb, void *user_data)
+{
+ __COMMON_FUNC_ENTER__;
+ common_utils_entry_info_t *entry_info;
+ entry_info = elm_object_item_data_get(item);
+ if (!entry_info)
+ return;
+
+ entry_info->input_panel_cb = input_panel_cb;
+ entry_info->input_panel_cb_data = user_data;
+ Evas_Object *entry = common_utils_entry_layout_get_entry(entry_info->layout);
+ Ecore_IMF_Context *imf_ctxt = elm_entry_imf_context_get(entry);
+ if (imf_ctxt) {
+ ecore_imf_context_input_panel_event_callback_add(imf_ctxt, ECORE_IMF_INPUT_PANEL_STATE_EVENT, entry_info->input_panel_cb, entry_info->input_panel_cb_data);
+ DEBUG_LOG(UG_NAME_NORMAL, "set the imf ctxt cbs");
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+Elm_Object_Item *common_utils_add_2_line_txt_disabled_item(Evas_Object* view_list, const char *style_name, const char *line1_txt, const char *line2_txt)
+{
+ static Elm_Genlist_Item_Class two_line_display_itc;
+ two_line_disp_data_t *two_line_data = NULL;
+ Elm_Object_Item *item = NULL;
+
+ two_line_display_itc.item_style = style_name;
+ two_line_display_itc.func.text_get = __common_utils_2line_text_get;
+ two_line_display_itc.func.content_get = NULL;
+ two_line_display_itc.func.state_get = NULL;
+ two_line_display_itc.func.del = __common_utils_2line_text_del;
+
+ two_line_data = g_new0(two_line_disp_data_t, 1);
+ two_line_data->title_str = g_strdup(line1_txt);
+ two_line_data->info_str = g_strdup(line2_txt);
+ INFO_LOG(UG_NAME_NORMAL, "title_str = %s info_str = %s", two_line_data->title_str, two_line_data->info_str);
+
+ item = elm_genlist_item_append(view_list, &two_line_display_itc, two_line_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_object_item_disabled_set(item, TRUE);
+
+ return item;
+}
+
+char *common_utils_get_list_item_entry_txt(Elm_Object_Item *entry_item)
+{
+ common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)elm_object_item_data_get(entry_item);
+ if (entry_info == NULL)
+ return NULL;
+
+ DEBUG_LOG(UG_NAME_NORMAL, "entry_info = 0x%x", entry_info);
+
+ if (entry_info->entry_txt)
+ return g_strdup(entry_info->entry_txt);
+ else
+ return NULL;
+}
+
+Evas_Object *common_utils_create_radio_button(Evas_Object *parent, const int value)
+{
+ Evas_Object *radio = elm_radio_add(parent);
+ elm_radio_state_value_set(radio, value);
+// elm_radio_group_add(radio, radio_main);
+ evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ return radio;
+}
+
+Evas_Object *common_utils_create_layout(Evas_Object *navi_frame)
+{
+ Evas_Object *layout;
+ layout = elm_layout_add(navi_frame);
+ elm_layout_theme_set(layout, "layout", "application", "noindicator");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ Evas_Object* bg = elm_bg_add(layout);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_style_set(bg, "group_list");
+ elm_object_part_content_set(layout, "elm.swallow.bg", bg);
+
+ evas_object_show(layout);
+
+ return layout;
+}
+
+Evas_Object *common_utils_show_info_popup(Evas_Object *parent, popup_btn_info_t *popup_data)
+{
+ __COMMON_FUNC_ENTER__;
+ Evas_Object *popup = elm_popup_add(parent);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ if (popup_data->title_txt)
+ elm_object_part_text_set(popup, "title,text", popup_data->title_txt);
+ if (popup_data->info_txt)
+ elm_object_text_set(popup, popup_data->info_txt);
+ if (popup_data->btn1_txt) {
+ Evas_Object *btn_1 = elm_button_add(popup);
+ elm_object_text_set(btn_1, popup_data->btn1_txt);
+ elm_object_part_content_set(popup, "button1", btn_1);
+ if (popup_data->btn1_cb) {
+ evas_object_smart_callback_add(btn_1, "clicked", popup_data->btn1_cb, popup_data->btn1_data);
+ } else { // set the default callback
+ evas_object_smart_callback_add(btn_1, "clicked", (Evas_Smart_Cb)evas_object_del, popup);
+ }
+ }
+ if (popup_data->btn2_txt) {
+ Evas_Object *btn_2 = elm_button_add(popup);
+ elm_object_text_set(btn_2, popup_data->btn2_txt);
+ elm_object_part_content_set(popup, "button2", btn_2);
+ evas_object_smart_callback_add(btn_2, "clicked", popup_data->btn2_cb, NULL);
+ evas_object_show(popup);
+ if (popup_data->btn2_cb) {
+ evas_object_smart_callback_add(btn_2, "clicked", popup_data->btn2_cb, popup_data->btn2_data);
+ } else { // set the default callback
+ evas_object_smart_callback_add(btn_2, "clicked", (Evas_Smart_Cb)evas_object_del, popup);
+ }
+ }
+ evas_object_show(popup);
+
+ return popup;
+}
+
+Evas_Object *common_utils_show_info_ok_popup(Evas_Object *win,
+ const char *str_pkg_name, const char *info_txt)
+{
+ popup_btn_info_t popup_data;
+
+ memset(&popup_data, 0, sizeof(popup_data));
+ popup_data.info_txt = (char *)info_txt;
+ popup_data.btn1_txt = sc(str_pkg_name, I18N_TYPE_Ok);
+
+ return common_utils_show_info_popup(win, &popup_data);
+}
+
+Evas_Object *common_utils_show_info_timeout_popup(Evas_Object *win,
+ const char* info_text, const double timeout)
+{
+ Evas_Object *popup = elm_popup_add(win);
+
+ elm_object_text_set(popup, info_text);
+ elm_popup_timeout_set(popup, timeout);
+ evas_object_smart_callback_add(popup, "timeout",
+ (Evas_Smart_Cb)evas_object_del, popup);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
+ evas_object_show(popup);
+
+ return popup;
+}
+
+int common_utils_get_rotate_angle(enum appcore_rm rotate_mode)
+{
+ int rotate_angle;
+ if (APPCORE_RM_UNKNOWN == rotate_mode) {
+ appcore_get_rotation_state(&rotate_mode);
+ }
+
+ DEBUG_LOG(SP_NAME_NORMAL, "rotate_mode = %d", rotate_mode);
+
+ switch (rotate_mode) {
+ case APPCORE_RM_PORTRAIT_NORMAL: /**< Portrait mode */
+ DEBUG_LOG(SP_NAME_NORMAL, "rotate mode is APPCORE_RM_PORTRAIT_NORMAL");
+ rotate_angle = 0;
+ break;
+
+ case APPCORE_RM_PORTRAIT_REVERSE: /**< Portrait upside down mode */
+ DEBUG_LOG(SP_NAME_NORMAL, "rotate mode is APPCORE_RM_PORTRAIT_REVERSE");
+ rotate_angle = 180;
+ break;
+
+ case APPCORE_RM_LANDSCAPE_NORMAL: /**< Left handed landscape mode */
+ DEBUG_LOG(SP_NAME_NORMAL, "rotate mode is APPCORE_RM_LANDSCAPE_NORMAL");
+ rotate_angle = 270;
+ break;
+
+ case APPCORE_RM_LANDSCAPE_REVERSE: /**< Right handed landscape mode */
+ DEBUG_LOG(SP_NAME_NORMAL, "rotate mode is APPCORE_RM_LANDSCAPE_REVERSE");
+ rotate_angle = 90;
+ break;
+
+ default:
+ ERROR_LOG(SP_NAME_ERR, "Invalid rotate mode. The default value (0) is set to 'rotate_angle'.");
+ rotate_angle = 0;
+ break;
+ }
+
+ return rotate_angle;
+}
+
+wlan_security_mode_type_t common_utils_get_sec_mode(wifi_security_type_e sec_type)
+{
+ switch (sec_type) {
+ case WIFI_SECURITY_TYPE_NONE:
+ return WLAN_SEC_MODE_NONE;
+ case WIFI_SECURITY_TYPE_WEP:
+ return WLAN_SEC_MODE_WEP;
+ case WIFI_SECURITY_TYPE_WPA_PSK:
+ return WLAN_SEC_MODE_WPA_PSK;
+ case WIFI_SECURITY_TYPE_WPA2_PSK:
+ return WLAN_SEC_MODE_WPA_PSK;
+ case WIFI_SECURITY_TYPE_EAP:
+ return WLAN_SEC_MODE_IEEE8021X;
+ default:
+ return WLAN_SEC_MODE_NONE;
+ }
+ return WLAN_SEC_MODE_NONE;
+}
+
+int common_utils_send_message_to_net_popup(const char *title, const char *content, const char *type, const char *ssid)
+{
+ int ret = 0;
+ bundle *b = bundle_create();
+
+ bundle_add(b, "_SYSPOPUP_TITLE_", title);
+ bundle_add(b, "_SYSPOPUP_CONTENT_", content);
+ bundle_add(b, "_SYSPOPUP_TYPE_", type);
+ bundle_add(b, "_AP_NAME_", ssid);
+
+ ret = aul_launch_app("org.tizen.net-popup", b);
+
+ bundle_free(b);
+
+ return ret;
+}
+
+int common_util_set_system_registry(const char *key, int value)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (vconf_set_int(key, value) < 0) {
+ ERROR_LOG(UG_NAME_NORMAL, "Failed to set vconf");
+
+ __COMMON_FUNC_EXIT__;
+ return -1;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return 0;
+}
+
+int common_util_get_system_registry(const char *key)
+{
+ __COMMON_FUNC_ENTER__;
+
+ int value = 0;
+
+ if (vconf_get_int(key, &value) < 0) {
+ ERROR_LOG(UG_NAME_NORMAL, "Failed to get vconf");
+
+ __COMMON_FUNC_EXIT__;
+ return -1;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return value;
+}
diff --git a/sources/libraries/Common/include/common.h b/sources/libraries/Common/include/common.h
new file mode 100644
index 0000000..c117bf8
--- /dev/null
+++ b/sources/libraries/Common/include/common.h
@@ -0,0 +1,94 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __COMMON_H__
+#define __COMMON_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <dlog.h>
+#include <assert.h>
+
+#define COMMON_NAME_FUNC "wifi/func"
+#define COMMON_NAME_LIB "wifi/lib"
+#define COMMON_NAME_ERR "wifi/err"
+#define UG_NAME_NORMAL "wifi_ug"
+#define UG_NAME_RESP "wifi_ug/resp"
+#define UG_NAME_REQ "wifi_ug/req"
+#define UG_NAME_SCAN "wifi_ug/scan"
+#define UG_NAME_ERR "wifi_ug/err"
+#define SP_NAME_NORMAL "wifi_sp"
+#define SP_NAME_ERR "wifi_sp/err"
+
+/* Log Level */
+#define COMMON_LOG_DEBUG LOG_DEBUG
+#define COMMON_LOG_INFO LOG_INFO
+#define COMMON_LOG_WARN LOG_WARN
+#define COMMON_LOG_ERROR LOG_ERROR
+
+#define MAX_DEVICE_ICON_PATH_STR_LEN 256
+#define WIFI_UNKNOWN_DEVICE_STATUS_STR "Unknown"
+#define ENTER_SSID_STR "Enter SSID"
+#define EAP_CHECK_YOUR_ID_STR "Check your identity"
+#define EAP_CHECK_YOUR_PASWD_STR "Check your password"
+#define WEP_WRONG_PASSWORD_LEN_ERR_MSG_STR \
+ "WEP requires 5, 10, 13, 26 letters for a password.<br>Please, check your input."
+#define WPA_WRONG_PASSWORD_LEN_ERR_MSG_STR \
+ "WPA2 requires 8 - 63 letters for a password.<br>Please, check your input."
+#define FIND_HIDDEN_NETWORK_STR "Find hidden network"
+#define SCREEN_TYPE_ID_KEY "screen_type_id_key"
+#define INVALID_PASSWORD "Your password might be invalid"
+
+typedef enum {
+ VIEW_MANAGER_VIEW_TYPE_MAIN,
+ VIEW_MANAGER_VIEW_TYPE_DETAIL,
+ VIEW_MANAGER_VIEW_TYPE_EAP,
+} view_manager_view_type_t;
+
+#define __COMMON_FUNC_ENTER__ \
+ FUNC_LOG(COMMON_NAME_FUNC, "[<Entering]: %s() [%d]", __func__, __LINE__)
+#define __COMMON_FUNC_EXIT__ \
+ FUNC_LOG(COMMON_NAME_FUNC, "[Quit/>]: %s() [%d]", __func__, __LINE__)
+
+#define FUNC_LOG(MID, format, args...) \
+ SLOG(LOG_INFO, MID, "\033[2m[%s:%d]\033[2m " format "\033[0m", __func__, __LINE__, ##args)
+#define DEBUG_LOG(MID, format, args...) \
+ SLOG(LOG_DEBUG, MID, "\033[42m[%s:%d]\033[0m\033[32m " format "\033[0m", __func__, __LINE__, ##args)
+#define INFO_LOG(MID, format, args...) \
+ SLOG(LOG_INFO, MID, "\033[0m[%s:%d]\033[0m " format, __func__, __LINE__, ##args)
+#define WARN_LOG(MID, format, args...) \
+ SLOG(LOG_WARN, MID, "\033[43m[%s:%d]\033[0m\033[33m " format "\033[0m", __func__, __LINE__, ##args)
+#define ERROR_LOG(MID, format, args...) \
+ SLOG(LOG_ERROR, MID, "\033[41m[%s:%d]\033[0m\033[31m " format "\033[0m", __func__, __LINE__, ##args)
+
+#define assertm_if(expr, fmt, arg...) do { \
+ if(expr) { \
+ ERROR_LOG(COMMON_NAME_ERR, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \
+ assert(1); \
+ } \
+} while (0) /* retvm if */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/libraries/Common/include/common_datamodel.h b/sources/libraries/Common/include/common_datamodel.h
new file mode 100644
index 0000000..6b3fc90
--- /dev/null
+++ b/sources/libraries/Common/include/common_datamodel.h
@@ -0,0 +1,102 @@
+/*
+* Wi-Fi UG
+*
+* Copyright 2012 Samsung Electronics Co., Ltd
+
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+
+* http://www.tizenopensource.org/license
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+
+
+#ifndef __VIEW_DETAIL_DATAMODEL_H_
+#define __VIEW_DETAIL_DATAMODEL_H_
+
+#include "wlan_manager.h"
+
+typedef enum {
+ IP_TYPE_NULL,
+ IP_TYPE_STATIC_IP,
+ IP_TYPE_DHCP_IP,
+ IP_TYPE_MAX
+} IP_TYPES;
+
+typedef struct view_datamodel_ip_info view_datamodel_ip_info_t;
+typedef struct view_datamodel_eap_info view_datamodel_eap_info_t;
+typedef struct view_datamodel_basic_info view_datamodel_basic_info_t;
+
+///////////////////////////////////////////////////////////////
+// managing function
+///////////////////////////////////////////////////////////////
+view_datamodel_basic_info_t *view_basic_detail_datamodel_create(const char *profile_name);
+view_datamodel_ip_info_t *view_detail_datamodel_ip_info_create(const char *profile_name);
+view_datamodel_eap_info_t *view_detail_datamodel_eap_info_create(const char *profile_name);
+void view_basic_detail_datamodel_destroy(view_datamodel_basic_info_t *data_object);
+void view_detail_datamodel_ip_info_destroy(view_datamodel_ip_info_t *data_object);
+void view_detail_datamodel_eap_info_destroy(view_datamodel_eap_info_t *data_object);
+///////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////
+// determine it`s changeness
+///////////////////////////////////////////////////////////////
+boolean view_detail_datamodel_save_ip_info_if_modified(const view_datamodel_ip_info_t *data_object);
+boolean view_detail_datamodel_save_eap_info_if_modified(const view_datamodel_eap_info_t *data_object);
+///////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////
+// getter and setter
+///////////////////////////////////////////////////////////////
+int view_detail_datamodel_ip_and_dns_type_set(view_datamodel_ip_info_t *data_object, const IP_TYPES type);
+int view_detail_datamodel_proxy_address_set(view_datamodel_ip_info_t *data_object, const char* proxy);
+int view_detail_datamodel_static_ip_address_set(view_datamodel_ip_info_t *data_object, const char* addr);
+int view_detail_datamodel_static_gateway_address_set(view_datamodel_ip_info_t *data_object, const char* addr);
+int view_detail_datamodel_static_subnet_mask_set(view_datamodel_ip_info_t *data_object, const char* addr);
+int view_detail_datamodel_static_dns1_address_set(view_datamodel_ip_info_t *data_object, const char* addr);
+int view_detail_datamodel_static_dns2_address_set(view_datamodel_ip_info_t *data_object, const char* addr);
+int view_detail_datamodel_eap_ap_name_set(view_datamodel_eap_info_t *data_object, const char *ssid);
+int view_detail_datamodel_eap_method_set(view_datamodel_eap_info_t *data_object, const wlan_eap_type_t eap_method);
+int view_detail_datamodel_eap_provision_set(view_datamodel_eap_info_t *data_object, const int provision);
+int view_detail_datamodel_eap_auth_set(view_datamodel_eap_info_t *data_object, const wlan_eap_auth_type_t auth_type);
+int view_detail_datamodel_eap_user_id_set(view_datamodel_eap_info_t *data_object, const char* user_id);
+int view_detail_datamodel_eap_anonymous_id_set(view_datamodel_eap_info_t *data_object, const char* anonymous_id);
+int view_detail_datamodel_eap_pswd_set(view_datamodel_eap_info_t *data_object, const char* pswd);
+int view_detail_datamodel_eap_ca_cert_set(view_datamodel_eap_info_t *data_object, const char* ca_cert);
+int view_detail_datamodel_eap_user_cert_set(view_datamodel_eap_info_t *data_object, const char* user_cert);
+IP_TYPES view_detail_datamodel_ip_and_dns_type_get(view_datamodel_ip_info_t *data_object);
+char *view_detail_datamodel_static_ip_address_get(view_datamodel_ip_info_t *data_object);
+char *view_detail_datamodel_static_gateway_address_get(view_datamodel_ip_info_t *data_object);
+char *view_detail_datamodel_static_subnet_mask_get(view_datamodel_ip_info_t *data_object);
+char *view_detail_datamodel_static_dns1_address_get(view_datamodel_ip_info_t *data_object);
+char *view_detail_datamodel_static_dns2_address_get(view_datamodel_ip_info_t *data_object);
+char* view_detail_datamodel_proxy_address_get(view_datamodel_ip_info_t *data_object);
+char* view_detail_datamodel_MAC_addr_get(view_datamodel_ip_info_t *data_object);
+
+wlan_eap_type_t view_detail_datamodel_eap_method_get(view_datamodel_eap_info_t *data_object);
+int view_detail_datamodel_eap_provision_get(view_datamodel_eap_info_t *data_object);
+wlan_eap_auth_type_t view_detail_datamodel_eap_auth_get(view_datamodel_eap_info_t *data_object);
+char *view_detail_datamodel_user_id_get(view_datamodel_eap_info_t *data_object);
+char *view_detail_datamodel_anonymous_id_get(view_datamodel_eap_info_t *data_object);
+char *view_detail_datamodel_pswd_get(view_datamodel_eap_info_t *data_object);
+char *view_detail_datamodel_ca_cert_get(view_datamodel_eap_info_t *data_object);
+char *view_detail_datamodel_user_cert_get(view_datamodel_eap_info_t *data_object);
+char *view_detail_datamodel_eap_ap_name_get(view_datamodel_eap_info_t *data_object);
+
+char *view_detail_datamodel_basic_info_profile_name_get(view_datamodel_basic_info_t *data_object);
+char *view_detail_datamodel_ap_name_get(view_datamodel_basic_info_t *data_object);
+unsigned int view_detail_datamodel_sig_strength_get(view_datamodel_basic_info_t *data_object);
+unsigned int view_detail_datamodel_sec_mode_get(view_datamodel_basic_info_t *data_object);
+boolean view_detail_datamodel_is_favourite_get(view_datamodel_basic_info_t *data_object);
+char view_detail_datamodel_wps_support_get(view_datamodel_basic_info_t *data_object);
+///////////////////////////////////////////////////////////////
+
+#endif
diff --git a/sources/libraries/Common/include/common_eap_connect.h b/sources/libraries/Common/include/common_eap_connect.h
new file mode 100644
index 0000000..1cb6f25
--- /dev/null
+++ b/sources/libraries/Common/include/common_eap_connect.h
@@ -0,0 +1,50 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __COMMON_EAP_CONNECT_H__
+#define __COMMON_EAP_CONNECT_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <Evas.h>
+
+#include "wlan_manager.h"
+#include "common_utils.h"
+
+#define DISABLE_FAST_EAP_METHOD
+
+typedef struct eap_info_list eap_info_list_t;
+typedef struct common_eap_connect_data common_eap_connect_data_t;
+
+common_eap_connect_data_t *create_eap_connect_view(Evas_Object *win_main, Evas_Object *navi_frame, const char *pkg_name, wifi_device_info_t *device_info);
+common_eap_connect_data_t *create_eap_connect_popup(Evas_Object *win_main, const char *pkg_name, wifi_device_info_t *device_info);
+eap_info_list_t *eap_info_append_items(wifi_ap_h ap, Evas_Object* view_list, const char *str_pkg_name, imf_ctxt_panel_cb_t input_panel_cb, void *input_panel_cb_data);
+void eap_info_save_data(eap_info_list_t *eap_info_list_data);
+void eap_info_remove(eap_info_list_t *eap_info_list_data);
+void eap_view_close(common_eap_connect_data_t *eap_data);
+void eap_view_rotate_popup(common_eap_connect_data_t *eap_data, int rotate_angle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __COMMON_EAP_CONNECT_H__ */
diff --git a/sources/libraries/Common/include/common_invalid_password.h b/sources/libraries/Common/include/common_invalid_password.h
new file mode 100644
index 0000000..6c32f1e
--- /dev/null
+++ b/sources/libraries/Common/include/common_invalid_password.h
@@ -0,0 +1,39 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __COMMON_INVALID_PASSWORD_H__
+#define __COMMON_INVALID_PASSWORD_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <glib.h>
+
+int _common_register_invalid_password_popup(void);
+int _common_deregister_invalid_password_popup(void);
+
+gboolean _common_is_invalid_password(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __COMMON_INVALID_PASSWORD_H__ */
diff --git a/sources/libraries/Common/include/common_ip_info.h b/sources/libraries/Common/include/common_ip_info.h
new file mode 100644
index 0000000..f2aafeb
--- /dev/null
+++ b/sources/libraries/Common/include/common_ip_info.h
@@ -0,0 +1,46 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __COMMON_IP_INFO_H__
+#define __COMMON_IP_INFO_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <Evas.h>
+
+#include "wlan_manager.h"
+#include "common_utils.h"
+
+#define DEFAULT_GUIDE_PROXY_IP "proxy.example.com"
+#define DEFAULT_GUIDE_PROXY_PORT "8080"
+
+typedef struct ip_info_list ip_info_list_t;
+
+ip_info_list_t *ip_info_append_items(wifi_ap_h ap, const char *pkg_name, Evas_Object *genlist, imf_ctxt_panel_cb_t input_panel_cb, void *input_panel_cb_data);
+void ip_info_save_data(ip_info_list_t *ip_info_list);
+void ip_info_remove(ip_info_list_t *ip_info_list);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/libraries/Common/include/common_pswd_popup.h b/sources/libraries/Common/include/common_pswd_popup.h
new file mode 100644
index 0000000..de0b2e5
--- /dev/null
+++ b/sources/libraries/Common/include/common_pswd_popup.h
@@ -0,0 +1,53 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __COMMON_PSWD_POPUP_H__
+#define __COMMON_PSWD_POPUP_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <Evas.h>
+#include <wifi.h>
+
+typedef struct {
+ char *title;
+ Eina_Bool show_wps_btn;
+ Evas_Smart_Cb ok_cb;
+ Evas_Smart_Cb cancel_cb;
+ Evas_Smart_Cb wps_btn_cb;
+ wifi_ap_h ap;
+ void *cb_data;
+} pswd_popup_create_req_data_t;
+
+typedef struct pswd_popup pswd_popup_t;
+
+pswd_popup_t *common_pswd_popup_create(Evas_Object *win_main, const char *pkg_name, pswd_popup_create_req_data_t *popup_info);
+void common_pswd_popup_pbc_popup_create(pswd_popup_t *pswd_popup_data, Evas_Smart_Cb cancel_cb, void *cancel_cb_data);
+char *common_pswd_popup_get_txt(pswd_popup_t *pswd_popup_data);
+wifi_ap_h common_pswd_popup_get_ap(pswd_popup_t *pswd_popup_data);
+void common_pswd_popup_destroy(pswd_popup_t *pswd_popup_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/libraries/Common/include/common_utils.h b/sources/libraries/Common/include/common_utils.h
new file mode 100644
index 0000000..4630103
--- /dev/null
+++ b/sources/libraries/Common/include/common_utils.h
@@ -0,0 +1,110 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __COMMON_UTILS_H__
+#define __COMMON_UTILS_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <Elementary.h>
+#include <appcore-common.h>
+
+#include "wlan_manager.h"
+
+typedef void (*imf_ctxt_panel_cb_t)(void *data, Ecore_IMF_Context *ctx, int value);
+
+typedef enum {
+ ENTRY_TYPE_USER_ID,
+ ENTRY_TYPE_ANONYMOUS_ID,
+ ENTRY_TYPE_PASSWORD,
+ ENTRY_TYPE_IP_ADDR,
+ ENTRY_TYPE_SUBNET_MASK,
+ ENTRY_TYPE_GATEWAY,
+ ENTRY_TYPE_DNS_1,
+ ENTRY_TYPE_DNS_2,
+ ENTRY_TYPE_PROXY_ADDR,
+ ENTRY_TYPE_PROXY_PORT,
+} entry_id_type_t;
+
+typedef struct {
+ entry_id_type_t entry_id;
+ char *title_txt;
+ char *guide_txt;
+ char *entry_txt;
+ Evas_Object *layout;
+ imf_ctxt_panel_cb_t input_panel_cb;
+ void *input_panel_cb_data;
+} common_utils_entry_info_t;
+
+typedef struct {
+ char *title_txt;
+ char *info_txt;
+ char *btn1_txt;
+ char *btn2_txt;
+ Evas_Smart_Cb btn1_cb;
+ Evas_Smart_Cb btn2_cb;
+ const void *btn1_data;
+ const void *btn2_data;
+} popup_btn_info_t;
+
+Elm_Object_Item *common_utils_add_dialogue_separator(
+ Evas_Object* genlist, const char *separator_style);
+char *common_utils_get_ap_security_type_info_txt(
+ const char *pkg_name, wifi_device_info_t *device_info);
+char *common_utils_get_device_icon(
+ const char *image_path_dir, wifi_device_info_t *device_info);
+Evas_Object *common_utils_entry_layout_get_entry(Evas_Object *layout);
+char *common_utils_entry_layout_get_text(Evas_Object *layout);
+Evas_Object *common_utils_add_edit_box(Evas_Object *parent,
+ common_utils_entry_info_t *entry_info);
+void common_utils_set_edit_box_imf_panel_evnt_cb(Elm_Object_Item *item,
+ imf_ctxt_panel_cb_t input_panel_cb, void *user_data);
+
+void common_utils_entry_password_set(Evas_Object *layout, Eina_Bool pswd_set);
+Elm_Object_Item *common_utils_add_2_line_txt_disabled_item(
+ Evas_Object* view_list, const char *style_name,
+ const char *line1_txt, const char *line2_txt);
+char *common_utils_get_list_item_entry_txt(Elm_Object_Item *entry_item);
+Evas_Object *common_utils_create_radio_button(Evas_Object *parent,
+ const int value);
+Evas_Object *common_utils_create_layout(Evas_Object *navi_frame);
+Evas_Object *common_utils_show_info_popup(Evas_Object *win,
+ popup_btn_info_t *popup_data);
+Evas_Object *common_utils_show_info_ok_popup(Evas_Object *win,
+ const char *str_pkg_name, const char *info_txt);
+Evas_Object *common_utils_show_info_timeout_popup(Evas_Object *win,
+ const char* info_text, const double timeout);
+int common_utils_get_rotate_angle(enum appcore_rm rotate_mode);
+wlan_security_mode_type_t common_utils_get_sec_mode(
+ wifi_security_type_e sec_type);
+int common_utils_send_message_to_net_popup(const char *title,
+ const char *content, const char *type, const char *ssid);
+void __common_popup_size_get(Ecore_IMF_Context *target_imf, int *width, int *height);
+
+int common_util_set_system_registry(const char *key, int value);
+int common_util_get_system_registry(const char *key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/libraries/WlanManager/EngineManager/connman-profile-manager.c b/sources/libraries/WlanManager/EngineManager/connman-profile-manager.c
new file mode 100644
index 0000000..6265a29
--- /dev/null
+++ b/sources/libraries/WlanManager/EngineManager/connman-profile-manager.c
@@ -0,0 +1,211 @@
+/*
+* Wi-Fi UG
+*
+* Copyright 2012 Samsung Electronics Co., Ltd
+
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+
+* http://www.tizenopensource.org/license
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+
+
+#include "common.h"
+#include "wlan_manager.h"
+
+
+typedef struct connman_profile_manager {
+ int profile_num;
+ net_profile_info_t* profile_table;
+} connman_profile_manager;
+connman_profile_manager *_profile_manager = NULL;
+
+static connman_profile_manager *connman_profile_manager_get_singleton()
+{
+ if (_profile_manager == NULL) {
+ _profile_manager = (connman_profile_manager *)malloc(sizeof(connman_profile_manager));
+ _profile_manager->profile_num = 0;
+ _profile_manager->profile_table = NULL;
+ }
+
+ return _profile_manager;
+}
+
+void connman_profile_manager_destroy()
+{
+ if (_profile_manager) {
+ if (_profile_manager->profile_table) {
+ g_free(_profile_manager->profile_table);
+ }
+
+ g_free(_profile_manager);
+ _profile_manager = NULL;
+ }
+}
+
+int connman_profile_manager_profile_cache(int count)
+{
+ int *p_num_of_profiles = 0;
+ net_profile_info_t** p_profile_table;
+ net_profile_info_t* old_profile_table;
+ connman_profile_manager *profile_manager = NULL;
+
+ INFO_LOG(COMMON_NAME_LIB, "connman_profile_manager_profile_cache");
+
+ profile_manager = connman_profile_manager_get_singleton();
+ old_profile_table = profile_manager->profile_table;
+ profile_manager->profile_table = NULL;
+
+ p_num_of_profiles = &(profile_manager->profile_num);
+ p_profile_table = &(profile_manager->profile_table);
+
+ net_get_profile_list(NET_DEVICE_WIFI, p_profile_table, p_num_of_profiles);
+ g_free(old_profile_table);
+ if (*p_num_of_profiles == 0) {
+ INFO_LOG(COMMON_NAME_LIB, "count = 0");
+ } else if (count < *p_num_of_profiles && count > 0) {
+ *p_num_of_profiles = count;
+ }
+
+ INFO_LOG(COMMON_NAME_LIB, "count = %d", *p_num_of_profiles);
+
+ return *p_num_of_profiles;
+}
+
+int connman_profile_manager_scanned_profile_table_size_get(void)
+{
+ connman_profile_manager *profile_manager = NULL;
+ profile_manager = connman_profile_manager_get_singleton();
+ return profile_manager->profile_num;
+}
+
+int connman_profile_manager_check_favourite(const char *profile_name, int *favourite)
+{
+ net_profile_info_t profile;
+
+ int ret = net_get_profile_info(profile_name, &profile);
+ if (ret != NET_ERR_NONE) {
+ ERROR_LOG(COMMON_NAME_ERR, "Failed - net_get_profile_info : error[%d]", ret);
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+
+ INFO_LOG(COMMON_NAME_LIB, "Favourite = %d", (int)profile.Favourite);
+
+ *favourite = (int)profile.Favourite;
+ return WLAN_MANAGER_ERR_NONE;
+}
+
+int connman_profile_manager_connected_ssid_set(const char *profile_name)
+{
+ INFO_LOG(COMMON_NAME_LIB, "Profile name : %s", profile_name);
+
+ net_profile_info_t profile;
+ if (net_get_profile_info(profile_name, &profile) != NET_ERR_NONE)
+ return FALSE;
+
+ wlan_manager_set_connected_AP((const net_profile_info_t *)&profile);
+
+ return TRUE;
+}
+
+int connman_profile_manager_disconnected_ssid_set(const char *profile_name)
+{
+ INFO_LOG(COMMON_NAME_LIB, "Profile name : %s", profile_name);
+
+ const char *connected_profile_name = wlan_manager_get_connected_profile();
+ if (connected_profile_name)
+ if (strncmp(connected_profile_name, profile_name, strlen(connected_profile_name)) == 0)
+ wlan_manager_reset_connected_AP();
+
+ return TRUE;
+}
+
+int connman_profile_manager_profile_modify(net_profile_info_t *new_profile)
+{
+ int ret = net_modify_profile(new_profile->ProfileName, new_profile);
+ if (ret != NET_ERR_NONE) {
+ INFO_LOG(COMMON_NAME_ERR, "Failed to modify profile - %d\n", ret);
+ return 0;
+ }
+ else {
+ INFO_LOG(COMMON_NAME_LIB, "Succeed to modify profile - %d\n", ret);
+ }
+
+ return 1;
+}
+
+int connman_profile_manager_profile_modify_auth(const char* profile_name, void *authdata, int secMode)
+{
+ if (profile_name == NULL || authdata == NULL)
+ return 0;
+
+ net_profile_info_t profile;
+ if (net_get_profile_info(profile_name, &profile) != NET_ERR_NONE) {
+ return 0;
+ }
+
+ wlan_manager_password_data* auth = (wlan_manager_password_data*)authdata;
+ char security_key[NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN+1] = "";
+
+ if (auth != NULL) {
+ strncpy(security_key, auth->password, NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN);
+ DEBUG_LOG(COMMON_NAME_LIB, "security_key [%s]", auth->password);
+ }
+
+ if (0 < strlen(security_key)) {
+ if (secMode == WLAN_SEC_MODE_WEP) {
+ INFO_LOG(COMMON_NAME_LIB, "SECURITY_TYPE_WEP");
+ strncpy(profile.ProfileInfo.Wlan.security_info.authentication.wep.wepKey,
+ security_key,
+ NETPM_WLAN_MAX_WEP_KEY_LEN);
+ } else {
+ INFO_LOG(COMMON_NAME_LIB, "not SECURITY_TYPE_WEP" );
+ strncpy(profile.ProfileInfo.Wlan.security_info.authentication.psk.pskKey, security_key,
+ NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN);
+ profile.ProfileInfo.Wlan.security_info.authentication.psk.pskKey[NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN] = '\0';
+ }
+ } else {
+ INFO_LOG(COMMON_NAME_LIB, "security data <= 0" );
+ strncpy(profile.ProfileInfo.Wlan.security_info.authentication.psk.pskKey, security_key,
+ NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN);
+ }
+
+ int ret = net_modify_profile(profile_name, &profile);
+ if (ret != NET_ERR_NONE) {
+ INFO_LOG(COMMON_NAME_ERR, "Failed to modify profile - %d\n", ret);
+ return 0;
+ }
+ else {
+ INFO_LOG(COMMON_NAME_LIB, "Succeed to modify profile - %d\n", ret);
+ }
+
+ return 1;
+}
+
+void* connman_profile_manager_profile_table_get(void)
+{
+ connman_profile_manager *profile_manager = NULL;
+ profile_manager = connman_profile_manager_get_singleton();
+ return profile_manager->profile_table;
+}
+
+int connman_profile_manager_profile_info_get(const char *profile_name, net_profile_info_t *profile)
+{
+ if (profile_name == NULL)
+ return 0;
+
+ if (net_get_profile_info(profile_name, profile) != NET_ERR_NONE) {
+ return 0;
+ }
+
+ return 1;
+}
diff --git a/sources/libraries/WlanManager/EngineManager/connman-request.c b/sources/libraries/WlanManager/EngineManager/connman-request.c
new file mode 100644
index 0000000..8c77c06
--- /dev/null
+++ b/sources/libraries/WlanManager/EngineManager/connman-request.c
@@ -0,0 +1,72 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "common.h"
+#include "wlan_manager.h"
+
+int connman_request_register(void)
+{
+ int ret = net_register_client(network_evt_cb, NULL);
+ switch (ret) {
+ case NET_ERR_NONE:
+ return WLAN_MANAGER_ERR_NONE;
+ case NET_ERR_APP_ALREADY_REGISTERED:
+ return WLAN_MANAGER_ERR_ALREADY_REGISTERED;
+ default:
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+}
+
+int connman_request_deregister(void)
+{
+ int ret = net_deregister_client();
+ switch (ret) {
+ case NET_ERR_NONE:
+ return WLAN_MANAGER_ERR_NONE;
+ default:
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+}
+
+int connman_request_specific_scan(const char *ssid)
+{
+ int ret = net_specific_scan_wifi(ssid);
+ INFO_LOG(COMMON_NAME_LIB,"net_specific_scan_wifi ret: %d", ret);
+
+ switch (ret) {
+ case NET_ERR_NONE:
+ case NET_ERR_IN_PROGRESS:
+ return WLAN_MANAGER_ERR_NONE;
+ default:
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+}
+
+int connman_request_scan_mode_set(net_wifi_background_scan_mode_t scan_mode)
+{
+ int ret = net_wifi_set_background_scan_mode(scan_mode);
+ INFO_LOG(COMMON_NAME_LIB, "net_wifi_set_background_scan_mode ret: %d", ret);
+
+ switch (ret) {
+ case NET_ERR_NONE:
+ return WLAN_MANAGER_ERR_NONE;
+ default:
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+}
diff --git a/sources/libraries/WlanManager/EngineManager/connman-response.c b/sources/libraries/WlanManager/EngineManager/connman-response.c
new file mode 100644
index 0000000..cc43728
--- /dev/null
+++ b/sources/libraries/WlanManager/EngineManager/connman-response.c
@@ -0,0 +1,92 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "common.h"
+#include "wlan_manager.h"
+
+struct _wifi_cb_s {
+ wifi_specific_scan_finished_cb specific_scan_cb;
+ void *specific_scan_user_data;
+};
+
+static struct _wifi_cb_s wifi_callbacks = {0,};
+
+int wifi_set_specific_scan_cb(wifi_specific_scan_finished_cb cb, void *data)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!cb) {
+ __COMMON_FUNC_EXIT__;
+ return WIFI_ERROR_INVALID_PARAMETER;
+ }
+
+ wifi_callbacks.specific_scan_cb = cb;
+ wifi_callbacks.specific_scan_user_data = data;
+ __COMMON_FUNC_EXIT__;
+
+ return WIFI_ERROR_NONE;
+}
+
+int wifi_unset_specific_scan_cb(void)
+{
+ __COMMON_FUNC_ENTER__;
+ if (wifi_callbacks.specific_scan_cb == NULL) {
+ __COMMON_FUNC_EXIT__;
+ return WIFI_ERROR_INVALID_OPERATION;
+ }
+
+ wifi_callbacks.specific_scan_cb = NULL;
+ wifi_callbacks.specific_scan_user_data = NULL;
+ __COMMON_FUNC_EXIT__;
+
+ return WIFI_ERROR_NONE;
+}
+
+void network_evt_cb(const net_event_info_t* net_event, void* user_data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ switch (net_event->Event) {
+ case NET_EVENT_SPECIFIC_SCAN_RSP:
+ INFO_LOG(COMMON_NAME_LIB, "Callback - NET_EVENT_SPECIFIC_SCAN_RSP");
+ if (net_event->Error != NET_ERR_NONE) {
+ if (wifi_callbacks.specific_scan_cb)
+ wifi_callbacks.specific_scan_cb(WIFI_ERROR_OPERATION_FAILED, NULL, wifi_callbacks.specific_scan_user_data);
+ else
+ ERROR_LOG(COMMON_NAME_LIB, "Specific scan cb is not set !!!");
+ } else {
+ INFO_LOG(COMMON_NAME_LIB, "Successfully sent the specific scan request");
+ }
+ break;
+ case NET_EVENT_SPECIFIC_SCAN_IND:
+ INFO_LOG(COMMON_NAME_LIB, "Callback - NET_EVENT_SPECIFIC_SCAN_IND");
+ if (!wifi_callbacks.specific_scan_cb) {
+ ERROR_LOG(COMMON_NAME_LIB, "Specific scan cb is not set !!!");
+ } else if (net_event->Error != NET_ERR_NONE) {
+ wifi_callbacks.specific_scan_cb(WIFI_ERROR_OPERATION_FAILED, NULL, wifi_callbacks.specific_scan_user_data);
+ } else {
+ wifi_callbacks.specific_scan_cb(WIFI_ERROR_NONE, net_event->Data, wifi_callbacks.specific_scan_user_data);
+ }
+ break;
+ default:
+ INFO_LOG(COMMON_NAME_LIB, "Callback - %d", net_event->Event);
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
diff --git a/sources/libraries/WlanManager/EngineManager/include/connman-profile-manager.h b/sources/libraries/WlanManager/EngineManager/include/connman-profile-manager.h
new file mode 100644
index 0000000..84f13c6
--- /dev/null
+++ b/sources/libraries/WlanManager/EngineManager/include/connman-profile-manager.h
@@ -0,0 +1,38 @@
+/*
+* Wi-Fi UG
+*
+* Copyright 2012 Samsung Electronics Co., Ltd
+
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+
+* http://www.tizenopensource.org/license
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+
+
+#ifndef __WIFI_CONNMAN_PROFILE_MANAGER_H__
+#define __WIFI_CONNMAN_PROFILE_MANAGER_H_
+
+#include <network-pm-intf.h>
+
+int connman_profile_manager_profile_cache(int count);
+int connman_profile_manager_check_favourite(const char *profile_name, int *favourite);
+int connman_profile_manager_connected_ssid_set(const char *profile_name);
+int connman_profile_manager_disconnected_ssid_set(const char *profile_name);
+int connman_profile_manager_profile_modify(net_profile_info_t *new_profile);
+int connman_profile_manager_profile_modify_auth(const char *profile_name, void *authdata, int secMode);
+void *connman_profile_manager_profile_table_get(void);
+int connman_profile_manager_profile_info_get(const char *profile_name, net_profile_info_t *profile);
+int connman_profile_manager_scanned_profile_table_size_get(void);
+void connman_profile_manager_destroy(void);
+
+#endif
diff --git a/sources/libraries/WlanManager/EngineManager/include/connman-request.h b/sources/libraries/WlanManager/EngineManager/include/connman-request.h
new file mode 100644
index 0000000..3ba74ae
--- /dev/null
+++ b/sources/libraries/WlanManager/EngineManager/include/connman-request.h
@@ -0,0 +1,39 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __CONNMAN_REQUEST_H__
+#define __CONNMAN_REQUEST_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <network-wifi-intf.h>
+
+int connman_request_specific_scan(const char *ssid);
+int connman_request_scan_mode_set(net_wifi_background_scan_mode_t scan_mode);
+int connman_request_register(void);
+int connman_request_deregister(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/libraries/WlanManager/EngineManager/include/connman-response.h b/sources/libraries/WlanManager/EngineManager/include/connman-response.h
new file mode 100644
index 0000000..fd3c9d6
--- /dev/null
+++ b/sources/libraries/WlanManager/EngineManager/include/connman-response.h
@@ -0,0 +1,46 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __CONNMAN_RESPONSE_H__
+#define __CONNMAN_RESPONSE_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "connman-request.h"
+
+/**
+* @brief Called when the specific scan is finished.
+* @param[in] error_code The error code
+* @param[in] user_data The user data passed from the callback registration function
+* @see wifi_set_specific_scan_cb()
+*/
+typedef void(*wifi_specific_scan_finished_cb)(wifi_error_e error_code, GSList *bss_info_list, void* user_data);
+
+int wifi_set_specific_scan_cb(wifi_specific_scan_finished_cb cb, void *data);
+int wifi_unset_specific_scan_cb(void);
+void network_evt_cb(const net_event_info_t* net_event, void* user_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/libraries/WlanManager/wlan-manager/include/wlan_manager.h b/sources/libraries/WlanManager/wlan-manager/include/wlan_manager.h
new file mode 100644
index 0000000..1bc8abc
--- /dev/null
+++ b/sources/libraries/WlanManager/wlan-manager/include/wlan_manager.h
@@ -0,0 +1,254 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __WIFI_WLAN_MANAGER_H__
+#define __WIFI_WLAN_MANAGER_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <glib.h>
+#include <wifi.h>
+#include <dbus/dbus-glib.h>
+
+#include "connman-request.h"
+#include "connman-response.h"
+
+typedef enum {
+ WLAN_MANAGER_ERR_NONE = 0,
+ WLAN_MANAGER_ERR_UNKNOWN,
+ WLAN_MANAGER_ERR_INVALID_PARAM,
+ WLAN_MANAGER_ERR_ALREADY_REGISTERED,
+ WLAN_MANAGER_ERR_CONNECT_PASSWORD_NEEDED,
+ WLAN_MANAGER_ERR_CONNECT_EAP_SEC_TYPE,
+ WLAN_MANAGER_ERR_MOBILE_HOTSPOT_OCCUPIED,
+ WLAN_MANAGER_ERR_NOSERVICE,
+ WLAN_MANAGER_ERR_IN_PROGRESS,
+} WLAN_MANAGER_ERR_TYPE;
+
+typedef enum {
+ SIGNAL_STRENGTH_TYPE_EXCELLENT,
+ SIGNAL_STRENGTH_TYPE_GOOD,
+ SIGNAL_STRENGTH_TYPE_WEAK,
+ SIGNAL_STRENGTH_TYPE_VERY_WEAK,
+ SIGNAL_STRENGTH_TYPE_NULL
+} STRENGTH_TYPES;
+
+/*
+ * JOIN TYPE, SECURITY TYPE and EAP_TYPE
+ *
+ * Determine it`s security type
+ * It should be merged into one enumerations
+*/
+typedef enum {
+ SECURITY_TYPE_NONE=0x01,
+ SECURITY_TYPE_WEP,
+ SECURITY_TYPE_WPA_PSK,
+ SECURITY_TYPE_WPA2_PSK,
+
+ SECURITY_TYPE_WPA_EAP,
+ SECURITY_TYPE_WPA2_EAP,
+
+ SECURITY_TYPE_MAX,
+ SECURITY_TYPE_NULL
+} SECURITY_TYPES;
+
+typedef enum {
+ WLAN_MANAGER_EAP_TYPE_NONE, /* only use it`s WPA number */
+ WLAN_MANAGER_EAP_TYPE_TLS,
+ WLAN_MANAGER_EAP_TYPE_TTLS_PAP, /** PAP is tunneled protocol */
+ WLAN_MANAGER_EAP_TYPE_TTLS_CHAP, /** CHAP is tunneled protocol */
+ WLAN_MANAGER_EAP_TYPE_TTLS_MSCHAP, /** MSCHAP is tunneled protocol */
+ WLAN_MANAGER_EAP_TYPE_TTLS_MSCHAPV2, /** MSCHAPV2 is tunneled protocol */
+
+ /** Define EAP-TTLS and tunneled EAP sub types here */
+ WLAN_MANAGER_EAP_TYPE_TTLS_EAP_GTC, /** EAP_GTC is tunneled protocol */
+ WLAN_MANAGER_EAP_TYPE_TTLS_EAP_MD5, /** EAP_MD5 is tunneled protocol */
+ WLAN_MANAGER_EAP_TYPE_TTLS_EAP_MSCHAPV2, /** EAP_MSCHAPV2 is tunneled protocol */
+
+ /** Define EAP-PEAP version 0 */
+ WLAN_MANAGER_EAP_TYPE_PEAP0_MSCHAPV2, /** MSCHAPV2 is tunneled protocol, PEAP version is 0 */
+ WLAN_MANAGER_EAP_TYPE_PEAP0_MD5, /** MD5 is tunneled protocol, PEAP version is 0 */
+ WLAN_MANAGER_EAP_TYPE_PEAP0_GTC, /** GTC is tunneled protocol, PEAP version is 0 */
+
+ /** Define EAP-PEAP version 1 */
+ WLAN_MANAGER_EAP_TYPE_PEAP1_MSCHAPV2, /** MSCHAPV2 is tunneled protocol, PEAP version is 1 */
+ WLAN_MANAGER_EAP_TYPE_PEAP1_MD5, /** MD5 is tunneled protocol, PEAP version is 1 */
+ WLAN_MANAGER_EAP_TYPE_PEAP1_GTC, /** GTC is tunneled protocol, PEAP version is 1 */
+ WLAN_MANAGER_EAP_TYPE_MAX,
+ WLAN_MANAGER_EAP_TYPE_ERROR
+} WLAN_MANAGER_EAP_TYPES;
+
+/*
+ * RESPONSES
+ */
+typedef enum {
+ WLAN_MANAGER_RESPONSE_TYPE_NONE,
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTING,
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_OK,
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_FAIL_IN_PROGRESS,
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_FAIL_ABORTED,
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_FAIL_ALREADY_EXIST,
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_FAIL_TIMEOUT,
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_FAIL_UNKNOWN,
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_FAIL_UNKNOWN_METHOD,
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_CONNECT_FAILED,
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_INVALID_KEY,
+ WLAN_MANAGER_RESPONSE_TYPE_DISCONNECTION_OK,
+ WLAN_MANAGER_RESPONSE_TYPE_POWER_ON_OK,
+ WLAN_MANAGER_RESPONSE_TYPE_POWER_ON_NOT_SUPPORTED,
+ WLAN_MANAGER_RESPONSE_TYPE_POWER_ON_RESTRICTED,
+ WLAN_MANAGER_RESPONSE_TYPE_POWER_OFF_OK,
+ WLAN_MANAGER_RESPONSE_TYPE_SCAN_OK,
+ WLAN_MANAGER_RESPONSE_TYPE_WPS_ENROLL_OK,
+ WLAN_MANAGER_RESPONSE_TYPE_WPS_ENROLL_FAIL,
+ WLAN_MANAGER_RESPONSE_TYPE_CANCEL_WPS_ENROLL_OK,
+ WLAN_MANAGER_RESPONSE_TYPE_CANCEL_WPS_ENROLL_FAIL,
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_IND,
+ WLAN_MANAGER_RESPONSE_TYPE_DISCONNECTION_IND,
+ WLAN_MANAGER_RESPONSE_TYPE_SCAN_RESULT_IND,
+ WLAN_MANAGER_RESPONSE_TYPE_MAC_ID_IND,
+ WLAN_MANAGER_RESPONSE_TYPE_SPECIFIC_SCAN_OK,
+ WLAN_MANAGER_RESPONSE_TYPE_SPECIFIC_SCAN_FAIL,
+ WLAN_MANAGER_RESPONSE_TYPE_SPECIFIC_SCAN_IND,
+ WLAN_MANAGER_RESPONSE_TYPE_UPDATE_SIG_STR,
+ WLAN_MANAGER_RESPONSE_TYPE_MAX
+} WLAN_MANAGER_RESPONSE_TYPES;
+
+#define WLAN_RSSI_LEVEL_EXCELLENT 64
+#define WLAN_RSSI_LEVEL_GOOD 59
+#define WLAN_RSSI_LEVEL_WEAK 34
+
+#define WLAN_PROXY_LEN_MAX 64
+
+typedef struct {
+ DBusGProxy *proxy;
+ DBusGProxyCall * pending_call;
+ gboolean is_handled;
+} wifi_pending_call_info_t;
+
+wifi_pending_call_info_t g_pending_call;
+
+typedef struct _wifi_device_info_t {
+ wifi_ap_h ap;
+ char* ssid;
+ char* ap_status_txt;
+ char* ap_image_path;
+ int ipconfigtype;
+ int rssi;
+ wlan_security_mode_type_t security_mode;
+ bool wps_mode;
+} wifi_device_info_t;
+
+typedef struct {
+ const char* password;
+ char* category;
+ char* subcategory;
+ char* username;
+ char* userpassword;
+ char* ca_cert_filename;
+ char* client_cert_filename;
+ char* private_key;
+ char* private_key_password;
+ int wlan_eap_type;
+} wlan_manager_password_data;
+
+/* it should be implement. */
+typedef enum {
+ WLAN_MANAGER_ERROR=0x01,
+ WLAN_MANAGER_OFF,
+ WLAN_MANAGER_UNCONNECTED,
+ WLAN_MANAGER_CONNECTED,
+ WLAN_MANAGER_CONNECTING,
+ WLAN_MANAGER_DISCONNECTING,
+ WLAN_MANAGER_MAX
+} WLAN_MANAGER_STATES;
+
+typedef void (*wlan_manager_ui_refresh_func_t)(void);
+
+typedef struct {
+ WLAN_MANAGER_RESPONSE_TYPES event_type;
+ wifi_ap_h ap;
+ wifi_rssi_level_e rssi_level;
+ GSList *bss_info_list;
+} wlan_mgr_event_info_t;
+
+typedef void (*wlan_event_handler)(wlan_mgr_event_info_t *event_info, void *user_data);
+
+/** It should be hide to others */
+typedef struct wlan_manager_object {
+ wlan_event_handler message_func;
+ wlan_manager_ui_refresh_func_t refresh_func;
+ gboolean b_scan_blocked;
+ gboolean b_ui_refresh;
+} wlan_manager_object;
+
+/////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////
+// FUNCTIONS
+/////////////////////////////////////////////////////////////////
+
+
+wlan_manager_object* wlan_manager_get_singleton(void);
+void* wlan_manager_create();
+int wlan_manager_destroy();
+int wlan_manager_start();
+
+wifi_ap_h wlan_manager_get_ap_with_state(int ap_state);
+int wlan_manager_state_get(void);
+void wlan_manager_set_message_callback(wlan_event_handler func);
+void wlan_manager_set_refresh_callback(wlan_manager_ui_refresh_func_t func);
+
+void wlan_manager_enable_scan_result_update(void);
+void wlan_manager_disable_scan_result_update(void);
+char *wlan_manager_get_connected_ssid(void);
+
+// * request
+int wlan_manager_request_connection(wifi_ap_h ap);
+int wlan_manager_request_disconnection(wifi_ap_h ap);
+int wlan_manager_request_wps_connection(wifi_ap_h ap);
+int wlan_manager_request_power_on(void);
+int wlan_manager_request_power_off(void);
+int wlan_manager_request_scan(void);
+
+// * connect, disconnect and forget
+int wlan_manager_connect_with_password(wifi_ap_h ap, const char *pass_phrase);
+int wlan_manager_connect_with_wifi_info(wifi_ap_h ap);
+int wlan_manager_forget(wifi_ap_h ap);
+int wlan_manager_request_specific_scan(const char *ssid, void *data);
+
+int wlan_manager_profile_modify_by_device_info(net_profile_info_t *profiles);
+
+STRENGTH_TYPES wlan_manager_get_signal_strength(int rssi);
+
+//// profile refresh /////////////////////////////////////////////
+void wlan_manager_scanned_profile_refresh(void);
+int wlan_manager_scanned_profile_refresh_with_count(int count);
+wifi_device_info_t *wlan_manager_profile_device_info_blank_create(void);
+
+int wlan_manager_network_syspopup_message(const char *title, const char *content, const char *type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WIFI_REQUEST_HANDLER_H__ */
diff --git a/sources/libraries/WlanManager/wlan-manager/wlan_manager.c b/sources/libraries/WlanManager/wlan-manager/wlan_manager.c
new file mode 100644
index 0000000..d01b6e0
--- /dev/null
+++ b/sources/libraries/WlanManager/wlan-manager/wlan_manager.c
@@ -0,0 +1,820 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <vconf-keys.h>
+#include <syspopup_caller.h>
+
+#include "common.h"
+#include "wlan_manager.h"
+#include "common_utils.h"
+#include "wifi-engine-callback.h"
+#include "common_invalid_password.h"
+
+typedef enum {
+ WLAN_MANAGER_REQ_TYPE_ACTIVATE,
+ WLAN_MANAGER_REQ_TYPE_DEACTIVATE,
+ WLAN_MANAGER_REQ_TYPE_SCAN,
+ WLAN_MANAGER_REQ_TYPE_SPECIFIC_SCAN,
+ WLAN_MANAGER_REQ_TYPE_BG_SCAN,
+ WLAN_MANAGER_REQ_TYPE_CONNECT,
+ WLAN_MANAGER_REQ_TYPE_WPS_CONNECT,
+} WLAN_MANAGER_REQUEST_TYPES;
+
+typedef struct {
+ WLAN_MANAGER_REQUEST_TYPES req_type;
+ wifi_ap_h ap;
+ void *user_data;
+} wlan_mgr_req_data_t;
+
+typedef struct {
+ int state;
+ wifi_ap_h *ap;
+} ap_state_info_t;
+
+wlan_mgr_req_data_t bg_scan_req_data;
+
+static void wlan_manager_register_cbs(void);
+static void wlan_manager_deregister_cbs(void);
+
+static wlan_manager_object* manager_object = NULL;
+
+wlan_manager_object* wlan_manager_get_singleton(void)
+{
+ if (NULL == manager_object) {
+ manager_object = g_new0(wlan_manager_object, 1);
+ manager_object->message_func = NULL;
+ manager_object->refresh_func = NULL;
+ }
+
+ return manager_object;
+}
+
+void wlan_manager_set_refresh_callback(wlan_manager_ui_refresh_func_t func)
+{
+ manager_object->refresh_func = func;
+}
+
+
+void* wlan_manager_create()
+{
+ wlan_manager_get_singleton();
+ return NULL;
+}
+
+int wlan_manager_destroy()
+{
+ int ret = WLAN_MANAGER_ERR_NONE;
+
+ _common_deregister_invalid_password_popup();
+
+ wlan_manager_deregister_cbs();
+
+ wifi_deinitialize();
+
+ if (manager_object != NULL) {
+ g_free(manager_object);
+ manager_object = NULL;
+ }
+
+ return ret;
+}
+
+int wlan_manager_start()
+{
+ __COMMON_FUNC_ENTER__;
+ switch (wifi_initialize()) {
+ case WIFI_ERROR_NONE:
+ /* Register the callbacks */
+ wlan_manager_register_cbs();
+ break;
+ case WIFI_ERROR_INVALID_OPERATION:
+ /* Register the callbacks */
+ wlan_manager_register_cbs();
+ return WLAN_MANAGER_ERR_ALREADY_REGISTERED;
+ default:
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+ return WLAN_MANAGER_ERR_NONE;
+}
+
+int wlan_manager_forget(wifi_ap_h ap)
+{
+ wifi_forget_ap(ap);
+ return WLAN_MANAGER_ERR_NONE;
+}
+
+static void wlan_manager_device_state_changed_cb(wifi_device_state_e state, void *user_data)
+{
+ __COMMON_FUNC_ENTER__;
+ wlan_mgr_event_info_t event_info;
+ memset(&event_info, 0, sizeof(event_info));
+ switch (state) {
+ case WIFI_DEVICE_STATE_ACTIVATED:
+ wlan_manager_enable_scan_result_update();
+ wlan_manager_register_cbs();
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_POWER_ON_OK;
+ break;
+ case WIFI_DEVICE_STATE_DEACTIVATED:
+ wlan_manager_deregister_cbs();
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_POWER_OFF_OK;
+ break;
+ default:
+ return;
+ }
+
+ manager_object->message_func(&event_info, user_data);
+
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+static void wlan_manager_connection_state_changed_cb(wifi_connection_state_e state, wifi_ap_h ap, void *user_data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (TRUE == manager_object->b_scan_blocked) {
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ wlan_mgr_event_info_t event_info;
+ memset(&event_info, 0, sizeof(event_info));
+
+ event_info.ap = ap;
+
+ switch (state) {
+ case WIFI_CONNECTION_STATE_DISCONNECTED: /**< Disconnected state */
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_DISCONNECTION_OK;
+ break;
+ case WIFI_CONNECTION_STATE_ASSOCIATION: /**< Association state */
+ case WIFI_CONNECTION_STATE_CONFIGURATION: /**< Configuration state */
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_CONNECTING;
+ break;
+ case WIFI_CONNECTION_STATE_CONNECTED: /**< Connected state */
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_OK;
+ break;
+ default:
+ return;
+ }
+
+ manager_object->message_func(&event_info, user_data);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void wlan_manager_rssi_level_changed_cb(
+ wifi_rssi_level_e rssi_level, void *user_data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (TRUE == manager_object->b_scan_blocked) {
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ wlan_mgr_event_info_t event_info;
+
+ memset(&event_info, 0, sizeof(event_info));
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_UPDATE_SIG_STR;
+ event_info.rssi_level = rssi_level;
+
+ manager_object->message_func(&event_info, user_data);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void wlan_manager_specific_scan_finished_cb(
+ wifi_error_e error_code, GSList *bss_info_list, void *user_data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ wlan_mgr_event_info_t event_info;
+ memset(&event_info, 0, sizeof(event_info));
+
+ if (WIFI_ERROR_NONE == error_code) {
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_SPECIFIC_SCAN_OK;
+ event_info.bss_info_list = bss_info_list;
+ } else
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_SPECIFIC_SCAN_FAIL;
+
+ manager_object->message_func(&event_info, user_data);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void wlan_manager_network_event_cb(
+ wifi_error_e error_code, void *user_data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ wlan_mgr_req_data_t *req_data = (wlan_mgr_req_data_t *)user_data;
+ if (req_data == NULL) {
+ ERROR_LOG(UG_NAME_ERR, "Request data is NULL !!!");
+
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ wlan_mgr_event_info_t event_info;
+ memset(&event_info, 0, sizeof(event_info));
+
+ switch (req_data->req_type) {
+ case WLAN_MANAGER_REQ_TYPE_ACTIVATE:
+ if (WIFI_ERROR_NONE == error_code) {
+ wlan_manager_enable_scan_result_update();
+ wlan_manager_register_cbs();
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_POWER_ON_OK;
+ } else
+ goto exit;
+
+ break;
+ case WLAN_MANAGER_REQ_TYPE_DEACTIVATE:
+ if (WIFI_ERROR_NONE == error_code) {
+ wlan_manager_deregister_cbs();
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_POWER_OFF_OK;
+ } else
+ goto exit;
+
+ break;
+ case WLAN_MANAGER_REQ_TYPE_SCAN:
+ if (WIFI_ERROR_NONE == error_code)
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_SCAN_OK;
+ else
+ goto exit;
+
+ break;
+ case WLAN_MANAGER_REQ_TYPE_SPECIFIC_SCAN:
+ if (WIFI_ERROR_NONE == error_code)
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_SPECIFIC_SCAN_OK;
+ else
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_SPECIFIC_SCAN_FAIL;
+
+ break;
+ case WLAN_MANAGER_REQ_TYPE_BG_SCAN:
+ if (WIFI_ERROR_NONE == error_code) {
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_SCAN_RESULT_IND;
+ manager_object->message_func(&event_info, req_data->user_data);
+ }
+
+ return; // The request data is static. So returning here.
+ case WLAN_MANAGER_REQ_TYPE_CONNECT:
+ event_info.ap = req_data->ap;
+
+ _common_deregister_invalid_password_popup();
+
+ if (WIFI_ERROR_NONE != error_code) {
+ if (_common_is_invalid_password() == TRUE)
+ event_info.event_type =
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_INVALID_KEY;
+ else
+ event_info.event_type =
+ WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_CONNECT_FAILED;
+ } else
+ goto exit;
+
+ break;
+ case WLAN_MANAGER_REQ_TYPE_WPS_CONNECT:
+ event_info.ap = req_data->ap;
+
+ if (WIFI_ERROR_NONE != error_code)
+ event_info.event_type = WLAN_MANAGER_RESPONSE_TYPE_WPS_ENROLL_FAIL;
+ else
+ goto exit;
+
+ break;
+ default:
+ goto exit;
+ }
+
+ manager_object->message_func(&event_info, req_data->user_data);
+
+exit:
+ if (req_data != NULL) {
+ wifi_ap_destroy(req_data->ap);
+ g_free(req_data);
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void wlan_manager_register_cbs(void)
+{
+ __COMMON_FUNC_ENTER__;
+ wifi_set_device_state_changed_cb(wlan_manager_device_state_changed_cb, NULL);
+ wifi_set_connection_state_changed_cb(wlan_manager_connection_state_changed_cb, NULL);
+ wifi_set_rssi_level_changed_cb(wlan_manager_rssi_level_changed_cb, NULL);
+
+ memset(&bg_scan_req_data, 0, sizeof(bg_scan_req_data));
+ bg_scan_req_data.req_type = WLAN_MANAGER_REQ_TYPE_BG_SCAN;
+ wifi_set_background_scan_cb(wlan_manager_network_event_cb, &bg_scan_req_data);
+
+ connman_request_register();
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void wlan_manager_deregister_cbs(void)
+{
+ __COMMON_FUNC_ENTER__;
+// wifi_unset_device_state_changed_cb();
+ wifi_unset_background_scan_cb();
+ wifi_unset_connection_state_changed_cb();
+ wifi_unset_rssi_level_changed_cb();
+ wifi_unset_specific_scan_cb();
+ connman_request_deregister();
+ __COMMON_FUNC_EXIT__;
+}
+
+void wlan_manager_set_message_callback(wlan_event_handler func)
+{
+ manager_object->message_func = func;
+}
+
+static bool wifi_found_ap_with_state_cb(wifi_ap_h ap, void* user_data)
+{
+ wifi_connection_state_e state;
+ ap_state_info_t *ap_state_info = (ap_state_info_t *)user_data;
+ bool found_match = false;
+
+ if (WIFI_ERROR_NONE != wifi_ap_get_connection_state(ap, &state))
+ return true; // continue with next AP
+
+ switch (ap_state_info->state) {
+ case WLAN_MANAGER_UNCONNECTED:
+ if (WIFI_CONNECTION_STATE_DISCONNECTED == state) {
+ /* Found a match, so terminate the loop */
+ found_match = true;
+ }
+ break;
+ case WLAN_MANAGER_CONNECTING:
+ if (WIFI_CONNECTION_STATE_ASSOCIATION == state ||
+ WIFI_CONNECTION_STATE_CONFIGURATION == state) {
+ /* Found a match, so terminate the loop */
+ found_match = true;
+ }
+ break;
+ case WLAN_MANAGER_CONNECTED:
+ if (WIFI_CONNECTION_STATE_CONNECTED == state) {
+ /* Found a match, so terminate the loop */
+ found_match = true;
+ }
+ break;
+ default:
+ ERROR_LOG(COMMON_NAME_ERR, "Unknown state : %d", ap_state_info->state);
+ return false;
+ }
+
+ if (true == found_match) {
+ if (ap_state_info->ap) {
+ wifi_ap_clone(ap_state_info->ap, ap);
+ }
+ INFO_LOG(COMMON_NAME_LIB, "Found an AP[0x%x] in the state %d", ap, ap_state_info->state);
+ return false; // found the match, so terminate the loop.
+ }
+ return true;
+}
+
+wifi_ap_h wlan_manager_get_ap_with_state(int ap_state)
+{
+ ap_state_info_t ap_state_info;
+ wifi_ap_h ap = NULL;
+
+ ap_state_info.state = ap_state;
+ ap_state_info.ap = &ap;
+
+ wifi_foreach_found_aps (wifi_found_ap_with_state_cb, &ap_state_info);
+
+ return ap;
+}
+
+int wlan_manager_state_get(void)
+{
+ int ret_val = 0;
+ wifi_connection_state_e connection_state;
+ bool activated;
+
+ if (WIFI_ERROR_NONE != wifi_is_activated(&activated))
+ return WLAN_MANAGER_ERROR;
+ else if (false == activated) {
+ INFO_LOG(COMMON_NAME_LIB, "STATE: WIFI_OFF");
+
+ return WLAN_MANAGER_OFF;
+ }
+
+ ret_val = wifi_get_connection_state(&connection_state);
+ if (WIFI_ERROR_NONE != ret_val)
+ return WLAN_MANAGER_ERROR;
+
+ switch (connection_state) {
+ case WIFI_CONNECTION_STATE_DISCONNECTED:
+ INFO_LOG(COMMON_NAME_LIB, "STATE: WIFI_DISCONNECTED");
+
+ ret_val = WLAN_MANAGER_UNCONNECTED;
+ break;
+ case WIFI_CONNECTION_STATE_ASSOCIATION:
+ case WIFI_CONNECTION_STATE_CONFIGURATION:
+ INFO_LOG(COMMON_NAME_LIB, "STATE: WIFI_CONNECTING");
+
+ ret_val = WLAN_MANAGER_CONNECTING;
+ break;
+ case WIFI_CONNECTION_STATE_CONNECTED:
+ INFO_LOG(COMMON_NAME_LIB, "STATE: WIFI_CONNECTED");
+
+ ret_val = WLAN_MANAGER_CONNECTED;
+ break;
+ default:
+ ERROR_LOG(COMMON_NAME_ERR, "Unknown state: %d", connection_state);
+
+ ret_val = WLAN_MANAGER_ERROR;
+ break;
+ }
+
+ return ret_val;
+}
+
+int wlan_manager_request_power_on(void)
+{
+ __COMMON_FUNC_ENTER__;
+
+ INFO_LOG(UG_NAME_REQ, "power on");
+
+ int ret = 0;
+ int hot_spot_mode =
+ common_util_get_system_registry("memory/mobile_hotspot/mode");
+ if (hot_spot_mode < 0) {
+ INFO_LOG(COMMON_NAME_LIB, "FAILED to get the mobile hotspot mode");
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ } else if (VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI & hot_spot_mode) {
+ INFO_LOG(COMMON_NAME_LIB, "mobile_hotspot wifi ON");
+
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_MOBILE_HOTSPOT_OCCUPIED;
+ }
+
+ INFO_LOG(UG_NAME_REQ, "Mobile hotspot mode = %d\n", hot_spot_mode);
+
+ wlan_mgr_req_data_t *req_data = g_new0(wlan_mgr_req_data_t, 1);
+ req_data->req_type = WLAN_MANAGER_REQ_TYPE_ACTIVATE;
+ ret = wifi_activate(wlan_manager_network_event_cb, req_data);
+ if (WIFI_ERROR_NONE != ret) {
+ ERROR_LOG(UG_NAME_REQ, "Power on request. Error Reason [%d]", ret);
+ g_free(req_data);
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_NONE;
+}
+
+int wlan_manager_request_power_off(void)
+{
+ __COMMON_FUNC_ENTER__;
+ wlan_mgr_req_data_t *req_data = g_new0(wlan_mgr_req_data_t, 1);
+ req_data->req_type = WLAN_MANAGER_REQ_TYPE_DEACTIVATE;
+ int ret = wifi_deactivate(wlan_manager_network_event_cb, req_data);
+ if (WIFI_ERROR_NONE != ret) {
+ ERROR_LOG(UG_NAME_REQ, "Power off request. Error Reason [%d]", ret);
+ g_free(req_data);
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_NONE;
+}
+
+int wlan_manager_request_wps_connection(wifi_ap_h ap)
+{
+ __COMMON_FUNC_ENTER__;
+ wlan_mgr_req_data_t *req_data = g_new0(wlan_mgr_req_data_t, 1);
+ req_data->req_type = WLAN_MANAGER_REQ_TYPE_WPS_CONNECT;
+ wifi_ap_clone(&(req_data->ap), ap);
+
+ int ret = wifi_connect_by_wps_pbc(req_data->ap, wlan_manager_network_event_cb, req_data);
+ if (WIFI_ERROR_NONE != ret) {
+ ERROR_LOG(UG_NAME_REQ, "WPS Connect failed. Error Reason [%d]", ret);
+ wifi_ap_destroy(req_data->ap);
+ g_free(req_data);
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_NONE;
+}
+
+int wlan_manager_request_connection(wifi_ap_h ap)
+{
+ __COMMON_FUNC_ENTER__;
+
+ bool favourite;
+ int ret = wifi_ap_is_favorite(ap, &favourite);
+ wifi_security_type_e sec_type;
+ if (WIFI_ERROR_NONE != ret) {
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_NOSERVICE;
+ }
+
+ if (false == favourite) {
+ if (WIFI_ERROR_NONE != wifi_ap_get_security_type(ap, &sec_type)) {
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_NOSERVICE;
+ }
+
+ if (WIFI_SECURITY_TYPE_EAP == sec_type) {
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_CONNECT_EAP_SEC_TYPE;
+ } else if (WIFI_SECURITY_TYPE_NONE == sec_type) {
+ /* Allow Open APs to connect */
+ } else {
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_CONNECT_PASSWORD_NEEDED;
+ }
+ }
+
+ INFO_LOG(UG_NAME_REQ, "All OK to connect to ap[0x%x]", ap);
+
+ wlan_mgr_req_data_t *req_data = g_new0(wlan_mgr_req_data_t, 1);
+ req_data->req_type = WLAN_MANAGER_REQ_TYPE_CONNECT;
+ wifi_ap_clone(&(req_data->ap), ap);
+
+ _common_register_invalid_password_popup();
+ ret = wifi_connect(req_data->ap, wlan_manager_network_event_cb, req_data);
+ if (WIFI_ERROR_NONE != ret) {
+ _common_deregister_invalid_password_popup();
+
+ ERROR_LOG(UG_NAME_REQ, "Connect failed. Error Reason [%d]", ret);
+
+ wifi_ap_destroy(req_data->ap);
+ g_free(req_data);
+
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_NONE;
+}
+
+int wlan_manager_connect_with_password(wifi_ap_h ap, const char *pass_phrase)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!ap) {
+ ERROR_LOG(UG_NAME_SCAN, "AP handler is NULL");
+ return WLAN_MANAGER_ERR_INVALID_PARAM;
+ }
+
+ int ret = wifi_ap_set_passphrase(ap, pass_phrase);
+ if (WIFI_ERROR_NONE != ret) {
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+
+ wlan_mgr_req_data_t *req_data = g_new0(wlan_mgr_req_data_t, 1);
+ req_data->req_type = WLAN_MANAGER_REQ_TYPE_CONNECT;
+ wifi_ap_clone(&(req_data->ap), ap);
+
+ _common_register_invalid_password_popup();
+ ret = wifi_connect(req_data->ap, wlan_manager_network_event_cb, req_data);
+ if (WIFI_ERROR_NONE != ret) {
+ _common_deregister_invalid_password_popup();
+
+ ERROR_LOG(UG_NAME_REQ, "Connect failed. Error Reason [%d]", ret);
+
+ wifi_ap_destroy(req_data->ap);
+ g_free(req_data);
+
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_NONE;
+}
+
+int wlan_manager_connect_with_wifi_info(wifi_ap_h ap)
+{
+ __COMMON_FUNC_ENTER__;
+
+ int ret;
+
+ INFO_LOG(UG_NAME_REQ, "All OK to connect to ap[0x%x]", ap);
+
+ wlan_mgr_req_data_t *req_data = g_new0(wlan_mgr_req_data_t, 1);
+ req_data->req_type = WLAN_MANAGER_REQ_TYPE_CONNECT;
+ wifi_ap_clone(&(req_data->ap), ap);
+
+ _common_register_invalid_password_popup();
+ ret = wifi_connect(req_data->ap, wlan_manager_network_event_cb, req_data);
+ if (WIFI_ERROR_NONE != ret) {
+ _common_deregister_invalid_password_popup();
+
+ ERROR_LOG(UG_NAME_REQ, "Connect failed. Error Reason [%d]", ret);
+
+ wifi_ap_destroy(req_data->ap);
+ g_free(req_data);
+
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_NONE;
+}
+
+int wlan_manager_request_disconnection(wifi_ap_h ap)
+{
+ __COMMON_FUNC_ENTER__;
+ int ret;
+
+ INFO_LOG(UG_NAME_REQ, "Request disconnection for ap [0x%x]", ap);
+
+ ret = wifi_disconnect(ap, NULL, NULL);
+ if (WIFI_ERROR_NONE != ret) {
+ ERROR_LOG(UG_NAME_REQ, "Disconnect failed. Error Reason [%d]", ret);
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return WLAN_MANAGER_ERR_NONE;
+}
+
+int wlan_manager_request_scan(void)
+{
+ __COMMON_FUNC_ENTER__;
+
+ wlan_mgr_req_data_t *req_data = g_new0(wlan_mgr_req_data_t, 1);
+ req_data->req_type = WLAN_MANAGER_REQ_TYPE_SCAN;
+
+ int ret = wifi_scan(wlan_manager_network_event_cb, req_data);
+ if (ret != WLAN_MANAGER_ERR_NONE) {
+ ERROR_LOG(UG_NAME_REQ, "Scan failed. Ret: %d", ret);
+
+ g_free(req_data);
+
+ __COMMON_FUNC_EXIT__;
+ return ret;
+ }
+
+ /* Since the scan request was success,
+ * lets reset the ui refresh and scan update blocked flags.
+ */
+ manager_object->b_scan_blocked = FALSE;
+ manager_object->b_ui_refresh = FALSE;
+
+ __COMMON_FUNC_EXIT__;
+ return ret;
+}
+
+int wlan_manager_request_specific_scan(const char *ssid, void *user_data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ wifi_set_specific_scan_cb(wlan_manager_specific_scan_finished_cb, user_data);
+
+ int ret = connman_request_specific_scan(ssid);
+ if (ret != WLAN_MANAGER_ERR_NONE) {
+ ERROR_LOG(UG_NAME_REQ, "Specific Scan failed. Ret: %d", ret);
+
+ __COMMON_FUNC_EXIT__;
+ return ret;
+ }
+
+ /* Since the scan request was success,
+ * lets reset the ui refresh and scan update blocked flags.
+ */
+ manager_object->b_scan_blocked = FALSE;
+ manager_object->b_ui_refresh = FALSE;
+
+ __COMMON_FUNC_EXIT__;
+ return ret;
+}
+
+int wlan_manager_scanned_profile_refresh_with_count(int count)
+{
+ __COMMON_FUNC_ENTER__;
+
+ manager_object->refresh_func();
+
+ __COMMON_FUNC_EXIT__;
+ return 0;
+}
+
+void wlan_manager_scanned_profile_refresh(void)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (FALSE == manager_object->b_scan_blocked) {
+ manager_object->refresh_func();
+ DEBUG_LOG(COMMON_NAME_LIB, "success profiles update");
+ } else {
+ manager_object->b_ui_refresh = TRUE;
+ DEBUG_LOG(COMMON_NAME_LIB, "Scan update is blocked");
+ }
+ __COMMON_FUNC_EXIT__;
+}
+
+STRENGTH_TYPES wlan_manager_get_signal_strength(int rssi)
+{
+ /* Wi-Fi Signal Strength Display (dB / ConnMan normalized value)
+ *
+ * Excellent : -63 ~ / 57 ~
+ * Good: -74 ~ -64 / 46 ~ 56
+ * Weak: -82 ~ -75 / 38 ~ 45
+ * Very weak: ~ -83 / ~ 37
+ */
+ if (rssi >= 57) {
+ return SIGNAL_STRENGTH_TYPE_EXCELLENT;
+ } else if (rssi >= 46) {
+ return SIGNAL_STRENGTH_TYPE_GOOD;
+ } else if (rssi >= 38) {
+ return SIGNAL_STRENGTH_TYPE_WEAK;
+ } else {
+ return SIGNAL_STRENGTH_TYPE_VERY_WEAK;
+ }
+}
+
+wifi_device_info_t* wlan_manager_profile_device_info_blank_create()
+{
+ __COMMON_FUNC_ENTER__;
+ wifi_device_info_t *di_s0 = g_new0(wifi_device_info_t, 1);
+
+ if (di_s0 == NULL) {
+ ERROR_LOG(UG_NAME_NORMAL, "Error!!! Failed to allocate memory\n");
+ __COMMON_FUNC_EXIT__;
+ return NULL;
+ }
+
+ char No_AP_found[] = "No AP found";
+
+ di_s0->ssid = g_strdup(No_AP_found);
+ if (NULL == di_s0->ssid) {
+ g_free(di_s0);
+ di_s0 = NULL;
+ ERROR_LOG(UG_NAME_NORMAL, "Error!!! Failed to allocate memory\n");
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return di_s0;
+}
+
+static Eina_Bool _refresh_ui(void *data)
+{
+ manager_object->refresh_func();
+ manager_object->b_scan_blocked = FALSE;
+ manager_object->b_ui_refresh = FALSE;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void wlan_manager_enable_scan_result_update(void)
+{
+ if (TRUE == manager_object->b_scan_blocked) {
+ if (TRUE == manager_object->b_ui_refresh) {
+ DEBUG_LOG(COMMON_NAME_LIB, "Refresh the UI with last scan update");
+
+ /* We delay the rendering inorder to get smooth effect of popup close */
+ ecore_idler_add(_refresh_ui, NULL);
+ } else {
+ manager_object->b_scan_blocked = FALSE;
+ }
+ }
+}
+
+void wlan_manager_disable_scan_result_update(void)
+{
+ manager_object->b_scan_blocked = TRUE;
+}
+
+char *wlan_manager_get_connected_ssid(void)
+{
+ wifi_ap_h ap;
+ char *essid = NULL;
+
+ wifi_get_connected_ap(&ap);
+ if (ap) {
+ wifi_ap_get_essid(ap, &essid);
+ }
+
+ wifi_ap_destroy(ap);
+
+ return essid;
+}
diff --git a/sources/libraries/appcoreWrapper/appcoreWrapper.c b/sources/libraries/appcoreWrapper/appcoreWrapper.c
new file mode 100644
index 0000000..13eed73
--- /dev/null
+++ b/sources/libraries/appcoreWrapper/appcoreWrapper.c
@@ -0,0 +1,69 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <Ecore_X.h>
+#include <Elementary.h>
+
+#include "common.h"
+#include "appcoreWrapper.h"
+
+void appcore_win_del(void *data, Evas_Object *obj, void *event)
+{
+ INFO_LOG(UG_NAME_NORMAL, "win_del");
+ elm_exit();
+}
+
+Evas_Object* appcore_create_win(const char *name)
+{
+ Evas_Object *eo;
+ int w, h;
+
+ eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (eo) {
+ elm_win_title_set(eo, name);
+ elm_win_borderless_set(eo, EINA_TRUE);
+ evas_object_smart_callback_add(eo, "delete,request",
+ (Evas_Smart_Cb)appcore_win_del, NULL);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(),
+ &w, &h);
+ evas_object_resize(eo, w, h);
+ }
+
+ return eo;
+}
+
+Evas_Object* appcore_load_edj(Evas_Object *parent, const char *file, const char *group)
+{
+ Evas_Object *eo;
+ int r;
+
+ eo = elm_layout_add(parent);
+ if (eo) {
+ r = elm_layout_file_set(eo, file, group);
+ if (!r) {
+ evas_object_del(eo);
+ return NULL;
+ }
+
+ evas_object_size_hint_weight_set(eo,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ }
+
+ return eo;
+}
diff --git a/sources/libraries/appcoreWrapper/include/appcoreWrapper.h b/sources/libraries/appcoreWrapper/include/appcoreWrapper.h
new file mode 100644
index 0000000..0eef3d8
--- /dev/null
+++ b/sources/libraries/appcoreWrapper/include/appcoreWrapper.h
@@ -0,0 +1,38 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __APPCORE_WRAPPER_H__
+#define __APPCORE_WRAPPER_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <Evas.h>
+
+void appcore_win_del(void *data, Evas_Object *obj, void *event);
+Evas_Object* appcore_create_win(const char *name);
+Evas_Object* appcore_load_edj(Evas_Object *parent, const char *file,const char *group);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __APPCORE_WRAPPER_H__ */
diff --git a/sources/libraries/i18nManager/i18nmanager.c b/sources/libraries/i18nManager/i18nmanager.c
new file mode 100644
index 0000000..7a3296c
--- /dev/null
+++ b/sources/libraries/i18nManager/i18nmanager.c
@@ -0,0 +1,227 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "i18nmanager.h"
+#include <libintl.h>
+#include <stdio.h>
+#include <string.h>
+
+static char* apply_i18n(const char *pkg_name, I18N_MODES mode, const char *string)
+{
+ switch (mode) {
+ case I18N_MODE_SELF_MADE:
+ return (char*) dgettext(pkg_name, string);
+ case I18N_MODE_NO_NEEDED:
+ return (char*) gettext(string);
+ default:
+ return "(debug)applying_i18n_failed";
+ }
+}
+
+static char* i18n_get_text_by_system(I18N_TYPES type){
+ switch (type) {
+ case I18N_TYPE_Ok:
+ return (char*)dgettext("sys_string", "IDS_COM_SK_OK");
+ case I18N_TYPE_Yes:
+ return (char*)dgettext("sys_string", "IDS_COM_SK_YES");
+ case I18N_TYPE_No:
+ return (char*)dgettext("sys_string", "IDS_COM_SK_NO");
+ case I18N_TYPE_Save:
+ return (char*)dgettext("sys_string", "IDS_COM_OPT_SAVE");
+ case I18N_TYPE_Done:
+ return (char*)dgettext("sys_string", "IDS_COM_SK_DONE");
+ case I18N_TYPE_Back:
+ return (char*)dgettext("sys_string", "IDS_COM_BODY_BACK");
+ case I18N_TYPE_Cancel:
+ return (char*)dgettext("sys_string", "IDS_COM_SK_CANCEL");
+ case I18N_TYPE_Activating:
+ return (char*)dgettext("sys_string", "IDS_COM_POP_ACTIVATING");
+ case I18N_TYPE_Connecting:
+ return (char*)dgettext("sys_string", "IDS_COM_POP_CONNECTING");
+ case I18N_TYPE_Connected:
+ return (char*)dgettext("sys_string", "IDS_COM_POP_CONNECTED");
+ case I18N_TYPE_Searching:
+ return (char*)dgettext("sys_string", "IDS_COM_POP_SEARCHING");
+ case I18N_TYPE_Wi_Fi:
+ return (char*)dgettext("sys_string", "IDS_COM_BODY_WI_FI");
+ case I18N_TYPE_Name:
+ return (char*)dgettext("sys_string", "IDS_COM_BODY_DETAILS_NAME");
+ case I18N_TYPE_Password:
+ return (char*)dgettext("sys_string", "IDS_COM_BODY_PASSWORD");
+ case I18N_TYPE_Details:
+ return (char*)dgettext("sys_string", "IDS_COM_BODY_DETAILS");
+ default:
+ return "(debug)system_text_failed";
+ }
+}
+
+char* i18n_manager_get_text(const char *pkg_name, I18N_TYPES type)
+{
+ switch (type) {
+ case I18N_TYPE_Ok:
+ case I18N_TYPE_Yes:
+ case I18N_TYPE_No:
+ case I18N_TYPE_Save:
+ case I18N_TYPE_Done:
+ case I18N_TYPE_Back:
+ case I18N_TYPE_Cancel:
+ case I18N_TYPE_Name:
+ case I18N_TYPE_Wi_Fi:
+ case I18N_TYPE_Password:
+ case I18N_TYPE_Activating:
+ case I18N_TYPE_Connecting:
+ case I18N_TYPE_Connected:
+ case I18N_TYPE_Searching:
+ case I18N_TYPE_Details:
+ return i18n_get_text_by_system(type);
+ case I18N_TYPE_Provisioning:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_PROVISIONING");
+ case I18N_TYPE_Ca_Certificate:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_CA_CERTIFICATE");
+ case I18N_TYPE_User_Certificate:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_USER_CERTIFICATE_ABB");
+ case I18N_TYPE_Unspecified:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_UNSPECIFIED");
+ case I18N_TYPE_Unknown:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_UNKNOWN");
+ case I18N_TYPE_Enter_Ssid:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_ENTER_SSID");
+ case I18N_TYPE_Identity:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_IDENTITY");
+ case I18N_TYPE_Anonymous_Identity:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_ANONYMOUS_IDENTITY");
+ case I18N_TYPE_Wifi_Opt_Find_Hidden_Network:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_OPT_FIND_HIDDEN_NETWORK");
+ case I18N_TYPE_WPS_Button_Connection:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_WPS_BUTTON_CONNECTION");
+ case I18N_TYPE_Press_WPS_On_Your_Wi_Fi_Access_Point:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_PRESS_WPS_ON_YOUR_WI_FI_ACCESS_POINT_WITHIN_2_MINUTES");
+ case I18N_TYPE_Button_Cancel:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BUTTON_CANCEL");
+ case I18N_TYPE_Ssid:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_SSID");
+ case I18N_TYPE_Find_Hidden_Network:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_OPT_FIND_HIDDEN_NETWORK");
+
+
+ case I18N_TYPE_Connect:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_CONNECT");
+ case I18N_TYPE_Scan:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_SCAN");
+ case I18N_TYPE_Forget:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_SK_FORGET");
+ case I18N_TYPE_Dynamic_IP:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_DYNAMIC_IP");
+ case I18N_TYPE_Static_IP:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_STATIC_IP");
+ case I18N_TYPE_Security_type:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_SECURITY_TYPE");
+ case I18N_TYPE_Excellent:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_EXCELLENT");
+ case I18N_TYPE_Good:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_GOOD_M_STRENGTH");
+ case I18N_TYPE_Week:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_WEAK_M_STRENGTH");
+ case I18N_TYPE_Disconnecting:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_DISCONNECTING_ING");
+ case I18N_TYPE_Hidden_AP:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_HEADER_HIDDEN_NETWORK");
+ case I18N_TYPE_Add_WiFi_network:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_ADD_WI_FI_NETWORK");
+ case I18N_TYPE_No_AP:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_NO_APS");
+ case I18N_TYPE_Signal_strength:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_SIGNAL_STRENGTH");
+ case I18N_TYPE_IP_address:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_IP_ADDRESS");
+ case I18N_TYPE_Proxy_address:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_HEADER_PROXY_ADDRESS");
+ case I18N_TYPE_Subnet_mask:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_SUBNET_MASK");
+ case I18N_TYPE_DNS_1:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_DNS_1");
+ case I18N_TYPE_DNS_2:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_DNS_2");
+ case I18N_TYPE_WEP:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_SECURITYTYPE_WEP");
+ case I18N_TYPE_Gateway:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_GATEWAY");
+ case I18N_TYPE_Gateway_address:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_GATEWAY_ADDRESS");
+ case I18N_TYPE_Deactivating:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_POP_DEACTIVATING_WI_FI_ING");
+ case I18N_TYPE_No_security:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_CONFIGURATION_NO_SECURITY");
+ case I18N_TYPE_Network_SSID:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_NETWORK_SSID");
+ case I18N_TYPE_Network_notification:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_NETWORK_NOTIFICATION");
+ case I18N_TYPE_Network_notify_me_later:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_NOTIFY_WHEN_WI_FI_NETWORK_IS_FOUND");
+ case I18N_TYPE_Select_network:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_HEADER_SELECT_NETWORK");
+ case I18N_TYPE_WiFi_network:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_WI_FI_NETWORKS");
+ case I18N_TYPE_Enter_password:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_ENTER_PASSWORD");
+ case I18N_TYPE_Enter_Identity:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_ENTER_IDENTITY");
+ case I18N_TYPE_Enter_Anonymous_Identity:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_ENTER_ANONYMOUS_IDENTITY");
+ case I18N_TYPE_Input_password:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_CST_BODY_INPUT_PASSWORD");
+ case I18N_TYPE_Show_password:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_SHOW_PASSWORD");
+ case I18N_TYPE_Autonomous_connection_to_s_will_be_turned_off_Continue:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_POP_AUTOMATIC_CONNECTION_NETWORK_WILL_DISABLED_CONTINUE_Q_MSG");
+ case I18N_TYPE_Open:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_POP_OPEN");
+ case I18N_TYPE_WPS_Available:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_WPS_AVAILABLE");
+ case I18N_TYPE_Secured:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_SECURED_ABB_M_WIFI_AP_SUMMARY");
+ case I18N_TYPE_Obtaining_IP_addr:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_OBTAINING_IP_ADDRESS_ING");
+ case I18N_TYPE_Channel:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_CHANNEL");
+ case I18N_TYPE_MAC_addr:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_MAC_ADDRESS");
+ case I18N_TYPE_Proxy_port:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_PROXY_PORT");
+ case I18N_TYPE_EAP:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_EAP");
+ case I18N_TYPE_EAP_method:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_EAP_METHOD");
+ case I18N_TYPE_Phase_2_authentication:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_COM_BODY_PHASE_2_AUTHENTICATION");
+ case I18N_TYPE_Activating_WiFi:
+ return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_POP_ACTIVATING_WI_FI_ING");
+ case I18N_TYPE_WPA_PSK:
+ return apply_i18n(pkg_name, I18N_MODE_NO_NEEDED, "WPA-PSK");
+ case I18N_TYPE_WPA2_PSK:
+ return apply_i18n(pkg_name, I18N_MODE_NO_NEEDED, "WPA2-PSK");
+ case I18N_TYPE_WPA_EAP:
+ return apply_i18n(pkg_name, I18N_MODE_NO_NEEDED, "WPA-EAP");
+ case I18N_TYPE_WPA2_EAP:
+ return apply_i18n(pkg_name, I18N_MODE_NO_NEEDED, "WPA2-EAP");
+
+ default:
+ return apply_i18n(pkg_name, I18N_MODE_NO_NEEDED, "(debugapplying_i18n_failed");
+ }
+}
diff --git a/sources/libraries/i18nManager/include/i18nmanager.h b/sources/libraries/i18nManager/include/i18nmanager.h
new file mode 100644
index 0000000..efd8a5d
--- /dev/null
+++ b/sources/libraries/i18nManager/include/i18nmanager.h
@@ -0,0 +1,130 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __I18NMANAGER_H__
+#define __I18NMANAGER_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define sc(pkg_name, I18N_TYPE) i18n_manager_get_text(pkg_name, I18N_TYPE)
+
+typedef enum {
+ I18N_MODE_SELF_MADE, /* self made, reserve to add platform string convert service */
+ I18N_MODE_NO_NEEDED, /* No need to convert other language */
+ I18N_MODE_MAX
+} I18N_MODES;
+
+typedef enum {
+ I18N_TYPE_Ok,
+ I18N_TYPE_Yes,
+ I18N_TYPE_No,
+ I18N_TYPE_Save,
+ I18N_TYPE_Done,
+ I18N_TYPE_Back,
+ I18N_TYPE_Cancel,
+ I18N_TYPE_Scan,
+ I18N_TYPE_Forget,
+ I18N_TYPE_User_ID,
+ I18N_TYPE_IP_address,
+ I18N_TYPE_Static_IP,
+ I18N_TYPE_Dynamic_IP,
+ I18N_TYPE_Proxy_address,
+ I18N_TYPE_Details,
+ I18N_TYPE_Name,
+ I18N_TYPE_Signal_strength,
+ I18N_TYPE_Excellent,
+ I18N_TYPE_Good,
+ I18N_TYPE_Week,
+ I18N_TYPE_No_security,
+ I18N_TYPE_Subnet_mask,
+ I18N_TYPE_Gateway,
+ I18N_TYPE_Gateway_address,
+ I18N_TYPE_Wi_Fi,
+ I18N_TYPE_Password,
+ I18N_TYPE_Activating,
+ I18N_TYPE_Deactivating,
+ I18N_TYPE_Searching,
+ I18N_TYPE_Connect,
+ I18N_TYPE_Connecting,
+ I18N_TYPE_Connected,
+ I18N_TYPE_Disconnecting,
+ I18N_TYPE_Connection_Lost,
+ I18N_TYPE_Network_SSID,
+ I18N_TYPE_Network_notification,
+ I18N_TYPE_Network_notify_me_later,
+ I18N_TYPE_Select_network,
+ I18N_TYPE_WiFi_network,
+ I18N_TYPE_Enter_password,
+ I18N_TYPE_Enter_Identity,
+ I18N_TYPE_Enter_Anonymous_Identity,
+ I18N_TYPE_Input_password,
+ I18N_TYPE_Show_password,
+ I18N_TYPE_Add_WiFi_network,
+ I18N_TYPE_EAP,
+ I18N_TYPE_EAP_method,
+ I18N_TYPE_Phase_2_authentication,
+ I18N_TYPE_Activating_WiFi,
+
+ I18N_TYPE_Provisioning,
+ I18N_TYPE_Ca_Certificate,
+ I18N_TYPE_User_Certificate,
+ I18N_TYPE_Unspecified,
+ I18N_TYPE_Unknown,
+ I18N_TYPE_Enter_Ssid,
+ I18N_TYPE_Identity,
+ I18N_TYPE_Anonymous_Identity,
+ I18N_TYPE_Wifi_Opt_Find_Hidden_Network,
+ I18N_TYPE_WPS_Button_Connection,
+ I18N_TYPE_Press_WPS_On_Your_Wi_Fi_Access_Point,
+ I18N_TYPE_Button_Cancel,
+ I18N_TYPE_Ssid,
+ I18N_TYPE_Find_Hidden_Network,
+
+/* etc */
+ I18N_TYPE_DNS_1,
+ I18N_TYPE_DNS_2,
+ I18N_TYPE_WEP,
+ I18N_TYPE_WPA_PSK,
+ I18N_TYPE_WPA2_PSK,
+ I18N_TYPE_WPA_EAP,
+ I18N_TYPE_WPA2_EAP,
+ I18N_TYPE_Hidden_AP,
+ I18N_TYPE_No_AP,
+ I18N_TYPE_Security_type,
+ I18N_TYPE_Autonomous_connection_to_s_will_be_turned_off_Continue,
+ I18N_TYPE_Open,
+ I18N_TYPE_WPS_Available,
+ I18N_TYPE_Secured,
+ I18N_TYPE_Obtaining_IP_addr,
+ I18N_TYPE_Channel,
+ I18N_TYPE_MAC_addr,
+ I18N_TYPE_Proxy_port,
+ I18N_TYPE_MAX
+} I18N_TYPES;
+
+char* i18n_manager_get_text(const char *pkg_name, I18N_TYPES type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/libraries/settingWrapper/include/wifi-setting.h b/sources/libraries/settingWrapper/include/wifi-setting.h
new file mode 100644
index 0000000..9c36df1
--- /dev/null
+++ b/sources/libraries/settingWrapper/include/wifi-setting.h
@@ -0,0 +1,34 @@
+/*
+* Wi-Fi UG
+*
+* Copyright 2012 Samsung Electronics Co., Ltd
+
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+
+* http://www.tizenopensource.org/license
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+
+
+#ifndef _WIFI_SETTING_H_
+#define _WIFI_SETTING_H_
+
+#include <vconf-keys.h>
+
+#define WIFI_SETTING_WIFI_CONNECTED_AP_NAME VCONFKEY_WIFI_CONNECTED_AP_NAME
+
+int wifi_setting_value_set(const char *key, int value);
+int wifi_setting_value_get(const char *key);
+
+int wifi_setting_key_notify_set();
+
+#endif //_WIFI_SETTING_H_
diff --git a/sources/libraries/settingWrapper/wifi-setting.c b/sources/libraries/settingWrapper/wifi-setting.c
new file mode 100644
index 0000000..6c63bd3
--- /dev/null
+++ b/sources/libraries/settingWrapper/wifi-setting.c
@@ -0,0 +1,75 @@
+/*
+* Wi-Fi UG
+*
+* Copyright 2012 Samsung Electronics Co., Ltd
+
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+
+* http://www.tizenopensource.org/license
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+
+
+#include <vconf.h>
+#include "wifi-setting.h"
+#include "common.h"
+
+int wifi_setting_value_set(const char *key, int value)
+{
+ __COMMON_FUNC_ENTER__;
+
+ INFO_LOG(UG_NAME_NORMAL, "setting value : %d\n", value);
+
+ if (vconf_set_int(key, value) < 0) {
+ ERROR_LOG(UG_NAME_NORMAL, "Failed to set vconf\n");
+ __COMMON_FUNC_EXIT__;
+ return -1;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return 0;
+}
+
+int wifi_setting_value_get(const char *key)
+{
+ __COMMON_FUNC_ENTER__;
+
+ int value = 0;
+ if (vconf_get_int(key, &value) < 0) {
+ ERROR_LOG(UG_NAME_NORMAL, "Failed to get vconf\n");
+ __COMMON_FUNC_EXIT__;
+ return -1;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return value;
+}
+
+static void wifi_flight_mode_changed(keynode_t* node, void* user_data)
+{
+ INFO_LOG(UG_NAME_NORMAL, "Airplane mode [%s] \n", node);
+ return;
+}
+
+static void mobile_hotspot_status(keynode_t* node, void* user_data)
+{
+ INFO_LOG(UG_NAME_NORMAL, "MobileAP mode [%s] \n", node);
+}
+
+int wifi_setting_key_notify_set()
+{
+ vconf_notify_key_changed(VCONFKEY_SETAPPL_FLIGHT_MODE_BOOL, (vconf_callback_fn) wifi_flight_mode_changed, NULL);
+ vconf_notify_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE, (vconf_callback_fn) mobile_hotspot_status, NULL);
+
+ return TRUE;
+}
+
diff --git a/sources/ui-gadget/CMakeLists.txt b/sources/ui-gadget/CMakeLists.txt
new file mode 100644
index 0000000..c354c22
--- /dev/null
+++ b/sources/ui-gadget/CMakeLists.txt
@@ -0,0 +1,56 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(ug-wifi-efl-UG C)
+
+# defines
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include")
+SET(VERSION 0.1.0)
+
+# source files
+SET(SRCS
+ ../libraries/i18nManager/i18nmanager.c
+ ../libraries/appcoreWrapper/appcoreWrapper.c
+ ../libraries/WlanManager/wlan-manager/wlan_manager.c
+ ../libraries/Common/common_utils.c
+ ../libraries/Common/common_ip_info.c
+ ../libraries/Common/common_pswd_popup.c
+ ../libraries/Common/common_eap_connect.c
+ ../libraries/Common/common_invalid_password.c
+ ${ENGINE_SOURCES}
+ wifi-efl-UG.c
+ viewers-layout/viewer_manager.c
+ viewers-layout/wifi_viewer_list.c
+ viewers-layout/view_detail.c
+ viewers-layout/view_ime_hidden.c
+ wifi-wlan-callbacks.c
+ motion_control.c
+ winset_popup.c)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+# add library
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0.1.0)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+
+ADD_CUSTOM_TARGET(custom_editfield.edj
+ COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images
+ ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_editfield.edc ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_editfield.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_editfield.edc
+)
+
+ADD_DEPENDENCIES(${PROJECT_NAME} custom_editfield.edj)
+
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/ug/lib)
+
+# install image files
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images/ DESTINATION /usr/ug/res/images/wifi-efl-UG FILES_MATCHING PATTERN "*.png")
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_editfield.edj DESTINATION /usr/ug/res/edje/wifi-efl-UG)
+
diff --git a/sources/ui-gadget/edcs/custom_editfield.edc b/sources/ui-gadget/edcs/custom_editfield.edc
new file mode 100644
index 0000000..fd51137
--- /dev/null
+++ b/sources/ui-gadget/edcs/custom_editfield.edc
@@ -0,0 +1,442 @@
+#define EDITFIELD_TOP_PADDING 46
+#define EDITFIELD_BOTTOM_PADDING 6
+#define EDITFIELD_RIGHT_PADDING 26
+#define EDITFIELD_TOP_TEXT_PADDING 6
+#define EDITFIELD_RIGHT_TEXT_PADDING 56
+#define EDITFIELD_RIGHT_ERASER_PADDING 10
+#define EDITFIELD_HEIGHT_INC 66
+#define EDITFIELD_INPUTFIELD_BORDER_INC 9 9 9 9
+#define EDITFIELD_LEFT_PADDING_SEARCHFIELD_INC 16
+#define EDITFIELD_RIGHT_PADDING_SEARCHFIELD_INC 48
+#define EDITFIELD_TITLE_COLOR_INC 42 137 194 255
+#define EDITFIELD_TITLE_SIZE_INC 32
+#define EDITFIELD_GUIDE_TEXT_COLOR_INC 121 131 138 255
+#define EDITFIELD_DEFAULT_ERASER_MINW_INC 48
+#define EDITFIELD_DEFAULT_ERASER_MINH_INC 48
+#define EDITFIELD_SEARCHBAR_ERASER_EVENT_MINW_INC 38
+#define EDITFIELD_SEARCHBAR_ERASER_EVENT_MINH_INC 50
+#define ENTRY_TEXT_SIZE_INC 44
+
+
+collections {
+ group { name: "custom_editfield";
+ images {
+ image: "00_EditField_clear.png" COMP;
+ image: "00_EditField_clear_press.png" COMP;
+ image: "00_search_edit_field_bg.png" COMP;
+ }
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "top_left_padding";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 EDITFIELD_TOP_PADDING;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1 {
+ relative : 0.0 0.0;
+ to: "base";
+ }
+ rel2 {
+ relative : 0.0 0.0;
+ to: "base";
+ }
+ visible: 0;
+ }
+ }
+ part { name: "bottom_right_padding";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: EDITFIELD_RIGHT_PADDING EDITFIELD_BOTTOM_PADDING;
+ fixed: 1 1;
+ align: 1.0 1.0;
+ rel1 { relative: 1.0 1.0; to: "base"; }
+ rel2 { relative: 1.0 1.0; to: "base"; }
+ visible: 0;
+ }
+ }
+ part { name: "top_text_padding";
+ type: RECT;
+ scale: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ min: 0 EDITFIELD_TOP_TEXT_PADDING;
+ fixed: 1 1;
+ align: 0 1;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "base";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to: "base";
+ }
+ }
+ }
+ part { name: "inputfield_rect";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 EDITFIELD_HEIGHT_INC;
+ align: 0.0 0.5;
+ image {
+ normal: "00_search_edit_field_bg.png";
+ border: EDITFIELD_INPUTFIELD_BORDER_INC;
+ }
+ rel1 { relative: 1.0 1.0; to: "top_left_padding"; }
+ rel2 { relative: 0.0 0.0; to: "bottom_right_padding"; }
+ }
+ }
+ part { name: "left_padding_inputfield";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ min: EDITFIELD_LEFT_PADDING_SEARCHFIELD_INC 0;
+ fixed: 1 0;
+ align: 0.0 0.5;
+ rel1 { relative: 0.0 0.0; to: "inputfield_rect"; }
+ rel2 { relative: 0.0 1.0; to: "inputfield_rect"; }
+ }
+ }
+ part { name: "right_padding_inputfield";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ min: EDITFIELD_RIGHT_PADDING_SEARCHFIELD_INC 0;
+ fixed: 1 0;
+ align: 1.0 0.5;
+ rel1 { relative: 1.0 0.0; to: "inputfield_rect"; }
+ rel2 { relative: 1.0 1.0; to: "inputfield_rect"; }
+ }
+ }
+ part { name: "right_eraser_padding";
+ type: RECT;
+ scale: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ min: EDITFIELD_RIGHT_ERASER_PADDING 0;
+ fixed: 1 0;
+ align: 1.0 0.5;
+ rel1 { relative: 1.0 0.0; to: "inputfield_rect"; }
+ rel2 { relative: 1.0 1.0; to: "inputfield_rect"; }
+ }
+ }
+ part { name: "textfield";
+ type: RECT;
+ mouse_events: 1;
+ scale: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ min: 0 EDITFIELD_HEIGHT_INC;
+ fixed: 0 1;
+ align: 0.0 0.5;
+ rel1 {
+ relative: 1.0 0.0;
+ to: "left_padding_inputfield";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to: "right_padding_inputfield";
+ }
+ }
+ }
+ part { name: "top";
+ type: RECT;
+ scale: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ min: 0 EDITFIELD_TOP_TEXT_PADDING;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "textfield";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to: "textfield";
+ }
+ }
+ }
+ part { name: "left";
+ type: RECT;
+ scale: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ fixed: 1 1;
+ align: 0 0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "textfield";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to: "textfield";
+ }
+ }
+ }
+ part { name: "right";
+ type: RECT;
+ scale: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ min: EDITFIELD_RIGHT_TEXT_PADDING 0;
+ fixed: 1 1;
+ align: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ to: "textfield";
+ }
+ rel2.to: "textfield";
+ }
+ }
+ part { name: "bottom";
+ type: RECT;
+ scale: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ min: 0 EDITFIELD_TOP_TEXT_PADDING;
+ fixed: 1 1;
+ align: 0 1;
+ rel1 {
+ relative: 0.0 1.0;
+ to: "textfield";
+ }
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ scale: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ min: 0 32;
+ fixed: 1 1;
+ rel1 {
+ relative: 0.0 1.0;
+ to_x: "left_padding_inputfield";
+ to_y: "top_text_padding";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "left_padding_inputfield";
+ to_y: "top_text_padding";
+ }
+ color: EDITFIELD_TITLE_COLOR_INC;
+ text {
+ font: "Tizen:style=Medium";
+ size: EDITFIELD_TITLE_SIZE_INC;
+ min: 1 1;
+ align: 0.0 0.0;
+ text_class: "tizen";
+ }
+ }
+ }
+ part {
+ name: "elm.guidetext";
+ type: TEXT;
+ scale: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ rel1.to: "elm.swallow.content";
+ rel2.to: "elm.swallow.content";
+ color: EDITFIELD_GUIDE_TEXT_COLOR_INC;
+ text {
+ font: "Tizen:style=Roman";
+ size: ENTRY_TEXT_SIZE_INC;
+ min: 0 0;
+ align: 0.0 0.5;
+ text_class: "tizen";
+ }
+ }
+ description {
+ state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "elm.swallow.content";
+ type: SWALLOW;
+ scale: 1;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ min: 0 40;
+ rel1 {
+ relative : 1.0 1.0;
+ to_x: "left";
+ to_y: "top";
+ }
+ rel2 {
+ relative : 0.0 0.0;
+ to_x: "right";
+ to_y: "bottom";
+ }
+ align: 0.0 0.5;
+ }
+ }
+ part {
+ name: "eraser_image";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ min: EDITFIELD_DEFAULT_ERASER_MINW_INC EDITFIELD_DEFAULT_ERASER_MINH_INC;
+ fixed: 1 1;
+ align: 1 0.5;
+ rel1 {
+ relative: 0.0 0.5;
+ to_x : "right_eraser_padding";
+ to_y : "inputfield_rect";
+ }
+ rel2 {
+ relative: 0.0 0.5;
+ to_x : "right_eraser_padding";
+ to_y : "inputfield_rect";
+ }
+ }
+ description {
+ state: "elm.eraser.show" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ image {
+ normal: "00_EditField_clear.png";
+ border: 10 10 10 10;
+ border_scale: 1;
+ }
+ }
+ description {
+ state: "elm.eraser.pressed" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ image {
+ normal: "00_EditField_clear_press.png";
+ border: 8 8 8 8;
+ border_scale: 1;
+ }
+ }
+ }
+ part {
+ name: "eraser";
+ type: RECT;
+ scale: 1;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ min: EDITFIELD_SEARCHBAR_ERASER_EVENT_MINW_INC EDITFIELD_SEARCHBAR_ERASER_EVENT_MINH_INC;
+ fixed: 1 1;
+ align: 1 0.5;
+ color: 0 0 0 0;
+ rel1 {
+ relative: 0.0 0.5;
+ to_x : "bottom_right_padding";
+ to_y : "inputfield_rect";
+ }
+ rel2 {
+ relative: 0.0 0.5;
+ to_x : "bottom_right_padding";
+ to_y : "inputfield_rect";
+ }
+ }
+ description {
+ state: "elm.eraser.show" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "guidetext_show";
+ signal: "elm,state,guidetext,show";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.guidetext";
+ }
+ program {
+ name: "guidetext_hide";
+ signal: "elm,state,guidetext,hide";
+ source: "elm";
+ action: STATE_SET "hidden" 0.0;
+ target: "elm.guidetext";
+ }
+ program {
+ name: "eraser_show";
+ signal: "elm,state,eraser,show";
+ source: "elm";
+ action: STATE_SET "elm.eraser.show" 0.0;
+ target: "eraser_image";
+ target: "eraser";
+ }
+ program {
+ name: "eraser_hide";
+ signal: "elm,state,eraser,hide";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "eraser_image";
+ target: "eraser";
+ }
+ program {
+ name: "eraser_clicked";
+ signal: "mouse,clicked,1";
+ source: "eraser";
+ action: SIGNAL_EMIT "elm,eraser,clicked" "elm";
+ }
+ program {
+ name: "eraser_pressed";
+ signal: "mouse,down,1";
+ source: "eraser";
+ action: STATE_SET "elm.eraser.pressed" 0.0;
+ target: "eraser_image";
+ }
+ program {
+ name: "eraser_unpressed";
+ signal: "mouse,up,1";
+ source: "eraser";
+ action: STATE_SET "elm.eraser.show" 0.0;
+ target: "eraser_image";
+ }
+ }
+ }
+}
diff --git a/sources/ui-gadget/edcs/wifi_ug_edj_etc.edc b/sources/ui-gadget/edcs/wifi_ug_edj_etc.edc
new file mode 100644
index 0000000..70b5f60
--- /dev/null
+++ b/sources/ui-gadget/edcs/wifi_ug_edj_etc.edc
@@ -0,0 +1,33 @@
+collections {
+ group {
+ name: "fake_radio";
+ parts {
+ part { name: "radio";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 0 0;
+ min: 48 48;
+ align: 0.0 0.0;
+ rel1 { relative: 0 0; offset: 10 0; }
+ rel2 { relative: 1 1; offset: -10 0; }
+ }
+ }
+ part { name: "image";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 0 0;
+ min: 48 48;
+ align: 0.0 0.0;
+ rel1 { relative: 0 0; offset: 10 0; }
+ rel2 { relative: 1 1; offset: -10 0; }
+ color: 0 0 0 0;
+ }
+ }
+
+ }
+ }
+}
diff --git a/sources/ui-gadget/include/motion_control.h b/sources/ui-gadget/include/motion_control.h
new file mode 100644
index 0000000..de58865
--- /dev/null
+++ b/sources/ui-gadget/include/motion_control.h
@@ -0,0 +1,44 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __MOTION_CONTROL_H__
+#define __MOTION_CONTROL_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <Evas.h>
+
+typedef enum {
+ MOTION_TARGET_VIEW_FOCUS_ON = 0,
+ MOTION_TARGET_VIEW_FOCUS_OFF
+}TARGET_VIEW_FOCUS;
+
+void motion_create(Evas_Object *base);
+void motion_destroy(void);
+void motion_start(void);
+void motion_stop(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/ui-gadget/include/ug_wifi.h b/sources/ui-gadget/include/ug_wifi.h
new file mode 100644
index 0000000..48fa215
--- /dev/null
+++ b/sources/ui-gadget/include/ug_wifi.h
@@ -0,0 +1,89 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __NEW_WIFI_H__
+#define __NEW_WIFI_H__
+
+#define TARGET
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ui-gadget-module.h>
+
+#include "common.h"
+#include "common_pswd_popup.h"
+#include "view_ime_hidden.h"
+#include "common_eap_connect.h"
+#include "winset_popup.h"
+#include "wlan_manager.h"
+#include "viewer_manager.h"
+
+#define PACKAGE "ug-wifi-efl-UG"
+#define LOCALEDIR "/usr/ug/res/locale"
+#define CUSTOM_EDITFIELD_PATH \
+ "/usr/ug/res/edje/wifi-efl-UG/custom_editfield.edj"
+
+#define FACTORYFS "/usr/ug"
+#define WIFI_APP_IMAGE_DIR FACTORYFS "/res/images/wifi-efl-UG"
+#define WIFI_APP_ICON_PATH_SCAN \
+ WIFI_APP_IMAGE_DIR"/01_controlbar_icon_update.png"
+#define WIFI_APP_ICON_PATH_DONE \
+ WIFI_APP_IMAGE_DIR"/01_controlbar_icon_edit.png"
+#define WIFI_APP_ICON_PATH_FORGET \
+ WIFI_APP_IMAGE_DIR"/01_controlbar_icon_delete.png"
+
+#define UG_CALLER "caller"
+#define UG_MAIN_MESSAGE_DESTROY 1
+
+typedef enum {
+ UG_VIEW_DEFAULT = 0,
+ UG_VIEW_SETUP_WIZARD
+} UG_TYPE;
+
+typedef struct {
+ /* ui gadget object */
+ void* gadget;
+ ui_gadget_h ug;
+
+ //Basic Evas_Objects
+ Evas_Object *layout_main;
+ Evas *evas;
+ pswd_popup_t *passpopup;
+ hiddep_ap_popup_data_t *hidden_ap_popup;
+
+ UG_TYPE ug_type;
+ Eina_Bool bAlive;
+
+ char *lbutton_setup_wizard_prev;
+ char *rbutton_setup_wizard_next;
+ char *rbutton_setup_wizard_skip;
+ popup_manager_object_t *popup_manager;
+ common_eap_connect_data_t *eap_view;
+} wifi_appdata ;
+
+int wifi_exit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WIFI_H__ */
diff --git a/sources/ui-gadget/include/viewer_list.h b/sources/ui-gadget/include/viewer_list.h
new file mode 100644
index 0000000..2c0fe8f
--- /dev/null
+++ b/sources/ui-gadget/include/viewer_list.h
@@ -0,0 +1,74 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __VIEWER_LIST_H__
+#define __VIEWER_LIST_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "viewer_manager.h"
+
+//////// genlist struct data ////////////////////////////////////////////////////////////////////
+typedef struct {
+ wifi_device_info_t *device_info;
+ VIEWER_ITEM_RADIO_MODES radio_mode;
+} ug_genlist_data_t;
+/////////////////////////////////////////////////////////////////////////////////////////////
+
+
+Evas_Object* viewer_list_create(Evas_Object *win);
+int viewer_list_destroy(void);
+void viewer_list_title_item_del();
+void viewer_list_title_item_update();
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////// list item add / remove ///////////////////////////////////////////////////////////////
+int viewer_list_title_item_set(void);
+int viewer_list_item_radio_mode_set(Elm_Object_Item* item, VIEWER_ITEM_RADIO_MODES mode);
+Elm_Object_Item* viewer_list_item_insert_after(wifi_ap_h ap, Elm_Object_Item *after);
+Elm_Object_Item* viewer_list_get_first_item(void);
+void viewer_list_item_clear(void);
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////// item iteration /////////////////////////////////////////////////////////////////////////
+int viewer_list_item_size_get(void);
+void viewer_list_item_del(Elm_Object_Item *item);
+Elm_Object_Item* viewer_list_item_first_get(Evas_Object* list);
+Elm_Object_Item* viewer_list_item_next_get(const Elm_Object_Item* current);
+Elm_Object_Item* viewer_list_item_at_index(int index);
+/////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////// item control /////////////////////////////////////////////////////////////////////////
+void viewer_list_item_enable_all(void);
+void viewer_list_item_disable_all(void);
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+Elm_Object_Item* item_get_for_ap(wifi_ap_h ap);
+Elm_Object_Item *item_get_for_ssid(const char* ssid, int *num_aps);
+void viewer_list_item_move_connected_ap_to_top(const Elm_Object_Item *connected_item);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/ui-gadget/include/viewer_manager.h b/sources/ui-gadget/include/viewer_manager.h
new file mode 100644
index 0000000..14ef35f
--- /dev/null
+++ b/sources/ui-gadget/include/viewer_manager.h
@@ -0,0 +1,85 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __VIEWER_MANAGER_H__
+#define __VIEWER_MANAGER_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <glib.h>
+#include <Elementary.h>
+
+#include "wlan_manager.h"
+
+typedef enum {
+ HEADER_MODE_OFF=0x01,
+ HEADER_MODE_ON,
+ HEADER_MODE_ACTIVATING,
+ HEADER_MODE_CONNECTING,
+ HEADER_MODE_CONNECTED,
+ HEADER_MODE_DISCONNECTING,
+ HEADER_MODE_DEACTIVATING,
+ HEADER_MODE_CANCEL_CONNECTING,
+ HEADER_MODE_SEARCHING,
+ HEADER_MODE_MAX
+} HEADER_MODES;
+
+typedef enum {
+ VIEWER_ITEM_RADIO_MODE_OFF = 0,
+ VIEWER_ITEM_RADIO_MODE_CONNECTED,
+ VIEWER_ITEM_RADIO_MODE_CONNECTING,
+ VIEWER_ITEM_RADIO_MODE_CANCEL_CONNECTING,
+ VIEWER_ITEM_RADIO_MODE_WPS_CONNECTING,
+ VIEWER_ITEM_RADIO_MODE_DISCONNECTING,
+ VIEWER_ITEM_RADIO_MODE_MAX
+
+} VIEWER_ITEM_RADIO_MODES;
+
+typedef enum {
+ VIEWER_WINSET_SEARCHING,
+ VIEWER_WINSET_SUB_CONTENTS
+} VIEWER_WINSETS;
+
+Evas_Object* viewer_manager_create(Evas_Object* parent);
+Eina_Bool viewer_manager_destroy();
+Eina_Bool viewer_manager_show(VIEWER_WINSETS winset);
+Eina_Bool viewer_manager_hide(VIEWER_WINSETS winset);
+Eina_Bool viewer_manager_refresh(void);
+
+int power_control();
+
+int viewer_manager_hidden_disable_set(int mode);
+Evas_Object *viewer_manager_get_naviframe();
+int viewer_manager_header_mode_set(HEADER_MODES mode);
+HEADER_MODES viewer_manager_header_mode_get(void);
+void viewer_manager_scroll_to_top(void);
+Elm_Object_Item *viewer_manager_move_item_to_top(Elm_Object_Item *item);
+void viewer_manager_specific_scan_response_hlr(
+ GSList *bss_info_list, void *user_data);
+void viewer_manager_update_ap_handle(Elm_Object_Item *item, wifi_ap_h ap);
+void viewer_manager_update_connected_ap_sig_str(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/ui-gadget/include/wifi-engine-callback.h b/sources/ui-gadget/include/wifi-engine-callback.h
new file mode 100644
index 0000000..2c7925d
--- /dev/null
+++ b/sources/ui-gadget/include/wifi-engine-callback.h
@@ -0,0 +1,35 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __WIFI_ENGINE_CALLBACK_H__
+#define __WIFI_ENGINE_CALLBACK_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+void wlan_engine_refresh_callback();
+void wlan_engine_callback(wlan_mgr_event_info_t *event_info, void *user_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WIFI_ENGINE_CALLBACKS_H__ */
diff --git a/sources/ui-gadget/include/wifi-ui-list-callbacks.h b/sources/ui-gadget/include/wifi-ui-list-callbacks.h
new file mode 100644
index 0000000..8936c5e
--- /dev/null
+++ b/sources/ui-gadget/include/wifi-ui-list-callbacks.h
@@ -0,0 +1,38 @@
+/*
+* Wi-Fi UG
+*
+* Copyright 2012 Samsung Electronics Co., Ltd
+
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+
+* http://www.tizenopensource.org/license
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+
+
+#ifndef __WIFI_CALLBACKS_H_
+#define __WIFI_CALLBACKS_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+void radio_button_cb(void *data, Evas_Object *obj, void *event_info);
+void list_select_cb(void *data, Evas_Object *obj, void *event_info);
+void eap_view_close_cb(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/ui-gadget/include/wifi.h b/sources/ui-gadget/include/wifi.h
new file mode 100644
index 0000000..3a67a2c
--- /dev/null
+++ b/sources/ui-gadget/include/wifi.h
@@ -0,0 +1,88 @@
+/*
+* Wi-Fi UG
+*
+* Copyright 2012 Samsung Electronics Co., Ltd
+
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+
+* http://www.tizenopensource.org/license
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+
+
+#ifndef __NEW_WIFI_H_
+#define __NEW_WIFI_H_
+
+#define TARGET
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+#include "common.h"
+#include "common_pswd_popup.h"
+#include "view_ime_hidden.h"
+#include "common_eap_connect.h"
+#include "winset_popup.h"
+#include "wlan_manager.h"
+#include "viewer_manager.h"
+#include <ui-gadget-module.h>
+
+#define PACKAGE "ug-wifi-efl-UG"
+#define LOCALEDIR "/usr/ug/res/locale"
+#define CUSTOM_EDITFIELD_PATH "/usr/ug/res/edje/wifi-efl-UG/custom_editfield.edj"
+
+#define WIFI_APP_IMAGE_DIR FACTORYFS"/res/images/wifi-efl-UG"
+#define WIFI_APP_ICON_PATH_SCAN WIFI_APP_IMAGE_DIR"/01_controlbar_icon_update.png"
+#define WIFI_APP_ICON_PATH_DONE WIFI_APP_IMAGE_DIR"/01_controlbar_icon_edit.png"
+#define WIFI_APP_ICON_PATH_FORGET WIFI_APP_IMAGE_DIR"/01_controlbar_icon_delete.png"
+
+#define UG_CALLER "caller"
+#define UG_MAIN_MESSAGE_DESTROY 1
+
+typedef enum {
+ UG_VIEW_DEFAULT = 0,
+ UG_VIEW_SETUP_WIZARD
+} UG_TYPE;
+
+typedef struct {
+ /* ui gadget object */
+ void* gadget;
+ ui_gadget_h ug;
+
+ //Basic Evas_Objects
+ Evas_Object *win_main;
+ Evas *evas;
+ pswd_popup_t *passpopup;
+ hiddep_ap_popup_data_t *hidden_ap_popup;
+
+ UG_TYPE ug_type;
+ Eina_Bool bAlive;
+
+ char *lbutton_setup_wizard_prev;
+ char *rbutton_setup_wizard_next;
+ char *rbutton_setup_wizard_skip;
+ popup_manager_object_t *popup_manager;
+ common_eap_connect_data_t *eap_view;
+} wifi_appdata ;
+
+int wifi_exit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WIFI_H_ */
+
+
diff --git a/sources/ui-gadget/include/winset_popup.h b/sources/ui-gadget/include/winset_popup.h
new file mode 100644
index 0000000..4775cb8
--- /dev/null
+++ b/sources/ui-gadget/include/winset_popup.h
@@ -0,0 +1,54 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __WINSET_POPUP_H__
+#define __WINSET_POPUP_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <glib.h>
+#include <Evas.h>
+
+typedef enum {
+ POPUP_OPTION_NONE = 0X01,
+ POPUP_OPTION_REGISTER_FAILED_COMMUNICATION_FAILED,
+ POPUP_OPTION_POWER_ON_FAILED_MOBILE_HOTSPOT,
+ POPUP_OPTION_CONNECTING_FAILED,
+ POPUP_OPTION_HIDDEN_AP_SSID_LEN_ERROR,
+ POPUP_OPTION_WEP_PSWD_LEN_ERROR,
+ POPUP_OPTION_WPA_PSWD_LEN_ERROR,
+ POPUP_OPTION_WIFI_INVALID_KEY,
+ POPUP_OPTION_MAX
+} POPUP_MODE_OPTIONS;
+
+typedef struct popup_manager_object popup_manager_object_t;
+
+popup_manager_object_t *winset_popup_manager_create(Evas_Object* win, const char *str_pkg_name);
+void winset_popup_mode_set(popup_manager_object_t *manager_object, POPUP_MODE_OPTIONS option, void *input_data);
+gboolean winset_popup_manager_destroy(popup_manager_object_t *manager_object);
+gboolean winset_popup_hide_popup(popup_manager_object_t *manager_object);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/ui-gadget/motion_control.c b/sources/ui-gadget/motion_control.c
new file mode 100644
index 0000000..a00c003
--- /dev/null
+++ b/sources/ui-gadget/motion_control.c
@@ -0,0 +1,103 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "sensor.h"
+#include "motion_control.h"
+#include "viewer_manager.h"
+#include "wlan_manager.h"
+#include "vconf.h"
+#include "wifi-engine-callback.h"
+
+static int motion_handle = -1;
+static Evas_Object* target = NULL;
+
+static void __motion_shake_cb(unsigned int event_type, sensor_event_data_t *event_data, void *data)
+{
+ int vconf_value = 0;
+
+ vconf_get_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value);
+ if(vconf_value != 1)
+ return;
+
+ vconf_get_bool(VCONFKEY_SETAPPL_USE_SHAKE, &vconf_value);
+ if(vconf_value != 1)
+ return;
+
+ HEADER_MODES header_mode = viewer_manager_header_mode_get();
+
+ switch(header_mode) {
+ case HEADER_MODE_OFF:
+ power_control();
+ viewer_manager_show(VIEWER_WINSET_SEARCHING);
+ break;
+ case HEADER_MODE_ON:
+ case HEADER_MODE_CONNECTED:
+ if (WLAN_MANAGER_ERR_NONE == wlan_manager_request_scan()) {
+ viewer_manager_show(VIEWER_WINSET_SEARCHING);
+ viewer_manager_header_mode_set(HEADER_MODE_SEARCHING);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+static TARGET_VIEW_FOCUS __motion_target_view_focus_get(void)
+{
+ if (target == NULL)
+ return MOTION_TARGET_VIEW_FOCUS_OFF;
+
+ if (elm_object_focus_get(target))
+ return MOTION_TARGET_VIEW_FOCUS_ON;
+ else
+ return MOTION_TARGET_VIEW_FOCUS_OFF;
+}
+
+void motion_create(Evas_Object* base)
+{
+ target = base;
+
+ motion_handle = sf_connect(MOTION_SENSOR);
+ if (motion_handle < 0)
+ return;
+
+ sf_register_event(motion_handle, MOTION_ENGINE_EVENT_SHAKE, NULL, __motion_shake_cb, base);
+}
+
+void motion_start(void)
+{
+ TARGET_VIEW_FOCUS focus_state = __motion_target_view_focus_get();
+
+ if ((focus_state == MOTION_TARGET_VIEW_FOCUS_ON) && (motion_handle >= 0))
+ sf_start(motion_handle, 0);
+}
+
+void motion_stop(void)
+{
+ sf_stop(motion_handle);
+}
+
+void motion_destroy(void)
+{
+ sf_stop(motion_handle);
+
+ sf_unregister_event(motion_handle, MOTION_ENGINE_EVENT_SHAKE);
+
+ sf_disconnect(motion_handle);
+}
diff --git a/sources/ui-gadget/viewers-layout/include/view_detail.h b/sources/ui-gadget/viewers-layout/include/view_detail.h
new file mode 100644
index 0000000..9731e4e
--- /dev/null
+++ b/sources/ui-gadget/viewers-layout/include/view_detail.h
@@ -0,0 +1,50 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __VIEW_DETAIL_H__
+#define __VIEW_DETAIL_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <Evas.h>
+
+void view_detail(wifi_device_info_t *device_info, Evas_Object *parent);
+
+int detailview_ip_and_dns_type_set_as_static();
+
+int detailview_modified_ip_address_set(char* data);
+int detailview_modified_gateway_address_set(char* data);
+int detailview_modified_subnet_mask_set(char* data);
+int detailview_modified_dns1_address_set(char* data);
+int detailview_modified_dns2_address_set(char* data);
+
+const char* detailview_modified_ip_address_get(void);
+const char* detailview_modified_gateway_address_get(void);
+const char* detailview_modified_subnet_mask_get(void);
+const char* detailview_modified_dns1_address_get(void);
+const char* detailview_modified_dns2_address_get(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/ui-gadget/viewers-layout/include/view_ime_hidden.h b/sources/ui-gadget/viewers-layout/include/view_ime_hidden.h
new file mode 100644
index 0000000..bc1cb72
--- /dev/null
+++ b/sources/ui-gadget/viewers-layout/include/view_ime_hidden.h
@@ -0,0 +1,39 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __VIEW_IME_HIDDEN_H__
+#define __VIEW_IME_HIDDEN_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <Evas.h>
+
+typedef struct hiddep_ap_popup_data hiddep_ap_popup_data_t;
+
+hiddep_ap_popup_data_t *view_hidden_ap_popup_create(Evas_Object *win_main, const char *str_pkg_name);
+void view_hidden_ap_popup_destroy(hiddep_ap_popup_data_t *popup_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/ui-gadget/viewers-layout/view_detail.c b/sources/ui-gadget/viewers-layout/view_detail.c
new file mode 100644
index 0000000..a7b5b8a
--- /dev/null
+++ b/sources/ui-gadget/viewers-layout/view_detail.c
@@ -0,0 +1,339 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "ug_wifi.h"
+#include "view_detail.h"
+#include "i18nmanager.h"
+#include "viewer_manager.h"
+#include "winset_popup.h"
+#include "common_utils.h"
+#include "common_ip_info.h"
+#include "common_eap_connect.h"
+
+typedef struct _view_detail_data {
+ Evas_Object *win;
+ char *ap_image_path;
+ wifi_ap_h ap;
+ eap_info_list_t *eap_info_list;
+ ip_info_list_t *ip_info_list;
+ Evas_Object *forget_confirm_popup;
+ Evas_Object *view_detail_list;
+} view_detail_data;
+
+static int view_detail_end = TRUE;
+
+/* function declaration */
+static void detailview_sk_cb(void *data, Evas_Object *obj, void *event_info);
+static void forget_sk_cb(void *data, Evas_Object *obj, void *event_info);
+
+///////////////////////////////////////////////////////////////
+// implementation
+///////////////////////////////////////////////////////////////
+
+static char* _view_detail_grouptitle_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ __COMMON_FUNC_ENTER__;
+ char *ret = NULL;
+ assertm_if(NULL == obj, "NULL!!");
+ assertm_if(NULL == part, "NULL!!");
+ assertm_if(NULL == data, "NULL!!");
+
+ view_detail_data *detail_data = (view_detail_data *)data;
+ if (!strncmp(part, "elm.text.2", strlen(part))) {
+ ret = (char*) g_strdup(sc(PACKAGE, I18N_TYPE_Name));
+ } else if (!strncmp(part, "elm.text.1", strlen(part))) {
+ wifi_ap_get_essid(detail_data->ap, &ret);
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return ret;
+}
+
+static Evas_Object *_view_detail_grouptitle_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ view_detail_data *detail_data = (view_detail_data *)data;
+ Evas_Object* icon = NULL;
+ assertm_if(NULL == obj, "NULL!!");
+ assertm_if(NULL == data, "NULL!!");
+ assertm_if(NULL == part, "NULL!!");
+
+ if (detail_data->ap_image_path == NULL) {
+ /* if there is no ap_image_path (NO AP Found situation) */
+ DEBUG_LOG(UG_NAME_ERR, "Fatal: Image path is NULL");
+ } else if (!strncmp(part, "elm.icon", strlen(part))) {
+ /* for strength */
+ icon = elm_image_add(obj);
+ assertm_if(NULL == icon, "NULL!!");
+ elm_image_file_set(icon, detail_data->ap_image_path, NULL);
+ }
+
+ return icon;
+}
+
+static void _remove_all(view_detail_data *_detail_data)
+{
+ __COMMON_FUNC_ENTER__;
+ if(_detail_data) {
+ if (_detail_data->eap_info_list) {
+ eap_info_remove(_detail_data->eap_info_list);
+ _detail_data->eap_info_list = NULL;
+ }
+
+ ip_info_remove(_detail_data->ip_info_list);
+ _detail_data->ip_info_list = NULL;
+
+ evas_object_del(_detail_data->view_detail_list);
+ _detail_data->view_detail_list = NULL;
+
+ g_free(_detail_data->ap_image_path);
+ g_free(_detail_data);
+ _detail_data = NULL;
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void ok_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ if(view_detail_end == TRUE) {
+ return;
+ }
+ view_detail_end = TRUE;
+ view_detail_data *_detail_data = (view_detail_data *)data;
+ assertm_if(NULL == _detail_data, "NULL!!");
+
+ evas_object_del(_detail_data->forget_confirm_popup);
+ _detail_data->forget_confirm_popup = NULL;
+ wlan_manager_forget(_detail_data->ap);
+ _remove_all(_detail_data);
+ elm_naviframe_item_pop(viewer_manager_get_naviframe());
+
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+static void cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ view_detail_data *_detail_data = (view_detail_data *)data;
+ assertm_if(NULL == _detail_data, "NULL!!");
+ evas_object_del(_detail_data->forget_confirm_popup);
+ _detail_data->forget_confirm_popup = NULL;
+ __COMMON_FUNC_EXIT__;
+}
+
+static void forget_sk_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ view_detail_data *_detail_data = (view_detail_data *)data;
+ assertm_if(NULL == _detail_data, "NULL!!");
+
+ if (!_detail_data->forget_confirm_popup) {
+ popup_btn_info_t popup_data;
+ memset(&popup_data, 0, sizeof(popup_data));
+
+ popup_data.info_txt = g_strdup(sc(PACKAGE, I18N_TYPE_Autonomous_connection_to_s_will_be_turned_off_Continue));
+ popup_data.btn1_cb = ok_cb;
+ popup_data.btn1_txt = sc(PACKAGE, I18N_TYPE_Ok);
+ popup_data.btn1_data = _detail_data;
+ popup_data.btn2_cb = cancel_cb;
+ popup_data.btn2_txt = sc(PACKAGE, I18N_TYPE_Cancel);
+ popup_data.btn2_data = _detail_data;
+ _detail_data->forget_confirm_popup = common_utils_show_info_popup(_detail_data->win, &popup_data);
+
+ evas_object_show(_detail_data->forget_confirm_popup);
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void title_back_btn_sk_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if(view_detail_end == TRUE) {
+ return;
+ }
+ view_detail_end = TRUE;
+ view_detail_data *_detail_data = (view_detail_data *)data;
+ assertm_if(NULL == _detail_data, "NULL!!");
+
+ if (_detail_data->eap_info_list)
+ eap_info_save_data(_detail_data->eap_info_list);
+
+ ip_info_save_data(_detail_data->ip_info_list);
+ _remove_all(_detail_data);
+ elm_naviframe_item_pop(viewer_manager_get_naviframe());
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void detailview_sk_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ if (view_detail_end == TRUE)
+ return;
+ view_detail_end = TRUE;
+
+ view_detail_data *_detail_data = (view_detail_data *)data;
+ assertm_if(NULL == _detail_data, "NULL!!");
+
+ if (_detail_data->eap_info_list)
+ eap_info_save_data(_detail_data->eap_info_list);
+
+ ip_info_save_data(_detail_data->ip_info_list);
+ _remove_all(_detail_data);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void __view_detail_imf_ctxt_evnt_cb(void *data, Ecore_IMF_Context *ctx, int value)
+{
+ if (!data)
+ return;
+ if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
+ DEBUG_LOG(UG_NAME_NORMAL, "Key pad is now open");
+ elm_object_item_signal_emit(data, "elm,state,sip,shown", "");
+ } else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
+ DEBUG_LOG(UG_NAME_NORMAL, "Key pad is now closed");
+ elm_object_item_signal_emit(data, "elm,state,sip,hidden", "");
+ }
+ return;
+}
+
+static Eina_Bool __view_detail_load_ip_info_list_cb(void *data)
+{
+ Elm_Object_Item *navi_it = NULL;
+ Evas_Object *list = NULL;
+ Evas_Object *layout;
+ view_detail_data *_detail_data = (view_detail_data *)data;
+
+ if (!_detail_data)
+ return ECORE_CALLBACK_CANCEL;
+
+ navi_it = elm_naviframe_top_item_get(viewer_manager_get_naviframe());
+ layout = elm_object_item_part_content_get(navi_it, "elm.swallow.content");
+
+ /* Create an EAP connect view list */
+ list = elm_object_part_content_get(layout, "elm.swallow.content");
+
+ /* Append ip info list */
+ _detail_data->ip_info_list = ip_info_append_items(_detail_data->ap, PACKAGE, list, __view_detail_imf_ctxt_evnt_cb, navi_it);
+
+ common_utils_add_dialogue_separator(list, "dialogue/separator");
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void view_detail(wifi_device_info_t *device_info, Evas_Object *win_main)
+{
+ __COMMON_FUNC_ENTER__;
+
+ bool favourite = 0;
+ wifi_ap_h ap;
+ static Elm_Genlist_Item_Class grouptitle_itc;
+
+ if (device_info == NULL) {
+ ERROR_LOG(UG_NAME_NORMAL, "Failed : device_info is NULL");
+ return;
+ }
+ Evas_Object *layout = NULL;
+ Evas_Object* navi_frame = viewer_manager_get_naviframe();
+ if (navi_frame == NULL) {
+ ERROR_LOG(UG_NAME_NORMAL, "Failed : get naviframe");
+ return;
+ }
+
+ view_detail_end = FALSE;
+
+ view_detail_data *_detail_data = g_new0(view_detail_data, 1);
+ assertm_if(NULL == _detail_data, "NULL!!");
+
+ _detail_data->ap = ap = device_info->ap;
+ wifi_ap_is_favorite(ap, &favourite);
+ _detail_data->ap_image_path = g_strdup(device_info->ap_image_path);
+ layout = common_utils_create_layout(navi_frame);
+ evas_object_show(layout);
+
+ Evas_Object* detailview_list = elm_genlist_add(layout);
+ elm_object_style_set(detailview_list, "dialogue");
+ assertm_if(NULL == detailview_list, "NULL!!");
+ _detail_data->view_detail_list = detailview_list;
+
+ grouptitle_itc.item_style = "dialogue/2text.1icon.5";
+ grouptitle_itc.func.text_get = _view_detail_grouptitle_text_get;
+ grouptitle_itc.func.content_get = _view_detail_grouptitle_content_get;
+ grouptitle_itc.func.state_get = NULL;
+ grouptitle_itc.func.del = NULL;
+
+ common_utils_add_dialogue_separator(detailview_list, "dialogue/separator");
+
+ /* AP name and signal strength icon */
+ Elm_Object_Item* title = elm_genlist_item_append(detailview_list, &grouptitle_itc, _detail_data, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ elm_object_item_disabled_set(title, TRUE);
+
+ elm_object_part_content_set(layout, "elm.swallow.content", detailview_list);
+
+ Elm_Object_Item* navi_it = elm_naviframe_item_push(navi_frame, sc(PACKAGE, I18N_TYPE_Details), NULL, NULL, layout, NULL);
+ evas_object_data_set(navi_frame, SCREEN_TYPE_ID_KEY, (void *)VIEW_MANAGER_VIEW_TYPE_DETAIL);
+
+ /* Toolbar Back button */
+ Evas_Object* button_back = elm_object_item_part_content_get(navi_it, "prev_btn");
+ evas_object_smart_callback_add(button_back, "clicked", detailview_sk_cb, _detail_data);
+
+ /* Title Back button */
+ button_back = elm_button_add(navi_frame);
+ elm_object_style_set(button_back, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(button_back, "clicked", title_back_btn_sk_cb, _detail_data);
+ elm_object_item_part_content_set(navi_it, "title_prev_btn", button_back);
+
+ _detail_data->win = win_main;
+
+ if (favourite) {
+ /* Toolbar Forget button */
+ Evas_Object* forget_button = elm_button_add(navi_frame);
+ elm_object_style_set(forget_button, "naviframe/toolbar/default");
+ elm_object_text_set(forget_button, sc(PACKAGE, I18N_TYPE_Forget));
+ evas_object_smart_callback_add(forget_button, "clicked", forget_sk_cb, _detail_data);
+ elm_object_item_part_content_set(navi_it, "toolbar_button1", forget_button);
+
+ /* Title Forget button */
+ forget_button = elm_button_add(navi_frame);
+ elm_object_style_set(forget_button, "naviframe/toolbar/default");
+ elm_object_text_set(forget_button, sc(PACKAGE, I18N_TYPE_Forget));
+ evas_object_smart_callback_add(forget_button, "clicked", forget_sk_cb, _detail_data);
+ elm_object_item_part_content_set(navi_it, "title_toolbar_button1", forget_button);
+ }
+
+ wifi_security_type_e type = WIFI_SECURITY_TYPE_NONE;
+ wifi_ap_get_security_type(ap, &type);
+ if (WIFI_SECURITY_TYPE_EAP == type) {
+ wifi_connection_state_e connection_state;
+ wifi_ap_get_connection_state(ap, &connection_state);
+ if (favourite || WIFI_CONNECTION_STATE_CONNECTED == connection_state) {
+ _detail_data->eap_info_list = eap_info_append_items(ap, detailview_list, PACKAGE, __view_detail_imf_ctxt_evnt_cb, navi_it);
+ }
+ }
+
+ /* Append the ip info details */
+ ecore_idler_add(__view_detail_load_ip_info_list_cb, _detail_data);
+
+ __COMMON_FUNC_EXIT__;
+}
diff --git a/sources/ui-gadget/viewers-layout/view_ime_hidden.c b/sources/ui-gadget/viewers-layout/view_ime_hidden.c
new file mode 100644
index 0000000..2a61586
--- /dev/null
+++ b/sources/ui-gadget/viewers-layout/view_ime_hidden.c
@@ -0,0 +1,201 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "ug_wifi.h"
+#include "view_ime_hidden.h"
+#include "i18nmanager.h"
+#include "wlan_manager.h"
+#include "viewer_manager.h"
+#include "common_utils.h"
+
+struct hiddep_ap_popup_data {
+ Evas_Object *win;
+ const char *str_pkg_name;
+ Evas_Object *popup;
+ Evas_Object *popup_entry_lyt;
+ Evas_Object *progress_popup;
+};
+
+static void view_hidden_ap_popup_ok_cb(void *data, Evas_Object *obj, void *event_info);
+static void view_hidden_ap_popup_cancel_cb(void *data, Evas_Object *obj, void *event_info);
+static Eina_Bool _enable_scan_updates_cb(void *data);
+
+static void __popup_entry_changed_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ if (elm_object_focus_get(data)) {
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+ else
+ elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
+ }
+}
+
+static void __popup_entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (!elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
+ elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
+}
+
+static void __popup_entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (elm_entry_is_empty(obj))
+ elm_object_signal_emit(data, "elm,state,guidetext,show", "elm");
+ elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+}
+
+static void __popup_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ elm_entry_entry_set(data, "");
+}
+
+hiddep_ap_popup_data_t *view_hidden_ap_popup_create(Evas_Object *win_main, const char *str_pkg_name)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (!win_main) {
+ INFO_LOG(UG_NAME_ERR, "Invalid argument passed.");
+ return NULL;
+ }
+
+ /* Lets disable the scan updates so that the UI is not refreshed un necessarily */
+ wlan_manager_disable_scan_result_update();
+
+ hiddep_ap_popup_data_t *hidden_ap_popup_data = g_new0(hiddep_ap_popup_data_t, 1);
+ popup_btn_info_t popup_btn_data;
+
+ memset(&popup_btn_data, 0, sizeof(popup_btn_data));
+ popup_btn_data.title_txt = sc(str_pkg_name,I18N_TYPE_Find_Hidden_Network);
+ popup_btn_data.btn1_cb = view_hidden_ap_popup_ok_cb;
+ popup_btn_data.btn1_data = hidden_ap_popup_data;
+ popup_btn_data.btn2_cb = view_hidden_ap_popup_cancel_cb;
+ popup_btn_data.btn2_data = hidden_ap_popup_data;
+ popup_btn_data.btn1_txt = sc(str_pkg_name, I18N_TYPE_Ok);
+ popup_btn_data.btn2_txt = sc(str_pkg_name, I18N_TYPE_Cancel);
+ Evas_Object *passpopup = common_utils_show_info_popup(win_main, &popup_btn_data);
+
+ Evas_Object *box = elm_box_add(passpopup);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(box);
+
+ Evas_Object *entry_ly = elm_layout_add(box);
+ Evas_Object *entry = NULL;
+ Elm_Entry_Filter_Limit_Size limit_filter_data;
+
+ elm_layout_file_set(entry_ly, CUSTOM_EDITFIELD_PATH, "custom_editfield");
+ evas_object_size_hint_weight_set(entry_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(entry_ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_text_set(entry_ly, "elm.text", sc(str_pkg_name, I18N_TYPE_Enter_Ssid));
+ elm_object_part_text_set(entry_ly, "elm.guidetext", sc(str_pkg_name, I18N_TYPE_Ssid));
+
+ entry = elm_entry_add(entry_ly);
+ elm_entry_scrollable_set(entry, EINA_TRUE);
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_URL);
+ elm_object_part_content_set(entry_ly, "elm.swallow.content", entry);
+
+ limit_filter_data.max_char_count = 32;
+ elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data);
+
+ evas_object_smart_callback_add(entry, "changed", __popup_entry_changed_cb, entry_ly);
+ evas_object_smart_callback_add(entry, "focused", __popup_entry_focused_cb, entry_ly);
+ evas_object_smart_callback_add(entry, "unfocused", __popup_entry_unfocused_cb, entry_ly);
+ elm_object_signal_callback_add(entry_ly, "elm,eraser,clicked", "elm", __popup_eraser_clicked_cb, entry);
+ evas_object_show(entry);
+ evas_object_show(entry_ly);
+
+ elm_box_pack_end(box, entry_ly);
+
+ elm_object_content_set(passpopup, box);
+ evas_object_show(passpopup);
+ hidden_ap_popup_data->win = win_main;
+ hidden_ap_popup_data->str_pkg_name = str_pkg_name;
+ hidden_ap_popup_data->popup = passpopup;
+ hidden_ap_popup_data->popup_entry_lyt = entry_ly;
+ elm_object_focus_set(entry, EINA_TRUE);
+ __COMMON_FUNC_EXIT__;
+
+ return hidden_ap_popup_data;
+}
+
+void view_hidden_ap_popup_destroy(hiddep_ap_popup_data_t *popup_data)
+{
+ if (!popup_data) {
+ INFO_LOG(UG_NAME_ERR, "Invalid argument passed.");
+ return;
+ }
+
+ if (popup_data->popup) {
+ evas_object_del(popup_data->popup);
+ popup_data->popup = NULL;
+ }
+
+ if (popup_data->progress_popup) {
+ evas_object_del(popup_data->progress_popup);
+ popup_data->progress_popup = NULL;
+ }
+
+ g_free(popup_data);
+
+ /* A delay is needed to get the smooth Input panel closing animation effect */
+ ecore_timer_add(0.1, _enable_scan_updates_cb, NULL);
+
+ return;
+}
+
+static void view_hidden_ap_popup_ok_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ hiddep_ap_popup_data_t *popup_data = (hiddep_ap_popup_data_t *)data;
+ char *entry_txt = common_utils_entry_layout_get_text(popup_data->popup_entry_lyt);
+ if (WLAN_MANAGER_ERR_NONE != wlan_manager_request_specific_scan(entry_txt, entry_txt)) {
+ char *disp_msg = g_strdup_printf("Unable to find %s", entry_txt);
+ common_utils_show_info_ok_popup(popup_data->win, popup_data->str_pkg_name, disp_msg);
+ g_free(disp_msg);
+ g_free(entry_txt);
+ view_hidden_ap_popup_destroy(popup_data);
+ } else {
+
+ /* Show progress idication popup */
+ popup_data->progress_popup = common_utils_show_info_ok_popup(popup_data->win, popup_data->str_pkg_name, "Please Wait...");
+
+ evas_object_del(popup_data->popup);
+ popup_data->popup = NULL;
+
+ /* A delay is needed to get the smooth Input panel closing animation effect */
+ ecore_timer_add(0.1, _enable_scan_updates_cb, NULL);
+ }
+
+ return;
+}
+
+static void view_hidden_ap_popup_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ hiddep_ap_popup_data_t *hidden_ap_popup_data = (hiddep_ap_popup_data_t *)data;
+ view_hidden_ap_popup_destroy(hidden_ap_popup_data);
+ return;
+}
+
+static Eina_Bool _enable_scan_updates_cb(void *data)
+{
+ /* Lets enable the scan updates */
+ wlan_manager_enable_scan_result_update();
+
+ return ECORE_CALLBACK_CANCEL;
+}
diff --git a/sources/ui-gadget/viewers-layout/viewer_manager.c b/sources/ui-gadget/viewers-layout/viewer_manager.c
new file mode 100644
index 0000000..28184e4
--- /dev/null
+++ b/sources/ui-gadget/viewers-layout/viewer_manager.c
@@ -0,0 +1,1267 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <vconf-keys.h>
+
+#include "common.h"
+#include "ug_wifi.h"
+#include "viewer_list.h"
+#include "i18nmanager.h"
+#include "common_utils.h"
+#include "winset_popup.h"
+#include "viewer_manager.h"
+#include "view_ime_hidden.h"
+
+typedef struct {
+ wlan_security_mode_type_t sec_mode;
+ char *ssid;
+ Evas_Object *confirmation_popup;
+} hidden_ap_data_t;
+
+typedef struct viewer_manager_object {
+ Evas_Object* nav;
+ Evas_Object* scan_button;
+ Evas_Object* next_button;
+ Evas_Object* prev_button;
+ Evas_Object* list;
+
+ Elm_Object_Item *item_hidden_btn;
+ Elm_Object_Item *item_sep_above_hidden_button;
+ Elm_Object_Item *item_sep_below_hidden_button;
+
+ char* header_text;
+ HEADER_MODES header_mode;
+ Elm_Object_Item* item_header;
+} viewer_manager_object;
+
+typedef struct {
+ Evas_Object* list;
+ Elm_Object_Item *last_appended_item;
+ int total_items_added;
+} view_manager_list_update_info_t;
+
+static viewer_manager_object* manager_object = NULL;
+
+extern wifi_appdata *ug_app_state;
+
+static Elm_Genlist_Item_Class header_itc_text;
+static Elm_Genlist_Item_Class bottom_itc_text;
+static Elm_Genlist_Item_Class bottom_itc_helper_text;
+static Elm_Genlist_Item_Class hidden_button_itc;
+
+int power_control()
+{
+ __COMMON_FUNC_ENTER__;
+
+ int cur_state = -1;
+ cur_state = viewer_manager_header_mode_get();
+
+ INFO_LOG(UG_NAME_NORMAL, "current state %d\n", cur_state);
+
+ int ret = TRUE;
+
+ switch (cur_state) {
+ case HEADER_MODE_OFF:
+ case HEADER_MODE_ACTIVATING:
+ INFO_LOG(UG_NAME_NORMAL, "wifi state power off/powering off");
+
+ ret = wlan_manager_request_power_on();
+ switch (ret){
+ case WLAN_MANAGER_ERR_NONE:
+ INFO_LOG(UG_NAME_NORMAL, "power on ok");
+ viewer_manager_header_mode_set(HEADER_MODE_ACTIVATING);
+ break;
+ case WLAN_MANAGER_ERR_MOBILE_HOTSPOT_OCCUPIED:
+ viewer_manager_header_mode_set(HEADER_MODE_ACTIVATING);
+ winset_popup_mode_set(ug_app_state->popup_manager, POPUP_OPTION_POWER_ON_FAILED_MOBILE_HOTSPOT, NULL);
+ break;
+ case WLAN_MANAGER_ERR_IN_PROGRESS:
+ /* Do nothing */
+ break;
+ default:
+ viewer_manager_header_mode_set(HEADER_MODE_OFF);
+ INFO_LOG(UG_NAME_NORMAL, "power on failed. ret = %d", ret);
+ break;
+ }
+ break;
+
+ case HEADER_MODE_ON:
+ case HEADER_MODE_CONNECTING:
+ case HEADER_MODE_DISCONNECTING:
+ case HEADER_MODE_CANCEL_CONNECTING:
+ case HEADER_MODE_CONNECTED:
+ case HEADER_MODE_SEARCHING:
+
+ viewer_list_item_clear();
+ INFO_LOG(UG_NAME_NORMAL, "wifi state power on/connected");
+ ret = wlan_manager_request_power_off();
+ switch (ret) {
+ case WLAN_MANAGER_ERR_NONE:
+ viewer_manager_show(VIEWER_WINSET_SEARCHING);
+ viewer_manager_hide(VIEWER_WINSET_SUB_CONTENTS);
+ viewer_manager_header_mode_set(HEADER_MODE_DEACTIVATING);
+ wlan_manager_disable_scan_result_update(); // Lets ignore all the scan updates because we are powering off now.
+ break;
+ case WLAN_MANAGER_ERR_IN_PROGRESS:
+ /* Do nothing */
+ break;
+ default:
+ INFO_LOG(UG_NAME_NORMAL, "power off failed. ret = %d", ret);
+ break;
+ }
+ break;
+
+ case HEADER_MODE_DEACTIVATING:
+ default:
+ INFO_LOG(UG_NAME_NORMAL, "Powering off in progress. Let it complete. \n");
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+}
+
+static void _hide_finished_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ view_manager_view_type_t top_view_id =
+ (view_manager_view_type_t)evas_object_data_get(obj,
+ SCREEN_TYPE_ID_KEY);
+
+ if (data == elm_naviframe_top_item_get(obj)) {
+ /* We are now in main view */
+ evas_object_data_set(obj, SCREEN_TYPE_ID_KEY, (void *)VIEW_MANAGER_VIEW_TYPE_MAIN);
+ top_view_id = VIEW_MANAGER_VIEW_TYPE_MAIN;
+ }
+
+ INFO_LOG(UG_NAME_NORMAL, "top view id = %d", top_view_id);
+
+ switch(top_view_id) {
+ case VIEW_MANAGER_VIEW_TYPE_MAIN:
+ ug_app_state->eap_view = NULL;
+ /* Lets enable the scan updates */
+ wlan_manager_enable_scan_result_update();
+ break;
+
+ case VIEW_MANAGER_VIEW_TYPE_DETAIL:
+ case VIEW_MANAGER_VIEW_TYPE_EAP:
+ default:
+ /* Lets disable the scan updates so that the UI is not refreshed */
+ wlan_manager_disable_scan_result_update();
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+void _lbutton_click_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ service_h service;
+ int ret;
+
+ ret = service_create(&service);
+ if (ret != SERVICE_ERROR_NONE) {
+ INFO_LOG(UG_NAME_ERR, "service_create failed: %d", ret);
+ return;
+ }
+
+ service_add_extra_data(service, "result", "lbutton_click");
+ ug_send_result(ug_app_state->ug, service);
+
+ service_destroy(service);
+ ug_destroy_me(ug_app_state->ug);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+void _rbutton_click_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ service_h service;
+ int ret;
+
+ ret = service_create(&service);
+ if (ret != SERVICE_ERROR_NONE) {
+ INFO_LOG(UG_NAME_ERR, "service_create failed: %d", ret);
+ return;
+ }
+
+ service_add_extra_data(service, "result", "rbutton_click");
+ ug_send_result(ug_app_state->ug, service);
+
+ service_destroy(service);
+ ug_destroy_me(ug_app_state->ug);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+void _back_sk_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (ug_app_state->bAlive == EINA_FALSE)
+ return;
+
+ wifi_exit();
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static Eina_Bool __scan_request(void *data)
+{
+ int ret = WLAN_MANAGER_ERR_NONE;
+
+ ret = wlan_manager_request_scan();
+ if (ret == WLAN_MANAGER_ERR_NONE) {
+ viewer_manager_show(VIEWER_WINSET_SEARCHING);
+ viewer_manager_header_mode_set(HEADER_MODE_SEARCHING);
+ } else
+ INFO_LOG(COMMON_NAME_ERR, "Manual scan failed. Err = %d", ret);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void __refresh_scan_callback(void *data,
+ Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ int cur_state = -1;
+ cur_state = viewer_manager_header_mode_get();
+
+ switch (cur_state) {
+ case HEADER_MODE_DEACTIVATING:
+ case HEADER_MODE_OFF:
+ power_control();
+ viewer_manager_show(VIEWER_WINSET_SEARCHING);
+ break;
+
+ case HEADER_MODE_ON:
+ case HEADER_MODE_CONNECTED:
+ ecore_idler_add(__scan_request, NULL);
+ break;
+
+ default:
+ INFO_LOG(UG_NAME_NORMAL, "Manual scan requested in wrong state: %d",
+ cur_state);
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static char *_gl_header_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ char* det = NULL;
+
+ __COMMON_FUNC_ENTER__;
+
+ if (manager_object == NULL)
+ return NULL;
+
+ if (!strncmp(part, "elm.text", strlen(part))) {
+ det = g_strdup(manager_object->header_text);
+ assertm_if(NULL == det, "NULL!!");
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return det;
+}
+
+static void _gl_header_sel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ const HEADER_MODES header_mode = viewer_manager_header_mode_get();
+ if (HEADER_MODE_ACTIVATING != header_mode && HEADER_MODE_DEACTIVATING != header_mode)
+ power_control();
+
+ elm_genlist_item_update(manager_object->item_header);
+
+ elm_genlist_item_selected_set(manager_object->item_header, EINA_FALSE);
+
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+static Evas_Object *_gl_header_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (manager_object == NULL)
+ return NULL;
+
+ Evas_Object *icon = NULL;
+
+ __COMMON_FUNC_ENTER__;
+
+ if (!strncmp(part, "elm.icon", strlen(part))) {
+ switch (manager_object->header_mode) {
+ case HEADER_MODE_OFF:
+ /* Show WiFi off indication button */
+ icon = elm_check_add(obj);
+ elm_object_style_set(icon, "on&off");
+ evas_object_propagate_events_set(icon, EINA_TRUE);
+ elm_check_state_set(icon, EINA_FALSE);
+ evas_object_smart_callback_add(icon, "changed", _gl_header_sel_cb, NULL);//item_data);
+ evas_object_show(icon);
+ break;
+
+ case HEADER_MODE_ACTIVATING:
+ case HEADER_MODE_DEACTIVATING:
+ /* Dont display the WiFi on/off indication while it is Activating/Deactivating */
+ icon = elm_progressbar_add(obj);
+ elm_object_style_set(icon, "list_process");
+ evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_progressbar_pulse(icon, TRUE);
+ break;
+
+ default: /* Show WiFi on indication button */
+ icon = elm_check_add(obj);
+ elm_object_style_set(icon, "on&off");
+ evas_object_propagate_events_set(icon, EINA_TRUE);
+ evas_object_smart_callback_add(icon, "changed", _gl_header_sel_cb, NULL);//item_data);
+ elm_check_state_set(icon, EINA_TRUE);
+ evas_object_show(icon);
+ break;
+ }
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return icon;
+}
+
+static char *_gl_bottom_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ char* det = NULL;
+
+ __COMMON_FUNC_ENTER__;
+
+ if (!strncmp(part, "elm.text", strlen(part))) {
+ det = g_strdup(sc(PACKAGE, I18N_TYPE_Network_notification));
+ assertm_if(NULL == det, "NULL!!");
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return det;
+}
+
+static char *_gl_bottom_helper_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ char* det = NULL;
+
+ __COMMON_FUNC_ENTER__;
+
+ det = g_strdup(sc(PACKAGE, I18N_TYPE_Network_notify_me_later));
+
+ __COMMON_FUNC_EXIT__;
+ return det;
+}
+
+static void _gl_bottom_sel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ int ret = -1;
+ int bottom_ret = (int)elm_check_state_get(obj);
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+
+ INFO_LOG(UG_NAME_NORMAL, "bottom state[%d] is different", bottom_ret);
+
+ ret = common_util_get_system_registry(VCONFKEY_WIFI_ENABLE_QS);
+ switch (ret) {
+ case 1:
+ common_util_set_system_registry(VCONFKEY_WIFI_ENABLE_QS,
+ VCONFKEY_WIFI_QS_DISABLE);
+ break;
+
+ case 0:
+ common_util_set_system_registry(VCONFKEY_WIFI_ENABLE_QS,
+ VCONFKEY_WIFI_QS_ENABLE);
+ break;
+
+ default:
+ ERROR_LOG(UG_NAME_NORMAL, "Failed to get VCONFKEY_WIFI_ENABLE_QS");
+ break;
+ }
+
+ elm_genlist_item_update(item);
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static Evas_Object *_gl_bottom_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (manager_object == NULL || obj == NULL)
+ return NULL;
+
+ int ret = -1;
+
+ Evas_Object *toggle_btn = elm_check_add(obj);
+ assertm_if(NULL == toggle_btn, "NULL!!");
+ elm_object_style_set(toggle_btn, "on&off");
+ evas_object_propagate_events_set(toggle_btn, EINA_TRUE);
+ ret = common_util_get_system_registry(VCONFKEY_WIFI_ENABLE_QS);
+ switch (ret) {
+ case 1:
+ elm_check_state_set(toggle_btn, EINA_TRUE);
+ break;
+ case 0:
+ elm_check_state_set(toggle_btn, EINA_FALSE);
+ break;
+ default:
+ assertm_if(TRUE, "Setting fail!!");
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return toggle_btn;
+}
+
+static void _hidden_button_callback(void* data, Evas_Object* obj, void* event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ ug_app_state->hidden_ap_popup = view_hidden_ap_popup_create(ug_app_state->layout_main, PACKAGE);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static Evas_Object *_gl_hidden_btn_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *find_hidden_ap_btn = elm_button_add(obj);
+ evas_object_smart_callback_add(find_hidden_ap_btn, "clicked", _hidden_button_callback, NULL);
+ evas_object_propagate_events_set(find_hidden_ap_btn, EINA_FALSE);
+ elm_object_style_set(find_hidden_ap_btn, "style2");
+ elm_object_text_set(find_hidden_ap_btn, sc(PACKAGE, I18N_TYPE_Find_Hidden_Network));
+
+ return find_hidden_ap_btn;
+}
+
+static int viewer_manager_header_create(Evas_Object* genlist)
+{
+ __COMMON_FUNC_ENTER__;
+ manager_object->header_text = g_strdup(sc(PACKAGE, I18N_TYPE_Wi_Fi));
+
+ header_itc_text.item_style = "dialogue/1text.1icon";
+ header_itc_text.func.text_get = _gl_header_text_get;
+ header_itc_text.func.content_get = _gl_header_content_get;
+ header_itc_text.func.state_get = NULL;
+ header_itc_text.func.del = NULL;
+
+ common_utils_add_dialogue_separator(genlist, "dialogue/separator");
+
+ assertm_if(NULL != manager_object->item_header, "ERROR!!");
+ manager_object->item_header = elm_genlist_item_append(genlist, &header_itc_text, NULL, NULL, ELM_GENLIST_ITEM_NONE, _gl_header_sel_cb, NULL);
+ assertm_if(NULL == manager_object->item_header, "NULL!!");
+
+ common_utils_add_dialogue_separator(genlist, "dialogue/separator");
+
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+}
+
+static int viewer_manager_bottom_create(Evas_Object* genlist)
+{
+ __COMMON_FUNC_ENTER__;
+ assertm_if(NULL == genlist, "NULL!!");
+
+ bottom_itc_text.item_style = "dialogue/1text.1icon";
+ bottom_itc_text.func.text_get = _gl_bottom_text_get;
+ bottom_itc_text.func.content_get = _gl_bottom_content_get;
+ bottom_itc_text.func.state_get = NULL;
+ bottom_itc_text.func.del = NULL;
+
+ bottom_itc_helper_text.item_style = "multiline/1text";
+ bottom_itc_helper_text.func.text_get = _gl_bottom_helper_text_get;
+ bottom_itc_helper_text.func.content_get = NULL;
+ bottom_itc_helper_text.func.state_get = NULL;
+ bottom_itc_helper_text.func.del = NULL;
+
+ elm_genlist_item_append(genlist, &bottom_itc_text, NULL, NULL, ELM_GENLIST_ITEM_NONE, _gl_bottom_sel_cb, NULL);
+
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ Elm_Object_Item *item = elm_genlist_item_append(genlist, &bottom_itc_helper_text, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ common_utils_add_dialogue_separator(genlist, "dialogue/separator");
+
+ __COMMON_FUNC_EXIT__;
+
+ return TRUE;
+}
+
+static int viewer_manager_hidden_button_create(Evas_Object* genlist)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (NULL != manager_object->item_sep_above_hidden_button ||
+ NULL != manager_object->item_sep_below_hidden_button ||
+ NULL != manager_object->item_hidden_btn) {
+
+ __COMMON_FUNC_EXIT__;
+ return FALSE;
+ }
+
+ assertm_if(NULL == genlist, "NULL!!");
+
+ hidden_button_itc.item_style = "1icon";
+ hidden_button_itc.func.text_get = NULL;
+ hidden_button_itc.func.content_get = _gl_hidden_btn_content_get;
+ hidden_button_itc.func.state_get = NULL;
+ hidden_button_itc.func.del = NULL;
+
+ manager_object->item_sep_above_hidden_button = common_utils_add_dialogue_separator(genlist, "dialogue/separator");
+
+ manager_object->item_hidden_btn = elm_genlist_item_append(genlist, &hidden_button_itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ assertm_if(NULL == manager_object->item_hidden_btn, "NULL!!");
+
+ manager_object->item_sep_below_hidden_button = common_utils_add_dialogue_separator(genlist, "dialogue/separator");
+
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+}
+
+static Eina_Bool viewer_manager_scan_button_set(Eina_Bool show_state)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if(NULL == manager_object) {
+ __COMMON_FUNC_EXIT__;
+ return EINA_FALSE;
+ }
+
+ if (show_state == EINA_TRUE) {
+ Evas_Object* navi_frame = viewer_manager_get_naviframe();
+ view_manager_view_type_t top_view_id = (view_manager_view_type_t)evas_object_data_get(navi_frame, SCREEN_TYPE_ID_KEY);
+ if(VIEW_MANAGER_VIEW_TYPE_MAIN == top_view_id) {
+ INFO_LOG(UG_NAME_NORMAL,"Show directly");
+ elm_object_item_disabled_set((Elm_Object_Item *)manager_object->scan_button, EINA_FALSE);
+ } else {
+ INFO_LOG(UG_NAME_NORMAL,"Show reserve");
+ }
+ } else if (show_state == EINA_FALSE) {
+ elm_object_item_disabled_set((Elm_Object_Item *)manager_object->scan_button, EINA_TRUE);
+ }
+
+ __COMMON_FUNC_EXIT__;
+
+ return EINA_TRUE;
+}
+
+Evas_Object* viewer_manager_create(Evas_Object* _parent)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (manager_object != NULL || _parent == NULL) {
+ __COMMON_FUNC_EXIT__;
+ return NULL;
+ }
+
+ manager_object = g_new0(viewer_manager_object, 1);
+
+ /* Add Full Layout */
+ Evas_Object *layout = elm_layout_add(_parent);
+ elm_layout_theme_set(layout, "layout", "application", "default");
+ evas_object_size_hint_weight_set(layout,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(_parent, layout);
+ edje_object_signal_emit(elm_layout_edje_get(layout),
+ "elm,state,show,content", "elm");
+ edje_object_signal_emit(elm_layout_edje_get(layout),
+ "elm,bg,show,group_list", "elm");
+ edje_object_signal_emit(elm_layout_edje_get(layout),
+ "elm,state,show,indicator", "elm");
+
+ /* Add Naviframe */
+ manager_object->nav = elm_naviframe_add(layout);
+ elm_object_part_content_set(layout,
+ "elm.swallow.content", manager_object->nav);
+
+ /* Add MainView Layout */
+ Evas_Object* view_content = elm_layout_add(manager_object->nav);
+ elm_layout_theme_set(view_content, "standard", "window", "integration");
+ edje_object_signal_emit(elm_layout_edje_get(view_content),
+ "elm,state,show,content", "elm");
+ edje_object_signal_emit(elm_layout_edje_get(view_content),
+ "elm,bg,show,group_list", "elm");
+
+ /* Add Genlist */
+ manager_object->list = viewer_list_create(view_content);
+ assertm_if(NULL == manager_object->list, "manager_object->list is NULL!!");
+ viewer_manager_header_create(manager_object->list);
+ viewer_manager_bottom_create(manager_object->list);
+
+ elm_object_part_content_set(view_content,
+ "elm.swallow.content", manager_object->list);
+
+ if (ug_app_state->ug_type == UG_VIEW_SETUP_WIZARD) {
+ Elm_Object_Item* navi_it = elm_naviframe_item_push(manager_object->nav,
+ sc(PACKAGE, I18N_TYPE_Wi_Fi), NULL, NULL, view_content, NULL);
+ evas_object_data_set(manager_object->nav, SCREEN_TYPE_ID_KEY,
+ (void *)VIEW_MANAGER_VIEW_TYPE_MAIN);
+ evas_object_smart_callback_add(manager_object->nav,
+ "transition,finished", _hide_finished_cb, navi_it);
+
+ manager_object->prev_button = elm_button_add(manager_object->nav);
+ elm_object_style_set(manager_object->prev_button,
+ "naviframe/toolbar/default");
+ elm_object_text_set(manager_object->prev_button,
+ ug_app_state->lbutton_setup_wizard_prev);
+ evas_object_smart_callback_add(manager_object->prev_button,
+ "clicked", _lbutton_click_cb, NULL);
+ elm_object_item_part_content_set(navi_it, "toolbar_button1",
+ manager_object->prev_button);
+
+ manager_object->next_button = elm_button_add(manager_object->nav);
+ elm_object_style_set(manager_object->next_button,
+ "naviframe/toolbar/default");
+ elm_object_text_set(manager_object->next_button,
+ ug_app_state->rbutton_setup_wizard_next);
+ evas_object_smart_callback_add(manager_object->next_button,
+ "clicked", _rbutton_click_cb, NULL);
+ elm_object_item_part_content_set(navi_it, "toolbar_button2",
+ manager_object->next_button);
+ } else {
+ Evas_Object* back_btn = elm_button_add(manager_object->nav);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(back_btn, "clicked", _back_sk_cb, NULL);
+
+ Elm_Object_Item* navi_it = elm_naviframe_item_push(manager_object->nav,
+ sc(PACKAGE, I18N_TYPE_Wi_Fi), back_btn, NULL,
+ view_content, NULL);
+ evas_object_data_set(manager_object->nav, SCREEN_TYPE_ID_KEY,
+ (void *)VIEW_MANAGER_VIEW_TYPE_MAIN);
+ evas_object_smart_callback_add(manager_object->nav,
+ "transition,finished", _hide_finished_cb, navi_it);
+
+ manager_object->scan_button = elm_button_add(manager_object->nav);
+ elm_object_style_set(manager_object->scan_button,
+ "naviframe/toolbar/default");
+ elm_object_text_set(manager_object->scan_button,
+ sc(PACKAGE, I18N_TYPE_Scan));
+ evas_object_smart_callback_add(manager_object->scan_button,
+ "clicked", __refresh_scan_callback, NULL);
+ elm_object_item_part_content_set(navi_it,
+ "toolbar_button1", manager_object->scan_button);
+ }
+
+ evas_object_show(layout);
+
+ __COMMON_FUNC_EXIT__;
+ return layout;
+}
+
+Eina_Bool viewer_manager_destroy()
+{
+ __COMMON_FUNC_ENTER__;
+
+ viewer_list_destroy();
+ if (manager_object) {
+ if (manager_object->header_text) {
+ g_free(manager_object->header_text);
+ manager_object->header_text = NULL;
+ }
+ g_free(manager_object);
+ manager_object = NULL;
+ }
+ __COMMON_FUNC_EXIT__;
+ return EINA_TRUE;
+}
+
+Eina_Bool viewer_manager_show(VIEWER_WINSETS winset)
+{
+ __COMMON_FUNC_ENTER__;
+
+ assertm_if(NULL == manager_object, "NULL!!");
+
+ switch (winset) {
+ case VIEWER_WINSET_SEARCHING:
+ viewer_manager_scan_button_set(EINA_FALSE);
+ viewer_list_item_disable_all();
+ break;
+ case VIEWER_WINSET_SUB_CONTENTS:
+ assertm_if(NULL == manager_object->list, "NULL!!");
+ viewer_list_title_item_set();
+ viewer_manager_hidden_button_create(manager_object->list);
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return EINA_TRUE;
+}
+
+Eina_Bool viewer_manager_hide(VIEWER_WINSETS winset)
+{
+ __COMMON_FUNC_ENTER__;
+
+ switch (winset) {
+ case VIEWER_WINSET_SEARCHING:
+ /* searching view */
+ viewer_manager_scan_button_set(EINA_TRUE);
+ viewer_list_item_enable_all();
+ break;
+ case VIEWER_WINSET_SUB_CONTENTS:
+ /* hidden AP and WPS PBC */
+ if (ug_app_state->passpopup) {
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ }
+ if (ug_app_state->eap_view) {
+ eap_view_close(ug_app_state->eap_view);
+ ug_app_state->eap_view = NULL;
+ }
+ viewer_list_title_item_del();
+ assertm_if(NULL == manager_object->item_sep_above_hidden_button, "NULL!!");
+ assertm_if(NULL == manager_object->item_sep_below_hidden_button, "NULL!!");
+ assertm_if(NULL == manager_object->item_hidden_btn, "NULL!!");
+ elm_object_item_del(manager_object->item_sep_above_hidden_button);
+ elm_object_item_del(manager_object->item_sep_below_hidden_button);
+ elm_object_item_del(manager_object->item_hidden_btn);
+ manager_object->item_sep_above_hidden_button = NULL;
+ manager_object->item_sep_below_hidden_button = NULL;
+ manager_object->item_hidden_btn = NULL;
+ break;
+ default:
+ /* Err */
+ assertm_if(TRUE, "Err!!");
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return EINA_TRUE;
+}
+
+Eina_Bool viewer_manager_genlist_item_update(Elm_Object_Item* item)
+{
+ __COMMON_FUNC_ENTER__;
+ if (item == NULL) {
+ __COMMON_FUNC_EXIT__;
+ return EINA_FALSE;
+ }
+
+ elm_genlist_item_update(item);
+
+ __COMMON_FUNC_EXIT__;
+ return EINA_FALSE;
+}
+
+int viewer_manager_hidden_disable_set(int mode)
+{
+ __COMMON_FUNC_ENTER__;
+ assertm_if(NULL == manager_object->item_hidden_btn, "NULL!!");
+
+ elm_object_item_disabled_set(manager_object->item_hidden_btn, mode);
+ elm_genlist_item_update(manager_object->item_hidden_btn);
+
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+}
+
+static Eina_Bool _gl_bring_in(void *data)
+{
+ if (manager_object == NULL)
+ return ECORE_CALLBACK_CANCEL;
+
+ if (manager_object->item_header == NULL)
+ return ECORE_CALLBACK_CANCEL;
+
+ elm_genlist_item_bring_in(manager_object->item_header, ELM_GENLIST_ITEM_SCROLLTO_IN);
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void viewer_manager_scroll_to_top()
+{
+ if (manager_object->item_header == NULL)
+ return;
+
+ ecore_idler_add((Ecore_Task_Cb)_gl_bring_in, NULL);
+}
+
+static void viewer_manager_setup_wizard_button_controller(HEADER_MODES mode)
+{
+ switch (mode) {
+ case HEADER_MODE_OFF:
+ case HEADER_MODE_ON:
+ if (manager_object->next_button != NULL && ug_app_state->rbutton_setup_wizard_skip != NULL)
+ elm_object_text_set(manager_object->next_button, ug_app_state->rbutton_setup_wizard_skip);
+ break;
+ case HEADER_MODE_CONNECTED:
+ if (manager_object->next_button != NULL && ug_app_state->rbutton_setup_wizard_next != NULL)
+ elm_object_text_set(manager_object->next_button, ug_app_state->rbutton_setup_wizard_next);
+ break;
+ default:
+ break;
+ }
+}
+
+int viewer_manager_header_mode_set(HEADER_MODES mode)
+{
+ __COMMON_FUNC_ENTER__;
+
+ assertm_if(NULL == manager_object, "NULL!!");
+ assertm_if(NULL == manager_object->item_header, "NULL!!");
+ assertm_if(HEADER_MODE_OFF > mode || HEADER_MODE_MAX <= mode, "Err!!");
+
+ if (manager_object->header_mode == mode) {
+ return FALSE;
+ }
+
+ DEBUG_LOG(UG_NAME_NORMAL, "Header mode changing from %d --> %d", manager_object->header_mode, mode);
+ manager_object->header_mode = mode;
+ if (manager_object->header_text) {
+ g_free(manager_object->header_text);
+ manager_object->header_text = NULL;
+ }
+
+ switch (mode) {
+ case HEADER_MODE_OFF:
+ case HEADER_MODE_ON:
+ case HEADER_MODE_CONNECTED:
+ viewer_manager_hidden_disable_set(FALSE);
+ viewer_manager_scan_button_set(EINA_TRUE);
+ manager_object->header_text = g_strdup(sc(PACKAGE, I18N_TYPE_Wi_Fi));
+ break;
+ case HEADER_MODE_ACTIVATING:
+ viewer_manager_hidden_disable_set(TRUE);
+ manager_object->header_text = g_strdup(sc(PACKAGE, I18N_TYPE_Activating_WiFi));
+ break;
+ case HEADER_MODE_DEACTIVATING:
+ viewer_manager_hidden_disable_set(TRUE);
+ manager_object->header_text = g_strdup(sc(PACKAGE, I18N_TYPE_Deactivating));
+ break;
+ case HEADER_MODE_CONNECTING:
+ case HEADER_MODE_DISCONNECTING:
+ case HEADER_MODE_CANCEL_CONNECTING:
+ case HEADER_MODE_SEARCHING:
+ viewer_manager_hidden_disable_set(TRUE);
+ manager_object->header_text = g_strdup(sc(PACKAGE, I18N_TYPE_Wi_Fi));
+ break;
+ default:
+ assertm_if(TRUE, "Err!!");
+ break;
+ }
+
+
+ elm_genlist_item_update(manager_object->item_header);
+ viewer_list_title_item_update();
+
+
+ if (ug_app_state->ug_type == UG_VIEW_SETUP_WIZARD) {
+ viewer_manager_setup_wizard_button_controller(mode);
+ }
+
+ __COMMON_FUNC_EXIT__;
+
+ return TRUE;
+}
+
+HEADER_MODES viewer_manager_header_mode_get(void){
+ __COMMON_FUNC_ENTER__;
+ assertm_if(HEADER_MODE_OFF > manager_object->header_mode ||
+ HEADER_MODE_MAX <= manager_object->header_mode, "Err!");
+ __COMMON_FUNC_EXIT__;
+
+ return manager_object->header_mode;
+}
+
+Evas_Object* viewer_manager_get_naviframe()
+{
+ return manager_object->nav;
+}
+
+void viewer_manager_update_ap_handle(Elm_Object_Item *item, wifi_ap_h ap)
+{
+ if (!item || !ap) {
+ return;
+ }
+
+ ug_genlist_data_t *gdata = elm_object_item_data_get(item);
+ if (!gdata) {
+ return;
+ }
+ wifi_device_info_t *wifi_device = gdata->device_info;
+ if (!wifi_device) {
+ return;
+ }
+ wifi_ap_h ap_to_destroy = wifi_device->ap;
+ if (WIFI_ERROR_NONE == wifi_ap_clone(&(wifi_device->ap), ap)) {
+ wifi_ap_destroy(ap_to_destroy);
+ }
+
+ return;
+}
+
+Elm_Object_Item *viewer_manager_move_item_to_top(Elm_Object_Item *old_item)
+{
+ __COMMON_FUNC_ENTER__;
+ Elm_Object_Item *new_item = NULL;
+ Elm_Object_Item *first_item = viewer_list_get_first_item();
+ ug_genlist_data_t *gdata = NULL;
+ wifi_device_info_t *old_wifi_device = NULL;
+
+ if (!old_item || !first_item) {
+ __COMMON_FUNC_EXIT__;
+ return NULL;
+ }
+
+ gdata = elm_object_item_data_get(old_item);
+ if (!gdata || !gdata->device_info) {
+ __COMMON_FUNC_EXIT__;
+ return NULL;
+ }
+ old_wifi_device = gdata->device_info;
+
+ if (old_item == first_item) {
+ __COMMON_FUNC_EXIT__;
+ return old_item;
+ }
+
+ new_item = viewer_list_item_insert_after(old_wifi_device->ap, NULL);
+ viewer_list_item_del(old_item);
+
+ __COMMON_FUNC_EXIT__;
+ return new_item;
+}
+
+void viewer_manager_update_connected_ap_sig_str(void)
+{
+ wifi_ap_h ap;
+ int ret = wifi_get_connected_ap(&ap);
+ if (WIFI_ERROR_NONE != ret) {
+ return;
+ }
+ Elm_Object_Item *item = item_get_for_ap(ap);
+ if (!item) {
+ wifi_ap_destroy(ap);
+ return;
+ }
+
+ ug_genlist_data_t* gdata = elm_object_item_data_get(item);
+ if (gdata && gdata->device_info) {
+ int rssi = 0;
+ if (WIFI_ERROR_NONE != wifi_ap_get_rssi(ap, &rssi)) {
+ wifi_ap_destroy(ap);
+ return;
+ } else if (gdata->device_info->rssi != rssi) {
+ gdata->device_info->rssi = rssi;
+ g_free(gdata->device_info->ap_image_path);
+ gdata->device_info->ap_image_path = common_utils_get_device_icon(WIFI_APP_IMAGE_DIR, gdata->device_info);
+ elm_genlist_item_update(item);
+ }
+ }
+ wifi_ap_destroy(ap);
+}
+
+static bool wifi_update_list_for_each_ap(wifi_ap_h ap, void *user_data)
+{
+ view_manager_list_update_info_t *update_info = (view_manager_list_update_info_t *)user_data;
+ Elm_Object_Item *item;;
+
+ item = viewer_list_item_insert_after(ap, update_info->last_appended_item);
+ if (item) {
+ update_info->last_appended_item = item;
+ update_info->total_items_added++;
+ }
+
+ return true;
+}
+
+static void viewer_manager_update_list_all()
+{
+ Elm_Object_Item *item = NULL;
+
+ __COMMON_FUNC_ENTER__;
+
+ view_manager_list_update_info_t update_info;
+ memset(&update_info, 0, sizeof(update_info));
+
+ wifi_foreach_found_aps (wifi_update_list_for_each_ap, &update_info);
+ DEBUG_LOG(UG_NAME_NORMAL, "total items added = %d", update_info.total_items_added);
+
+ if (0 == update_info.total_items_added) {
+ /* if there is no scan_data, generate No-AP item */
+ item = viewer_list_item_insert_after(NULL, NULL);
+ if (item) {
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ }
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+Eina_Bool viewer_manager_refresh(void)
+{
+ INFO_LOG(UG_NAME_SCAN, "UI update start");
+ int profile_state;
+
+ if (manager_object == NULL)
+ return EINA_FALSE;
+
+ /* Remove the list */
+ viewer_list_item_clear();
+
+ profile_state = wlan_manager_state_get();
+ if (WLAN_MANAGER_ERROR == profile_state || WLAN_MANAGER_OFF == profile_state) {
+ /* Some body requested to refresh the list while the WLAN manager is OFF or Unable to get the profile state */
+ INFO_LOG(UG_NAME_ERR, "Refresh requested in wrong state or Unable to get the state. Profile state = %d !!! ", profile_state);
+ viewer_manager_header_mode_set(HEADER_MODE_OFF);
+ return EINA_FALSE;
+ }
+
+ wifi_ap_h ap = wlan_manager_get_ap_with_state(profile_state);
+ viewer_manager_update_list_all();
+
+ if (WLAN_MANAGER_CONNECTING == profile_state) {
+ INFO_LOG(UG_NAME_NORMAL, "Profile is connecting...");
+ Elm_Object_Item* target_item = item_get_for_ap(ap);
+ viewer_manager_header_mode_set(HEADER_MODE_CONNECTING);
+ viewer_list_item_radio_mode_set(target_item, VIEWER_ITEM_RADIO_MODE_CONNECTING);
+ } else if (WLAN_MANAGER_CONNECTED == profile_state) {
+ INFO_LOG(UG_NAME_NORMAL, "Profile is connected");
+ Elm_Object_Item* target_item = item_get_for_ap(ap);
+ target_item = viewer_manager_move_item_to_top(target_item);
+ viewer_manager_header_mode_set(HEADER_MODE_CONNECTED);
+ viewer_list_item_radio_mode_set(target_item, VIEWER_ITEM_RADIO_MODE_CONNECTED);
+ } else if (WLAN_MANAGER_DISCONNECTING == profile_state) {
+ INFO_LOG(UG_NAME_NORMAL, "Profile is disconnecting");
+ Elm_Object_Item* target_item = item_get_for_ap(ap);
+ viewer_manager_header_mode_set(HEADER_MODE_DISCONNECTING);
+ viewer_list_item_radio_mode_set(target_item, VIEWER_ITEM_RADIO_MODE_DISCONNECTING);
+ } else {
+ INFO_LOG(UG_NAME_NORMAL, "Profile state = %d", profile_state);
+ viewer_manager_header_mode_set(HEADER_MODE_ON);
+ }
+ wifi_ap_destroy(ap);
+ INFO_LOG(UG_NAME_SCAN, "UI update finish");
+
+ return EINA_TRUE;
+}
+
+static void hidden_ap_connect_ok_cb (void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ hidden_ap_data_t *hidden_ap_data = (hidden_ap_data_t *)data;
+ if (!hidden_ap_data)
+ return;
+
+ char* szPassword = NULL;
+ wifi_ap_h ap;
+ int ret = wifi_ap_create(hidden_ap_data->ssid, &ap);
+ if (WIFI_ERROR_NONE != ret) {
+ ERROR_LOG(UG_NAME_ERR, "Failed to create an AP handle. Err = %d", ret);
+ return;
+ }
+ INFO_LOG(UG_NAME_NORMAL, "Hidden AP[%s]. Sec mode = %d. Connect ok cb", hidden_ap_data->ssid, hidden_ap_data->sec_mode);
+
+ switch (hidden_ap_data->sec_mode) {
+ case WLAN_SEC_MODE_NONE:
+ INFO_LOG(UG_NAME_NORMAL, "This hidden AP is Open. event info = %x; passpopup = %x", event_info, ug_app_state->passpopup);
+ wifi_ap_set_security_type(ap, WIFI_SECURITY_TYPE_NONE);
+ evas_object_del(hidden_ap_data->confirmation_popup);
+ hidden_ap_data->confirmation_popup = NULL;
+ break;
+
+ case WLAN_SEC_MODE_WEP:
+ case WLAN_SEC_MODE_WPA_PSK:
+ case WLAN_SEC_MODE_WPA2_PSK:
+ szPassword = common_pswd_popup_get_txt(ug_app_state->passpopup);
+ INFO_LOG(UG_NAME_NORMAL, "Hidden AP paswd = [%s]", szPassword);
+ if (WLAN_SEC_MODE_WEP == hidden_ap_data->sec_mode) {
+ wifi_ap_set_security_type(ap, WIFI_SECURITY_TYPE_WEP);
+ } else if (WLAN_SEC_MODE_WPA_PSK == hidden_ap_data->sec_mode) {
+ wifi_ap_set_security_type(ap, WIFI_SECURITY_TYPE_WPA_PSK);
+ } else {
+ wifi_ap_set_security_type(ap, WIFI_SECURITY_TYPE_WPA2_PSK);
+ }
+ wifi_ap_set_passphrase(ap, szPassword);
+ g_free(szPassword);
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ break;
+
+ default:
+ INFO_LOG(UG_NAME_NORMAL, "Fatal: Unknown Sec mode: %d", hidden_ap_data->sec_mode);
+ goto hidden_ap_connect_end;
+ }
+
+ wlan_manager_connect_with_wifi_info(ap);
+
+hidden_ap_connect_end:
+ wifi_ap_destroy(ap);
+ g_free(hidden_ap_data->ssid);
+ g_free(hidden_ap_data);
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+static void hidden_ap_connect_cacel_cb (void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ hidden_ap_data_t *hidden_ap_data = (hidden_ap_data_t *)data;
+ if (!hidden_ap_data)
+ return;
+
+ switch (hidden_ap_data->sec_mode) {
+ case WLAN_SEC_MODE_NONE:
+ INFO_LOG(UG_NAME_NORMAL, "This hidden AP is Open");
+ evas_object_del(hidden_ap_data->confirmation_popup);
+ hidden_ap_data->confirmation_popup = NULL;
+ break;
+
+ case WLAN_SEC_MODE_WEP:
+ case WLAN_SEC_MODE_WPA_PSK:
+ case WLAN_SEC_MODE_WPA2_PSK:
+ INFO_LOG(UG_NAME_NORMAL, "Hidden AP Secured");
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ break;
+
+ default:
+ INFO_LOG(UG_NAME_NORMAL, "Fatal: Unknown Sec mode: %d", hidden_ap_data->sec_mode);
+ break;
+ }
+
+ g_free(hidden_ap_data->ssid);
+ g_free(hidden_ap_data);
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+void viewer_manager_specific_scan_response_hlr(GSList *bss_info_list, void *user_data)
+{
+ hidden_ap_data_t *hidden_ap_data = NULL;
+ const char *ssid = (const char *)user_data;
+ wlan_security_mode_type_t sec_mode;
+
+ if (!ug_app_state->hidden_ap_popup) {
+ ERROR_LOG(UG_NAME_RESP, "Popup is already destroyed \n");
+ g_free(user_data);
+ return;
+ }
+
+ if (!ssid) {
+ ERROR_LOG(UG_NAME_RESP, "SSID is empty \n");
+ view_hidden_ap_popup_destroy(ug_app_state->hidden_ap_popup);
+ ug_app_state->hidden_ap_popup = NULL;
+ return;
+ }
+
+ INFO_LOG(UG_NAME_RESP, "Specific scan complete response received for AP[%s]", ssid);
+ int ap_count = g_slist_length(bss_info_list);
+ net_wifi_connection_info_t *bss_info = NULL;
+
+ if (ap_count == 1) {
+ bss_info = g_slist_nth_data(bss_info_list, 0);
+ if (!bss_info || g_strcmp0(ssid, bss_info->essid)) {
+ INFO_LOG(UG_NAME_RESP, "Fatal: Bss info is NULL OR response received for wrong ssid. ", ssid);
+ /* Bss info not available or Response recieved for wrong ssid */
+ ap_count = 0;
+ } else {
+ sec_mode = bss_info->security_info.sec_mode;
+ }
+ }
+
+ if (ap_count == 1) {
+ /* Only if there is one AP found then we need Users further action */
+
+ switch (sec_mode) {
+ case WLAN_SEC_MODE_NONE:
+ INFO_LOG(UG_NAME_NORMAL, "One AP item with ssid[%s] found. Its security is Open.", ssid);
+ /* This is an Open AP. Ask for confirmation to connect. */
+ hidden_ap_data = g_new0(hidden_ap_data_t, 1);
+ hidden_ap_data->sec_mode = WLAN_SEC_MODE_NONE;
+ hidden_ap_data->ssid = g_strdup(ssid);
+
+ popup_btn_info_t popup_btn_data;
+ memset(&popup_btn_data, 0, sizeof(popup_btn_data));
+ popup_btn_data.info_txt = "Wi-Fi network detected. Connect?";
+ popup_btn_data.btn1_cb = hidden_ap_connect_ok_cb;
+ popup_btn_data.btn2_cb = hidden_ap_connect_cacel_cb;
+ popup_btn_data.btn2_data = popup_btn_data.btn1_data = hidden_ap_data;
+ popup_btn_data.btn1_txt = sc(PACKAGE, I18N_TYPE_Connect);
+ popup_btn_data.btn2_txt = sc(PACKAGE, I18N_TYPE_Cancel);
+ hidden_ap_data->confirmation_popup = common_utils_show_info_popup(ug_app_state->layout_main, &popup_btn_data);
+ break;
+ case WLAN_SEC_MODE_IEEE8021X:
+ INFO_LOG(UG_NAME_NORMAL, "One AP item with ssid[%s] found. Its security is EAP.", ssid);
+ /* This is a EAP secured AP. Ask for confirmation to connect. */
+ Evas_Object* navi_frame = viewer_manager_get_naviframe();
+ wifi_device_info_t device_info;
+ wifi_ap_h ap;
+
+ wifi_ap_create(ssid, &ap);
+ wifi_ap_set_security_type(ap, common_utils_get_sec_mode(sec_mode));
+
+ memset(&device_info, 0, sizeof(device_info));
+ device_info.security_mode = sec_mode;
+ device_info.ssid = (char *)ssid;
+ device_info.ap = ap;
+ ug_app_state->eap_view = create_eap_connect_view(ug_app_state->layout_main, navi_frame, PACKAGE, &device_info);
+ wifi_ap_destroy(ap);
+ break;
+ case WLAN_SEC_MODE_WEP:
+ case WLAN_SEC_MODE_WPA_PSK:
+ case WLAN_SEC_MODE_WPA2_PSK:
+ INFO_LOG(UG_NAME_NORMAL, "One AP item with ssid[%s] found. Its security is %d", ssid, sec_mode);
+ /* This is a WEP/WPA/WPA-2 secured AP. Ask for confirmation to connect. */
+ hidden_ap_data = g_new0(hidden_ap_data_t, 1);
+ pswd_popup_create_req_data_t popup_info;
+ memset(&popup_info, 0, sizeof(pswd_popup_create_req_data_t));
+ hidden_ap_data->sec_mode = sec_mode;
+ hidden_ap_data->ssid = g_strdup(ssid);
+ popup_info.title = (char *)ssid;
+ popup_info.ok_cb = hidden_ap_connect_ok_cb;
+ popup_info.cancel_cb = hidden_ap_connect_cacel_cb;
+ popup_info.show_wps_btn = FALSE;
+ popup_info.wps_btn_cb = NULL;
+ popup_info.cb_data = hidden_ap_data;
+ popup_info.ap = NULL;
+ INFO_LOG(UG_NAME_NORMAL, "Going to create a popup. ug_app_state = 0x%x", ug_app_state);
+ ug_app_state->passpopup = common_pswd_popup_create(ug_app_state->layout_main, PACKAGE, &popup_info);
+ INFO_LOG(UG_NAME_NORMAL, "After create a popup");
+ if (ug_app_state->passpopup == NULL) {
+ INFO_LOG(UG_NAME_ERR, "pass popup create failed !");
+ }
+ break;
+ default:
+ INFO_LOG(UG_NAME_NORMAL, "Unkown security mode: %d", sec_mode);
+ break;
+ }
+ } else if (ap_count == 0) {
+ INFO_LOG(UG_NAME_NORMAL, "No AP item with ssid[%s] found", ssid);
+ char *disp_msg = g_strdup_printf("Unable to find %s", ssid);
+ common_utils_show_info_ok_popup(ug_app_state->layout_main, PACKAGE, disp_msg);
+ g_free(disp_msg);
+ } else {
+ INFO_LOG(UG_NAME_NORMAL, "More than one AP items with ssid[%s] found", ssid);
+ }
+
+ /* If the hidden AP found on first and second scan OR not found even after first and second scan then delete the popup */
+ g_free(user_data);
+ view_hidden_ap_popup_destroy(ug_app_state->hidden_ap_popup);
+ ug_app_state->hidden_ap_popup = NULL;
+ return;
+}
diff --git a/sources/ui-gadget/viewers-layout/wifi_viewer_list.c b/sources/ui-gadget/viewers-layout/wifi_viewer_list.c
new file mode 100644
index 0000000..7255874
--- /dev/null
+++ b/sources/ui-gadget/viewers-layout/wifi_viewer_list.c
@@ -0,0 +1,840 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "common.h"
+#include "common_utils.h"
+#include "ug_wifi.h"
+#include "wlan_manager.h"
+#include "view_detail.h"
+#include "viewer_list.h"
+#include "viewer_manager.h"
+#include "appcoreWrapper.h"
+#include "i18nmanager.h"
+
+#define LIST_ITEM_CONNECTED_AP_FONT_SIZE 28
+#define LIST_ITEM_CONNECTED_AP_FONT_COLOR "#3B73B6"
+#define FIRST_ITEM_NUMBER 8
+
+
+static Evas_Object* viewer_list = NULL;
+static Elm_Object_Item* first_item = NULL;
+static Elm_Object_Item* last_item = NULL;
+
+static Elm_Genlist_Item_Class itc;
+static Elm_Genlist_Item_Class grouptitle_itc;
+static Elm_Object_Item* grouptitle = NULL;
+
+extern wifi_appdata *ug_app_state;
+
+void list_select_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ INFO_LOG(UG_NAME_NORMAL,"=================\n");
+ INFO_LOG(UG_NAME_NORMAL," %s %d\n", __func__ ,__LINE__);
+ INFO_LOG(UG_NAME_NORMAL,"=================\n");
+
+ if (data == NULL) {
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ wifi_device_info_t *device_info = (wifi_device_info_t *)data;
+
+ DEBUG_LOG(UG_NAME_NORMAL, "ssid [%s]", device_info->ssid);
+
+ view_detail(device_info, ug_app_state->layout_main);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static char* _gl_listview_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ char* det = NULL;
+ assertm_if(NULL == obj, "NULL!!");
+ assertm_if(NULL == part, "NULL!!");
+ assertm_if(NULL == data, "NULL!!");
+
+ ug_genlist_data_t* gdata = (ug_genlist_data_t*) data;
+ assertm_if(NULL == gdata, "NULL!!");
+ assertm_if(NULL == gdata->device_info, "NULL!!");
+ assertm_if(NULL == gdata->device_info->ssid, "NULL!!");
+ assertm_if(NULL == gdata->device_info->ap_status_txt, "NULL!!");
+
+ if (!strncmp(part, "elm.text.1", strlen(part))) {
+ det = g_strdup(gdata->device_info->ssid);
+ assertm_if(NULL == det, "NULL!!");
+ } else if (!strncmp(part, "elm.text.2", strlen(part))) {
+ det = g_strdup(gdata->device_info->ap_status_txt);
+ assertm_if(NULL == det, "NULL!!");
+ }
+ return det;
+}
+
+static Evas_Object *_gl_listview_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ assertm_if(NULL == obj, "NULL!!");
+ assertm_if(NULL == data, "NULL!!");
+ assertm_if(NULL == part, "NULL!!");
+
+ ug_genlist_data_t* gdata = (ug_genlist_data_t*) data;
+ Evas_Object* icon = NULL;
+
+ if (gdata->device_info->ap_image_path == NULL) {
+ /* if there is no ap_image_path (NO AP Found situation) */
+ DEBUG_LOG(UG_NAME_ERR, "Fatal: Image path is NULL");
+ } else if (!strncmp(part, "elm.icon.1", strlen(part))) {
+ /* for strength */
+ icon = elm_image_add(obj);
+ assertm_if(NULL == icon, "NULL!!");
+ elm_image_file_set(icon, gdata->device_info->ap_image_path, NULL);
+ } else if (!strncmp(part, "elm.icon.2", strlen(part))) {
+ if (VIEWER_ITEM_RADIO_MODE_CONNECTING == gdata->radio_mode) {
+ icon = elm_progressbar_add(obj);
+ elm_object_style_set(icon, "list_process");
+ evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_progressbar_pulse(icon, TRUE);
+ } else {
+ icon = elm_button_add(obj);
+ assertm_if(NULL == icon, "NULL!!");
+ elm_object_style_set(icon, "reveal");
+ evas_object_smart_callback_add(icon, "clicked", (Evas_Smart_Cb)list_select_cb, gdata->device_info);
+ evas_object_propagate_events_set(icon, EINA_FALSE);
+ }
+ }
+
+ return icon;
+}
+
+static void _gl_listview_del(void* data, Evas_Object* obj)
+{
+ if (data == NULL)
+ return;
+
+ ug_genlist_data_t* gdata = (ug_genlist_data_t*) data;
+ assertm_if(NULL == gdata->device_info->ssid, "NULL!!");
+
+ DEBUG_LOG(UG_NAME_NORMAL, "del target ssid:[%s]", gdata->device_info->ssid);
+
+ g_free(gdata->device_info->ap_image_path);
+ g_free(gdata->device_info->ap_status_txt);
+ g_free(gdata->device_info->ssid);
+ wifi_ap_destroy(gdata->device_info->ap);
+ g_free(gdata->device_info);
+ g_free(gdata);
+
+ return;
+}
+
+static char* _gl_text_title_get(void *data, Evas_Object *obj, const char *part)
+{
+ assertm_if(NULL == obj, "NULL!!");
+ assertm_if(NULL == part, "NULL!!");
+
+ return (char*) g_strdup(sc(PACKAGE, I18N_TYPE_WiFi_network));
+}
+
+static Evas_Object *_gl_content_title_get(void *data, Evas_Object *obj, const char *part)
+{
+ __COMMON_FUNC_ENTER__;
+ Evas_Object *title_progressbar = NULL;
+ if (HEADER_MODE_SEARCHING == viewer_manager_header_mode_get()) {
+ if (!strcmp(part, "elm.icon")) {
+ title_progressbar = elm_progressbar_add(obj);
+ elm_object_style_set(title_progressbar, "list_process_small");
+ elm_progressbar_horizontal_set(title_progressbar, EINA_TRUE);
+ elm_progressbar_pulse(title_progressbar, EINA_TRUE);
+ }
+ }
+ __COMMON_FUNC_EXIT__;
+ return title_progressbar;
+}
+
+
+Elm_Object_Item* viewer_list_get_first_item(void)
+{
+ return first_item;
+}
+
+static Elm_Object_Item* viewer_list_get_last_item(void)
+{
+ return last_item;
+}
+
+static void _gl_realized(void *data, Evas_Object *obj, void *event_info)
+{
+ HEADER_MODES header_mode = viewer_manager_header_mode_get();
+
+ if (header_mode == HEADER_MODE_ACTIVATING ||
+ header_mode == HEADER_MODE_DEACTIVATING ||
+ header_mode == HEADER_MODE_OFF)
+ return ;
+
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ int index = (int)elm_genlist_item_index_get(item);
+ int first_item_index = (int)elm_genlist_item_index_get(viewer_list_get_first_item());
+ int last_item_index = (int)elm_genlist_item_index_get(viewer_list_get_last_item());
+
+ if (last_item_index == FIRST_ITEM_NUMBER)
+ return ;
+
+ if (first_item_index == -1) {
+ int group_index = (int)elm_genlist_item_index_get(grouptitle);
+ first_item_index = group_index+1;
+ }
+
+ if (first_item_index <= index) {
+ if(index == first_item_index)
+ elm_object_item_signal_emit(item, "elm,state,top", "");
+ else if (index == last_item_index)
+ elm_object_item_signal_emit(item, "elm,state,bottom", "");
+ else
+ elm_object_item_signal_emit(item, "elm,state,center", "");
+ }
+
+ elm_genlist_item_update(item);
+
+ return;
+}
+
+static void _popup_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!ug_app_state->passpopup) {
+ return;
+ }
+
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ __COMMON_FUNC_EXIT__;
+}
+
+static void _popup_ok_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!ug_app_state->passpopup) {
+ return;
+ }
+
+ wifi_security_type_e sec_mode = 0;
+ wifi_ap_h ap = common_pswd_popup_get_ap(ug_app_state->passpopup);
+ int ret = WLAN_MANAGER_ERR_NONE;
+ int nLen = 0;
+ const char* szPassword = common_pswd_popup_get_txt(ug_app_state->passpopup);
+ nLen = strlen(szPassword);
+ INFO_LOG(UG_NAME_NORMAL, "password = [%s]", szPassword);
+
+ wifi_ap_get_security_type(ap, &sec_mode);
+ switch (sec_mode) {
+ case WIFI_SECURITY_TYPE_WEP:
+
+ if (nLen != 5 && nLen != 13 && nLen != 26 && nLen != 10) {
+ winset_popup_mode_set(ug_app_state->popup_manager, POPUP_OPTION_WEP_PSWD_LEN_ERROR, NULL);
+ goto popup_ok_cb_exit;
+ }
+ break;
+
+ case WIFI_SECURITY_TYPE_WPA_PSK:
+ case WIFI_SECURITY_TYPE_WPA2_PSK:
+
+ if (nLen < 8 || nLen > 63) {
+ winset_popup_mode_set(ug_app_state->popup_manager, POPUP_OPTION_WPA_PSWD_LEN_ERROR, NULL);
+ goto popup_ok_cb_exit;
+ }
+ break;
+
+ default:
+ ERROR_LOG(UG_NAME_SCAN, "Fatal: Wrong security mode : %d", sec_mode);
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ goto popup_ok_cb_exit;
+ }
+
+ INFO_LOG(UG_NAME_SCAN, "connect with password comp");
+ ret = wlan_manager_connect_with_password(ap, szPassword);
+ if (WLAN_MANAGER_ERR_NONE == ret) {
+ viewer_manager_header_mode_set(HEADER_MODE_CONNECTING);
+ } else {
+ ERROR_LOG(UG_NAME_SCAN, "wlan error %d", ret);
+ viewer_manager_header_mode_set(HEADER_MODE_ON);
+ }
+
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+
+
+popup_ok_cb_exit:
+ g_free((gpointer)szPassword);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void _wps_pbc_popup_cancel_connecting(void* data, Evas_Object* obj, void* event_info)
+{
+ if (!ug_app_state->passpopup) {
+ return;
+ }
+
+ wifi_ap_h ap = common_pswd_popup_get_ap(ug_app_state->passpopup);;
+ int ret = wlan_manager_request_disconnection(ap);
+ if (ret == WLAN_MANAGER_ERR_NONE) {
+ INFO_LOG(UG_NAME_NORMAL, "WPS conection cancelled successfully for AP[0x%x]", ap);
+ } else {
+ ERROR_LOG(UG_NAME_NORMAL, "Error!!! wlan_manager_request_disconnection failed for AP[0x%x]", ap);
+ }
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ viewer_manager_header_mode_set(HEADER_MODE_ON);
+ return;
+}
+
+static void _wps_btn_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!ug_app_state->passpopup) {
+ return;
+ }
+
+ wifi_ap_h ap = common_pswd_popup_get_ap(ug_app_state->passpopup);
+ int ret = wlan_manager_request_wps_connection(ap);
+ if (ret == WLAN_MANAGER_ERR_NONE) {
+ viewer_manager_header_mode_set(HEADER_MODE_CONNECTING);
+ common_pswd_popup_pbc_popup_create(ug_app_state->passpopup, _wps_pbc_popup_cancel_connecting, NULL);
+ } else {
+ ERROR_LOG(UG_NAME_NORMAL, "Error!!! wlan_manager_request_wps_connection failed");
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ }
+ __COMMON_FUNC_EXIT__;
+}
+
+#if 0
+static gint __viewer_list_compare_mode(gconstpointer a, gconstpointer b)
+{
+ Elm_Object_Item *item = (Elm_Object_Item *)a;
+ if (item) {
+ ug_genlist_data_t* gdata = elm_object_item_data_get(item);
+ if (gdata) {
+ VIEWER_ITEM_RADIO_MODES mode = (VIEWER_ITEM_RADIO_MODES)b;
+ if (gdata->radio_mode == mode)
+ return 0;
+ }
+ }
+ return -1;
+}
+
+static Elm_Object_Item *__wifi_viewer_list_get_item_in_mode(VIEWER_ITEM_RADIO_MODES mode)
+{
+ Elm_Object_Item *item = NULL;
+ GSList *found = g_slist_find_custom(container, (gconstpointer)mode, __viewer_list_compare_mode);
+ if (found) {
+ INFO_LOG(UG_NAME_NORMAL, "item found in mode [%d]", mode);
+ item = found->data;
+ }
+ return item;
+}
+#endif
+
+static void __wifi_viewer_list_request_connection(wifi_device_info_t *device_info)
+{
+ if (!device_info)
+ return;
+
+ pswd_popup_create_req_data_t popup_info;
+ Evas_Object* navi_frame = NULL;
+ int ret = wlan_manager_request_connection(device_info->ap);;
+ switch (ret) {
+ case WLAN_MANAGER_ERR_NONE:
+ INFO_LOG(UG_NAME_NORMAL, "ERROR_NONE");
+ viewer_manager_header_mode_set(HEADER_MODE_CONNECTING);
+ break;
+ case WLAN_MANAGER_ERR_CONNECT_PASSWORD_NEEDED:
+ memset(&popup_info, 0, sizeof(pswd_popup_create_req_data_t));
+ popup_info.title = device_info->ssid;
+ popup_info.ok_cb = _popup_ok_cb;
+ popup_info.cancel_cb = _popup_cancel_cb;
+ popup_info.show_wps_btn = device_info->wps_mode;
+ popup_info.wps_btn_cb = _wps_btn_cb;
+ popup_info.ap = device_info->ap;
+ popup_info.cb_data = NULL;
+ INFO_LOG(UG_NAME_NORMAL, "Going to create a popup. ug_app_state = 0x%x", ug_app_state);
+ ug_app_state->passpopup = common_pswd_popup_create(ug_app_state->layout_main, PACKAGE, &popup_info);
+ INFO_LOG(UG_NAME_NORMAL, "After create a popup");
+ if (ug_app_state->passpopup == NULL) {
+ INFO_LOG(UG_NAME_ERR, "pass popup create failed !");
+ }
+ break;
+
+ case WLAN_MANAGER_ERR_CONNECT_EAP_SEC_TYPE:
+ navi_frame = viewer_manager_get_naviframe();
+ ug_app_state->eap_view = create_eap_connect_view(ug_app_state->layout_main, navi_frame, PACKAGE, device_info);
+ break;
+
+ default:
+ ERROR_LOG(UG_NAME_NORMAL, "errro code [%d]", ret);
+ break;
+ }
+}
+
+static void viewer_list_item_clicked_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ assertm_if(NULL == event_info, "event_info is NULL!!");
+ assertm_if(NULL == data, "data is NULL!!");
+ assertm_if(NULL == obj, "obj is NULL!!");
+
+ int ret = WLAN_MANAGER_ERR_UNKNOWN;
+ Elm_Object_Item *it = (Elm_Object_Item *)event_info;
+// Elm_Object_Item *connecting_item = NULL;
+ ug_genlist_data_t *gdata = (ug_genlist_data_t *)elm_object_item_data_get(it);
+ wifi_device_info_t *device_info = (wifi_device_info_t *)data;
+
+ if (!gdata || !device_info || !device_info->ssid) {
+ ERROR_LOG(UG_NAME_NORMAL, "Error!!! Invalid inout params");
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ int item_state = gdata->radio_mode;
+ int current_state = 0;
+
+ INFO_LOG(UG_NAME_NORMAL, "ssid --- %s", device_info->ssid);
+ INFO_LOG(UG_NAME_NORMAL, "ap --- 0x%x", device_info->ap);
+ INFO_LOG(UG_NAME_NORMAL, "current item_state state is --- %d\n", item_state);
+
+ switch (item_state) {
+ case VIEWER_ITEM_RADIO_MODE_OFF:
+ current_state = viewer_manager_header_mode_get();
+
+ INFO_LOG(UG_NAME_NORMAL, "Clicked AP`s information\n");
+ INFO_LOG(UG_NAME_NORMAL, "header mode [%d]", current_state);
+
+ switch (current_state) {
+ case HEADER_MODE_CONNECTED:
+ case HEADER_MODE_ON:
+ __wifi_viewer_list_request_connection(device_info);
+ break;
+
+ case HEADER_MODE_CONNECTING:
+#if 0 // Enable this later when two connect requests is supported by libnet.
+ /* Try connecting to the selected AP */
+ connecting_item = __wifi_viewer_list_get_item_in_mode(VIEWER_ITEM_RADIO_MODE_CONNECTING);
+ viewer_manager_header_mode_set(HEADER_MODE_ON);
+ wlan_manager_request_connection(device_info->ap);
+
+ /* Disconnect the connecting AP */
+ if (connecting_item) {
+ ug_genlist_data_t *connecting_gdata = elm_object_item_data_get(connecting_item);
+ if (connecting_gdata) {
+ wlan_manager_request_disconnection(connecting_gdata->device_info->ap);
+ }
+ }
+ break;
+#endif
+ case HEADER_MODE_OFF:
+ case HEADER_MODE_SEARCHING:
+ case HEADER_MODE_ACTIVATING:
+ case HEADER_MODE_DISCONNECTING:
+ case HEADER_MODE_DEACTIVATING:
+ default:
+ INFO_LOG(UG_NAME_NORMAL, "Ignore the item click");
+ break;
+ }
+ break;
+
+ case VIEWER_ITEM_RADIO_MODE_CONNECTED:
+ INFO_LOG(UG_NAME_NORMAL, "want to disconnect for connected item");
+ ret = wlan_manager_request_disconnection(device_info->ap);
+ if(ret == WLAN_MANAGER_ERR_NONE){
+ viewer_manager_header_mode_set(HEADER_MODE_DISCONNECTING);
+ }
+ break;
+
+ case VIEWER_ITEM_RADIO_MODE_CONNECTING:
+ INFO_LOG(UG_NAME_NORMAL, "want to cancel connecting for connected item");
+ ret = wlan_manager_request_disconnection(device_info->ap);
+ if(ret == WLAN_MANAGER_ERR_NONE){
+ viewer_manager_header_mode_set(HEADER_MODE_CANCEL_CONNECTING);
+ }
+ break;
+
+ default:
+ ret = WLAN_MANAGER_ERR_UNKNOWN;
+ break;
+ }
+
+ elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+static char *viewer_list_get_device_status_txt(wifi_device_info_t *wifi_device, VIEWER_ITEM_RADIO_MODES mode)
+{
+ char *status_txt = NULL;
+ char *ret_txt = NULL;
+ /* The strings are currently hard coded. It will be replaced with string ids later */
+ if (VIEWER_ITEM_RADIO_MODE_CONNECTING == mode || VIEWER_ITEM_RADIO_MODE_WPS_CONNECTING == mode) {
+ status_txt = g_strdup(sc(PACKAGE, I18N_TYPE_Connecting));
+ } else if (VIEWER_ITEM_RADIO_MODE_CONNECTED == mode) {
+ status_txt = g_strdup_printf("<color=%s><b>%s</b></color>", LIST_ITEM_CONNECTED_AP_FONT_COLOR, sc(PACKAGE, I18N_TYPE_Connected));
+ } else if (VIEWER_ITEM_RADIO_MODE_DISCONNECTING == mode) {
+ status_txt = g_strdup(sc(PACKAGE, I18N_TYPE_Disconnecting));
+ } else if (VIEWER_ITEM_RADIO_MODE_OFF == mode) {
+ status_txt = common_utils_get_ap_security_type_info_txt(PACKAGE, wifi_device);
+ } else {
+ status_txt = g_strdup(WIFI_UNKNOWN_DEVICE_STATUS_STR);
+ INFO_LOG(UG_NAME_NORMAL, "Invalid mode: %d", mode);
+ }
+ ret_txt = g_strdup_printf("%s", status_txt);
+ g_free(status_txt);
+ return ret_txt;
+}
+
+Evas_Object* viewer_list_create(Evas_Object *win)
+{
+ __COMMON_FUNC_ENTER__;
+
+ assertm_if(NULL == win, "NULL!!");
+
+ assertm_if(NULL != viewer_list, "Err!!");
+ viewer_list = elm_genlist_add(win);
+
+
+ elm_object_style_set(viewer_list, "dialogue");
+ assertm_if(NULL == viewer_list, "NULL!!");
+
+ elm_genlist_mode_set(viewer_list, ELM_LIST_LIMIT);
+
+ evas_object_size_hint_weight_set(viewer_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(viewer_list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ itc.item_style = "dialogue/2text.2icon.3.tb";
+ itc.func.text_get = _gl_listview_text_get;
+ itc.func.content_get = _gl_listview_content_get;
+ itc.func.state_get = NULL;
+ itc.func.del = _gl_listview_del;
+
+ first_item = last_item = NULL;
+
+ evas_object_smart_callback_add(viewer_list, "realized", _gl_realized, NULL);
+ __COMMON_FUNC_EXIT__;
+ return viewer_list;
+}
+
+int viewer_list_destroy(void)
+{
+ __COMMON_FUNC_ENTER__;
+
+ assertm_if(NULL == viewer_list, "NULL!!");
+ viewer_list_item_clear();
+ evas_object_del(viewer_list);
+ viewer_list = NULL;
+
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+}
+
+void viewer_list_title_item_del()
+{
+ if (grouptitle) {
+ elm_object_item_del(grouptitle);
+ grouptitle = NULL;
+ }
+}
+
+void viewer_list_title_item_update()
+{
+ elm_genlist_item_update(grouptitle);
+}
+
+int viewer_list_title_item_set(void)
+{
+ if (viewer_list_item_size_get() == 0 && !grouptitle) {
+ // To use multiline textblock/entry/editfield in genlist, set height_for_width mode
+ // then the item's height is calculated while the item's width fits to genlist width.
+ elm_genlist_mode_set(viewer_list, ELM_LIST_COMPRESS);
+
+ grouptitle_itc.item_style = "dialogue/title";
+ grouptitle_itc.func.text_get = _gl_text_title_get;
+ grouptitle_itc.func.content_get = _gl_content_title_get;
+ grouptitle_itc.func.state_get = NULL;
+ grouptitle_itc.func.del = NULL;
+
+ assertm_if(NULL != grouptitle, "Err!!");
+
+ grouptitle = elm_genlist_item_append(viewer_list,
+ &grouptitle_itc,
+ NULL,
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ NULL,
+ NULL);
+
+ assertm_if(NULL == grouptitle, "NULL!!");
+
+ elm_genlist_item_select_mode_set(grouptitle, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+int viewer_list_item_radio_mode_set(Elm_Object_Item* item, VIEWER_ITEM_RADIO_MODES mode)
+{
+ __COMMON_FUNC_ENTER__;
+ if (NULL == item) {
+ INFO_LOG(COMMON_NAME_ERR, "item is NULL");
+ return FALSE;
+ }
+
+ ug_genlist_data_t* gdata = (ug_genlist_data_t *) elm_object_item_data_get(item);
+ if (NULL == gdata || NULL == gdata->device_info) {
+ INFO_LOG(COMMON_NAME_ERR, "gdata or device_info is NULL");
+ return FALSE;
+ }
+
+ if (gdata->radio_mode == mode) {
+ INFO_LOG(UG_NAME_NORMAL, "[%s] is already in requested state", gdata->device_info->ssid);
+ return FALSE;
+ }
+
+ INFO_LOG(UG_NAME_NORMAL, "[%s] AP Item State Transition from [%d] --> [%d]", gdata->device_info->ssid, gdata->radio_mode, mode);
+ gdata->radio_mode = mode;
+ if (gdata->device_info->ap_status_txt) {
+ g_free(gdata->device_info->ap_status_txt);
+ gdata->device_info->ap_status_txt = viewer_list_get_device_status_txt(gdata->device_info, mode);
+ }
+
+ elm_genlist_item_update(item);
+
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+}
+
+Elm_Object_Item* viewer_list_item_insert_after(wifi_ap_h ap, Elm_Object_Item *after)
+{
+ Elm_Object_Item* ret = NULL;
+ wifi_security_type_e sec_type;
+
+ if (!viewer_list) {
+ assertm_if(NULL == viewer_list, "NULL!!");
+ return NULL;
+ }
+
+ wifi_device_info_t *wifi_device = NULL;
+
+ if (!ap) {
+ wifi_device = wlan_manager_profile_device_info_blank_create();
+ if (!wifi_device)
+ return NULL;
+ } else {
+ wifi_device = g_new0(wifi_device_info_t, 1);
+ if (WIFI_ERROR_NONE != wifi_ap_clone(&(wifi_device->ap), ap)) {
+ goto FREE_DEVICE_INFO;
+ } else if (WIFI_ERROR_NONE != wifi_ap_get_essid(ap, &(wifi_device->ssid))) {
+ goto FREE_DEVICE_INFO;
+ } else if (WIFI_ERROR_NONE != wifi_ap_get_rssi(ap, &(wifi_device->rssi))) {
+ goto FREE_DEVICE_INFO;
+ } else if (WIFI_ERROR_NONE != wifi_ap_get_security_type (ap, &sec_type)) {
+ goto FREE_DEVICE_INFO;
+ } else if (WIFI_ERROR_NONE != wifi_ap_is_wps_supported (ap, &(wifi_device->wps_mode))) {
+ goto FREE_DEVICE_INFO;
+ }
+ wifi_device->security_mode = common_utils_get_sec_mode(sec_type);
+ wifi_device->ap_image_path = common_utils_get_device_icon(WIFI_APP_IMAGE_DIR, wifi_device);
+ wifi_device->ap_status_txt = viewer_list_get_device_status_txt(wifi_device, VIEWER_ITEM_RADIO_MODE_OFF);
+ }
+ ug_genlist_data_t* gdata = g_new0(ug_genlist_data_t, 1);
+ gdata->device_info = wifi_device;
+ gdata->radio_mode = VIEWER_ITEM_RADIO_MODE_OFF;
+
+ if (!after) { /* If the after item is NULL then insert it as first item */
+ after = grouptitle;
+ }
+
+ ret = elm_genlist_item_insert_after(
+ viewer_list, /*obj*/
+ &itc,/*itc*/
+ gdata,/*data*/
+ NULL,/*parent*/
+ after, /*after than*/
+ ELM_GENLIST_ITEM_NONE, /*flags*/
+ viewer_list_item_clicked_cb,/*func*/
+ wifi_device);/*func_data*/
+
+ if (!ret) {
+ assertm_if(NULL == ret, "NULL!!");
+ g_free(gdata);
+ } else {
+ DEBUG_LOG(UG_NAME_NORMAL,
+ "* item add complete item [0x%x] ssid:[%s] security[%d] size:[%d]",
+ ret,
+ wifi_device->ssid,
+ wifi_device->security_mode,
+ viewer_list_item_size_get());
+
+ if (after == grouptitle) {
+ first_item = ret;
+ if (!last_item)
+ last_item = ret;
+ } else {
+ last_item = ret;
+ if (!first_item)
+ first_item = ret;
+ }
+
+ elm_genlist_item_update(ret);
+ }
+
+FREE_DEVICE_INFO:
+ if (!ret && wifi_device) {
+ wifi_ap_destroy(wifi_device->ap);
+ g_free(wifi_device->ap_image_path);
+ g_free(wifi_device->ap_status_txt);
+ g_free(wifi_device->ssid);
+ g_free(wifi_device);
+ }
+
+ return ret;
+}
+
+void viewer_list_item_del(Elm_Object_Item *it)
+{
+ if (it == NULL)
+ return;
+
+ if (it == first_item) {
+ first_item = elm_genlist_item_next_get(first_item);
+ } else if (it == last_item) {
+ last_item = elm_genlist_item_prev_get(last_item);
+ }
+ elm_object_item_del(it);
+}
+
+int viewer_list_item_size_get()
+{
+ __COMMON_FUNC_ENTER__;
+ int ret = 0;
+ Elm_Object_Item *it = first_item;
+
+ while(it) {
+ ret++;
+ if (it == last_item)
+ break;
+ it = elm_genlist_item_next_get(it);
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return ret;
+}
+
+void viewer_list_item_clear(void)
+{
+ __COMMON_FUNC_ENTER__;
+
+ Elm_Object_Item *it = first_item;
+ Elm_Object_Item *nxt = NULL;
+
+ while(it) {
+ nxt = elm_genlist_item_next_get(it);
+ elm_object_item_del(it);
+ if (it == last_item)
+ break;
+ it = nxt;
+ }
+
+ first_item = last_item = NULL;
+
+ __COMMON_FUNC_EXIT__;
+}
+
+void viewer_list_item_enable_all(void)
+{
+ __COMMON_FUNC_ENTER__;
+
+ Elm_Object_Item *it = first_item;
+
+ while(it) {
+ elm_object_item_disabled_set(it, EINA_FALSE);
+ if (it == last_item)
+ break;
+ it = elm_genlist_item_next_get(it);
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+void viewer_list_item_disable_all(void)
+{
+ __COMMON_FUNC_ENTER__;
+
+ Elm_Object_Item *it = first_item;
+
+ while(it) {
+ elm_object_item_disabled_set(it, EINA_TRUE);
+ if (it == last_item)
+ break;
+ it = elm_genlist_item_next_get(it);
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+Elm_Object_Item* item_get_for_ap(wifi_ap_h ap)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!ap) {
+ __COMMON_FUNC_EXIT__;
+ return NULL;
+ }
+
+ char *essid = NULL;
+ wifi_security_type_e type = WIFI_SECURITY_TYPE_NONE;
+
+ if (WIFI_ERROR_NONE != wifi_ap_get_essid(ap, &essid)) {
+ __COMMON_FUNC_EXIT__;
+ return NULL;
+ } else if (WIFI_ERROR_NONE != wifi_ap_get_security_type(ap, &type)) {
+ __COMMON_FUNC_EXIT__;
+ return NULL;
+ }
+
+ Elm_Object_Item *it = first_item;
+ wlan_security_mode_type_t sec_mode = common_utils_get_sec_mode(type);
+ while(it) {
+ ug_genlist_data_t* gdata = elm_object_item_data_get(it);
+ wifi_device_info_t *device_info = NULL;
+ if (gdata && (device_info = gdata->device_info)) {
+ if (!g_strcmp0(device_info->ssid, essid) && device_info->security_mode == sec_mode)
+ break;
+ }
+ if (it == last_item) {
+ it = NULL;
+ break;
+ }
+ it = elm_genlist_item_next_get(it);
+ }
+
+ g_free(essid);
+ __COMMON_FUNC_EXIT__;
+ return it;
+}
diff --git a/sources/ui-gadget/wifi-efl-UG.c b/sources/ui-gadget/wifi-efl-UG.c
new file mode 100644
index 0000000..6b5e091
--- /dev/null
+++ b/sources/ui-gadget/wifi-efl-UG.c
@@ -0,0 +1,431 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef UG_MODULE_API
+#define UG_MODULE_API __attribute__ ((visibility("default")))
+#endif
+
+#include <vconf-keys.h>
+
+#include "ug_wifi.h"
+#include "view_detail.h"
+#include "i18nmanager.h"
+#include "wlan_manager.h"
+#include "winset_popup.h"
+#include "common_utils.h"
+#include "motion_control.h"
+#include "viewer_manager.h"
+#include "view_ime_hidden.h"
+#include "wifi-engine-callback.h"
+
+static int wifi_exit_end = FALSE;
+
+wifi_appdata *ug_app_state = NULL;
+
+struct ug_data
+{
+ Evas_Object *base;
+ ui_gadget_h ug;
+};
+
+static Eina_Bool __wifi_efl_ug_del_found_ap_noti(void *data)
+{
+ common_utils_send_message_to_net_popup(NULL, NULL, "del_found_ap_noti", NULL);
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv)
+{
+ Ecore_Idler *idler;
+
+ __COMMON_FUNC_ENTER__;
+
+ if (!ug || !priv) {
+ INFO_LOG(UG_NAME_ERR, "[Error]Data is NULL - ug or priv");
+ return NULL;
+ }
+
+ ug_app_state = g_new0(wifi_appdata, 1);
+ assertm_if(NULL == ug_app_state, "Err!! ug_app_state == NULL");
+
+ struct ug_data *ugd;
+ ugd = (struct ug_data*)priv;
+ ugd->ug = ug;
+
+ if (NULL != service) {
+ INFO_LOG(UG_NAME_NORMAL, "message load from caller");
+
+ char *caller = NULL;
+ if (service_get_extra_data(service, UG_CALLER, &caller)) {
+ ERROR_LOG(UG_NAME_NORMAL, "Failed to get service extra data");
+ return NULL;
+ }
+
+ if (caller != NULL) {
+ INFO_LOG(UG_NAME_NORMAL, "caller = [%s]", caller);
+ if (strcmp(caller, "pwlock") == 0) {
+ ug_app_state->ug_type = UG_VIEW_SETUP_WIZARD;
+ service_get_extra_data(service, "lbutton", &ug_app_state->lbutton_setup_wizard_prev);
+ service_get_extra_data(service, "rbutton_skip", &ug_app_state->rbutton_setup_wizard_skip);
+ service_get_extra_data(service, "rbutton_next", &ug_app_state->rbutton_setup_wizard_next);
+ } else {
+ ug_app_state->ug_type = UG_VIEW_DEFAULT;
+ }
+
+ free(caller);
+ } else {
+ INFO_LOG(UG_NAME_NORMAL, "caller is not defined");
+ ug_app_state->ug_type = UG_VIEW_DEFAULT;
+ }
+ } else {
+ INFO_LOG(UG_NAME_NORMAL, "caller is not defined");
+ ug_app_state->ug_type = UG_VIEW_DEFAULT;
+ }
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+
+ Evas_Object *parent_layout = ug_get_parent_layout(ug);
+ if (parent_layout == NULL) {
+ ERROR_LOG(UG_NAME_NORMAL, "Failed to get parent layout");
+ return NULL;
+ }
+
+ ug_app_state->gadget= ugd;
+ ug_app_state->ug = ug;
+
+ common_util_set_system_registry(VCONFKEY_WIFI_UG_RUN_STATE,
+ VCONFKEY_WIFI_UG_RUN_STATE_ON_FOREGROUND);
+
+ /* Remove the "WiFi networks found" from the notification tray.*/
+ idler = ecore_idler_add(__wifi_efl_ug_del_found_ap_noti, NULL);
+
+ evas_object_show(parent_layout);
+
+ memset(&g_pending_call, 0, sizeof(wifi_pending_call_info_t));
+
+ Evas_Object *layout_main = viewer_manager_create(parent_layout);
+ if (layout_main == NULL) {
+ if( idler != NULL )
+ ecore_idler_del(idler);
+ INFO_LOG(UG_NAME_ERR, "Failed to create viewer_manager");
+ return NULL;
+ }
+
+ ug_app_state->popup_manager = winset_popup_manager_create(layout_main, PACKAGE);
+
+ ugd->base = layout_main;
+ ug_app_state->layout_main = layout_main;
+ ug_app_state->bAlive = EINA_TRUE;
+
+ wlan_manager_create();
+ wlan_manager_set_message_callback(wlan_engine_callback);
+ wlan_manager_set_refresh_callback(wlan_engine_refresh_callback);
+
+ switch (wlan_manager_start()) {
+ case WLAN_MANAGER_ERR_NONE:
+ break;
+
+ case WLAN_MANAGER_ERR_ALREADY_REGISTERED:
+ break;
+
+ case WLAN_MANAGER_ERR_UNKNOWN:
+ winset_popup_mode_set(ug_app_state->popup_manager, POPUP_OPTION_REGISTER_FAILED_COMMUNICATION_FAILED, NULL);
+
+ __COMMON_FUNC_EXIT__;
+ return ugd->base;
+
+ default:
+ __COMMON_FUNC_EXIT__;
+ return ugd->base;
+ }
+
+ switch (wlan_manager_state_get()) {
+ case WLAN_MANAGER_OFF:
+ viewer_manager_header_mode_set(HEADER_MODE_OFF);
+ viewer_manager_hide(VIEWER_WINSET_SUB_CONTENTS);
+ break;
+ case WLAN_MANAGER_CONNECTING:
+ case WLAN_MANAGER_UNCONNECTED:
+ case WLAN_MANAGER_CONNECTED:
+ connman_request_scan_mode_set(WIFI_BGSCAN_MODE_PERIODIC);
+ viewer_manager_header_mode_set(HEADER_MODE_SEARCHING);
+ viewer_manager_show(VIEWER_WINSET_SEARCHING);
+ viewer_manager_show(VIEWER_WINSET_SUB_CONTENTS);
+ break;
+ case WLAN_MANAGER_ERROR:
+ default:
+ return ugd->base;
+ }
+
+ motion_create(layout_main);
+
+ __COMMON_FUNC_EXIT__;
+ return ugd->base;
+}
+
+static Eina_Bool load_initial_ap_list(void *data)
+{
+ wlan_manager_scanned_profile_refresh_with_count((int)data);
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void on_start(ui_gadget_h ug, service_h service, void *priv)
+{
+ __COMMON_FUNC_ENTER__;
+ ecore_idler_add(load_initial_ap_list, (void *)8);
+
+ motion_start();
+
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+static void on_pause(ui_gadget_h ug, service_h service, void *priv)
+{
+ __COMMON_FUNC_ENTER__;
+
+ motion_stop();
+
+ connman_request_scan_mode_set(WIFI_BGSCAN_MODE_EXPONENTIAL);
+
+ common_util_set_system_registry(VCONFKEY_WIFI_UG_RUN_STATE,
+ VCONFKEY_WIFI_UG_RUN_STATE_ON_BACKGROUND);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void on_resume(ui_gadget_h ug, service_h service, void *priv)
+{
+ __COMMON_FUNC_ENTER__;
+
+ motion_start();
+
+ connman_request_scan_mode_set(WIFI_BGSCAN_MODE_PERIODIC);
+
+ common_util_set_system_registry(VCONFKEY_WIFI_UG_RUN_STATE,
+ VCONFKEY_WIFI_UG_RUN_STATE_ON_FOREGROUND);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void on_destroy(ui_gadget_h ug, service_h service, void *priv)
+{
+ __COMMON_FUNC_ENTER__;
+
+ common_util_set_system_registry(VCONFKEY_WIFI_UG_RUN_STATE,
+ VCONFKEY_WIFI_UG_RUN_STATE_OFF);
+
+ if (!ug || !priv){
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ motion_destroy();
+
+ connman_request_scan_mode_set(WIFI_BGSCAN_MODE_EXPONENTIAL);
+
+ DEBUG_LOG(UG_NAME_NORMAL, "* popup manager destroying...");
+ winset_popup_manager_destroy(ug_app_state->popup_manager);
+ ug_app_state->popup_manager = NULL;
+ DEBUG_LOG(UG_NAME_NORMAL, "* view_main destroying...");
+ viewer_manager_destroy();
+ DEBUG_LOG(UG_NAME_NORMAL, "* manager destroy complete");
+ DEBUG_LOG(UG_NAME_NORMAL, "* wlan manager destroying...");
+ wlan_manager_destroy();
+
+ if(g_pending_call.is_handled == FALSE)
+ {
+ dbus_g_proxy_cancel_call(g_pending_call.proxy, g_pending_call.pending_call);
+ g_pending_call.is_handled = TRUE;
+ memset(&g_pending_call, 0, sizeof(wifi_pending_call_info_t));
+ DEBUG_LOG(UG_NAME_NORMAL, "* pending dbus call cleared");
+ }
+
+ struct ug_data* ugd = priv;
+ if(ugd->base){
+ evas_object_del(ugd->base);
+ ugd->base = NULL;
+ }
+}
+
+static void on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
+{
+}
+
+static void on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
+{
+ switch (event) {
+ case UG_EVENT_LOW_MEMORY:
+ break;
+ case UG_EVENT_LOW_BATTERY:
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT:
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ break;
+ default:
+ break;
+ }
+}
+
+static void on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h service, void *priv)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (!ug) {
+ return;
+ }
+
+ switch (event) {
+ case UG_KEY_EVENT_END:
+ INFO_LOG(UG_NAME_NORMAL, "UG_KEY_EVENT_END");
+
+ /* popup key event determine */
+ winset_popup_hide_popup(ug_app_state->popup_manager);
+
+ Evas_Object* navi_frame = viewer_manager_get_naviframe();
+ view_manager_view_type_t top_view_id = (view_manager_view_type_t)evas_object_data_get(navi_frame, SCREEN_TYPE_ID_KEY);
+ if(VIEW_MANAGER_VIEW_TYPE_MAIN == top_view_id) {
+ INFO_LOG(UG_NAME_NORMAL, "same");
+ } else {
+ INFO_LOG(UG_NAME_NORMAL, "differ");
+ elm_naviframe_item_pop(viewer_manager_get_naviframe());
+ return;
+ }
+
+ wifi_exit();
+ break;
+ default:
+ INFO_LOG(UG_NAME_NORMAL, "UG_KEY_EVENT [%d]", event);
+ break;
+ }
+ __COMMON_FUNC_EXIT__;
+}
+
+UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ __COMMON_FUNC_ENTER__;
+
+ wifi_exit_end = FALSE;
+
+ assertm_if(NULL == ops, "Err!! ug_module_ops == NULL");
+
+ struct ug_data *ugd;
+ ugd = calloc(1, sizeof(struct ug_data));
+
+ assertm_if(NULL == ugd, "Err!! calloc fail");
+
+ ops->create = on_create;
+ ops->start = on_start;
+ ops->pause = on_pause;
+ ops->resume = on_resume;
+ ops->destroy = on_destroy;
+ ops->message = on_message;
+ ops->event = on_event;
+ ops->key_event = on_key_event;
+ ops->priv = ugd;
+ ops->opt = UG_OPT_INDICATOR_ENABLE;
+
+ __COMMON_FUNC_EXIT__;
+ return 0;
+}
+
+UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
+{
+ __COMMON_FUNC_ENTER__;
+ assertm_if(NULL == ops, "Err!! ug_module_ops == NULL");
+
+ struct ug_data *ugd;
+
+ ugd = ops->priv;
+
+ if (ugd)
+ free(ugd);
+ __COMMON_FUNC_EXIT__;
+}
+
+static bool setting_plugin_wifi_found_ap_cb(wifi_ap_h ap, void* user_data)
+{
+ bool favourite = false;
+
+ wifi_ap_is_favorite(ap, &favourite);
+
+ if (true == favourite)
+ wlan_manager_forget(ap);
+
+ return true;
+}
+
+UG_MODULE_API int setting_plugin_reset(bundle *data, void *priv)
+{
+ __COMMON_FUNC_ENTER__;
+
+ int return_value = 0;
+
+ return_value = wlan_manager_start();
+ if (return_value != WLAN_MANAGER_ERR_NONE) {
+ ERROR_LOG(UG_NAME_NORMAL, "Failed to register : %d",return_value);
+ return_value = -1;
+ goto error;
+ }
+
+ wifi_foreach_found_aps(setting_plugin_wifi_found_ap_cb, NULL);
+ return_value = wlan_manager_request_power_off();
+ if (return_value != WLAN_MANAGER_ERR_NONE) {
+ ERROR_LOG(UG_NAME_NORMAL, "Failed to power_off: %d",return_value);
+ return_value = -1;
+ goto error;
+ }
+
+ common_util_set_system_registry(VCONFKEY_WIFI_ENABLE_QS,
+ VCONFKEY_WIFI_QS_ENABLE);
+
+error:
+ wlan_manager_destroy();
+
+ __COMMON_FUNC_EXIT__;
+ return return_value;
+}
+
+int wifi_exit()
+{
+ __COMMON_FUNC_ENTER__;
+ if(wifi_exit_end == TRUE) {
+ __COMMON_FUNC_EXIT__;
+ return FALSE;
+ }
+ wifi_exit_end = TRUE;
+
+ struct ug_data *ugd;
+ ugd = ug_app_state->gadget;
+ ug_app_state->bAlive = EINA_FALSE;
+
+ DEBUG_LOG(UG_NAME_NORMAL, "* ug_destroying...");
+ ug_destroy_me(ugd->ug);
+
+ __COMMON_FUNC_EXIT__;
+
+ return TRUE;
+}
diff --git a/sources/ui-gadget/wifi-ui-list-callbacks.c b/sources/ui-gadget/wifi-ui-list-callbacks.c
new file mode 100644
index 0000000..b813406
--- /dev/null
+++ b/sources/ui-gadget/wifi-ui-list-callbacks.c
@@ -0,0 +1,312 @@
+/*
+* Wi-Fi UG
+*
+* Copyright 2012 Samsung Electronics Co., Ltd
+
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+
+* http://www.tizenopensource.org/license
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+
+
+#include "wifi.h"
+#include "wifi-ui-list-callbacks.h"
+#include "wlan_manager.h"
+#include "view_detail.h"
+#include "viewer_list.h"
+#include "common_pswd_popup.h"
+#include "common_eap_connect.h"
+#include "winset_popup.h"
+#include "i18nmanager.h"
+#include "common_datamodel.h"
+
+extern wifi_appdata *ug_app_state;
+
+static void _popup_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!ug_app_state->passpopup || !data) {
+ return;
+ }
+
+ char *profile_name = (char *)data;
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ g_free(profile_name);
+ __COMMON_FUNC_EXIT__;
+}
+
+static void _popup_ok_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!ug_app_state->passpopup || !data) {
+ return;
+ }
+
+ char *profile_name = (char *)data;
+ wlan_security_mode_type_t sec_mode;
+ view_datamodel_basic_info_t *basic_data_model = view_basic_detail_datamodel_create(profile_name);
+ if (!basic_data_model) {
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ g_free(profile_name);
+ return;
+ }
+ int ret = WLAN_MANAGER_ERR_NONE;
+ int nLen = 0;
+ const char* szPassword = common_pswd_popup_get_txt(ug_app_state->passpopup);
+ nLen = strlen(szPassword);
+ INFO_LOG(UG_NAME_NORMAL, "password = [%s]", szPassword);
+
+ sec_mode = view_detail_datamodel_sec_mode_get(basic_data_model);
+ switch (sec_mode) {
+ case WLAN_SEC_MODE_WEP:
+
+ if (nLen != 5 && nLen != 13 && nLen != 26 && nLen != 10) {
+ winset_popup_mode_set(ug_app_state->popup_manager, POPUP_OPTION_WEP_PSWD_LEN_ERROR, NULL);
+ goto popup_ok_cb_exit;
+ }
+
+ break;
+
+ case WLAN_SEC_MODE_WPA_PSK:
+ case WLAN_SEC_MODE_WPA2_PSK:
+
+ if (nLen < 8 || nLen > 63) {
+ winset_popup_mode_set(ug_app_state->popup_manager, POPUP_OPTION_WPA_PSWD_LEN_ERROR, NULL);
+ goto popup_ok_cb_exit;
+ }
+ break;
+
+ default:
+ ERROR_LOG(UG_NAME_SCAN, "Fatal: Wrong security mode : %d", sec_mode);
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ g_free(profile_name);
+ goto popup_ok_cb_exit;
+ }
+
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+
+ INFO_LOG(UG_NAME_SCAN, "connect with password comp");
+ wlan_manager_password_data param;
+ memset(&param, 0, sizeof(wlan_manager_password_data));
+ param.wlan_eap_type = WLAN_MANAGER_EAP_TYPE_NONE;
+ param.password = szPassword;
+ ret = wlan_manager_connect_with_password(profile_name, sec_mode, &param);
+ if (WLAN_MANAGER_ERR_NONE == ret) {
+ viewer_manager_header_mode_set(HEADER_MODE_CONNECTING);
+ } else {
+ ERROR_LOG(UG_NAME_SCAN, "wlan error %d", ret);
+ viewer_manager_header_mode_set(HEADER_MODE_ON);
+ }
+
+ g_free(profile_name);
+
+popup_ok_cb_exit:
+ g_free((gpointer)szPassword);
+ view_basic_detail_datamodel_destroy(basic_data_model);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void _wps_pbc_popup_cancel_connecting(void* data, Evas_Object* obj, void* event_info)
+{
+ if (!ug_app_state->passpopup || !data) {
+ return;
+ }
+
+ char *profile_name = (char *)data;
+ int ret = wlan_manager_request_cancel_wps_connection(profile_name);
+ if (ret == WLAN_MANAGER_ERR_NONE) {
+ INFO_LOG(UG_NAME_NORMAL, "WPS conection cancelled successfully for AP[%s]", profile_name);
+ } else {
+ ERROR_LOG(UG_NAME_NORMAL, "Error!!! wlan_manager_request_cancel_wps_connection failed for AP[%s]", profile_name);
+ }
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ viewer_manager_header_mode_set(HEADER_MODE_ON);
+ g_free(profile_name);
+ return;
+}
+
+static void _wps_btn_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!ug_app_state->passpopup || !data) {
+ return;
+ }
+
+ char *profile_name = (char *)data;
+ int ret = wlan_manager_request_wps_connection(profile_name);
+ if (ret == WLAN_MANAGER_ERR_NONE) {
+ viewer_manager_header_mode_set(HEADER_MODE_CONNECTING);
+ common_pswd_popup_pbc_popup_create(ug_app_state->passpopup, _wps_pbc_popup_cancel_connecting, profile_name);
+ } else {
+ ERROR_LOG(UG_NAME_NORMAL, "Error!!! wlan_manager_request_wps_connection failed");
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ g_free(profile_name);
+ }
+ __COMMON_FUNC_EXIT__;
+}
+
+void eap_view_close_cb(void)
+{
+ ug_app_state->eap_view = NULL;
+}
+
+void radio_button_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ int ret = WLAN_MANAGER_ERR_UNKNOWN;
+ Elm_Object_Item *it = (Elm_Object_Item *)event_info;
+ wifi_device_info_t *device_info = (wifi_device_info_t *)data;
+
+ if (!it || !device_info || device_info->ssid == NULL) {
+ ERROR_LOG(UG_NAME_NORMAL, "Error!!! Invalid inout params");
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ ug_genlist_data_t *gdata = (ug_genlist_data_t *) elm_object_item_data_get((Elm_Object_Item*)it);
+ if(NULL == gdata) {
+ ERROR_LOG(UG_NAME_NORMAL, "Error!!! list item data null");
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ int item_state = gdata->radio_mode;
+ int current_state = 0;
+
+ INFO_LOG(UG_NAME_NORMAL, "ssid --- %s", device_info->ssid);
+ INFO_LOG(UG_NAME_NORMAL, "current item_state state is --- %d\n", item_state);
+
+ switch (item_state) {
+ case VIEWER_ITEM_RADIO_MODE_OFF:
+ current_state = viewer_manager_header_mode_get();
+
+ INFO_LOG(UG_NAME_NORMAL, "Clicked AP`s information\n");
+ INFO_LOG(UG_NAME_NORMAL, "header mode [%d]", current_state);
+
+ switch (current_state) {
+ case HEADER_MODE_CONNECTED:
+ case HEADER_MODE_ON:
+ ret = wlan_manager_request_connection(device_info);
+ if (ret == WLAN_MANAGER_ERR_NONE) {
+ viewer_manager_header_mode_set(HEADER_MODE_CONNECTING);
+ }
+ break;
+
+ case HEADER_MODE_OFF:
+ case HEADER_MODE_SEARCHING:
+ case HEADER_MODE_ACTIVATING:
+ case HEADER_MODE_CONNECTING:
+ case HEADER_MODE_DISCONNECTING:
+ case HEADER_MODE_DEACTIVATING:
+ default:
+ INFO_LOG(UG_NAME_NORMAL, "Ignore the item click");
+ break;
+ }
+ break;
+
+ case VIEWER_ITEM_RADIO_MODE_CONNECTED:
+ INFO_LOG(UG_NAME_NORMAL, "want to disconnect for connected item");
+ ret = wlan_manager_request_disconnection(device_info);
+ if(ret == WLAN_MANAGER_ERR_NONE){
+ viewer_manager_header_mode_set(HEADER_MODE_DISCONNECTING);
+ }
+ break;
+
+ case VIEWER_ITEM_RADIO_MODE_CONNECTING:
+ INFO_LOG(UG_NAME_NORMAL, "want to cancel connecting for connected item");
+ ret = wlan_manager_request_cancel_connecting(device_info->profile_name);
+ if(ret == WLAN_MANAGER_ERR_NONE){
+ viewer_manager_header_mode_set(HEADER_MODE_CANCEL_CONNECTING);
+ }
+ break;
+
+ default:
+ ret = WLAN_MANAGER_ERR_UNKNOWN;
+ break;
+ }
+
+ switch (ret) {
+ case WLAN_MANAGER_ERR_NONE:
+ INFO_LOG(UG_NAME_NORMAL, "ERROR_NONE");
+ break;
+ case WLAN_MANAGER_ERR_CONNECT_PASSWORD_NEEDED:
+ {
+ pswd_popup_create_req_data_t popup_info;
+ popup_info.title = device_info->ssid;
+ popup_info.ok_cb = _popup_ok_cb;
+ popup_info.cancel_cb = _popup_cancel_cb;
+ popup_info.show_wps_btn = device_info->wps_mode;
+ popup_info.wps_btn_cb = _wps_btn_cb;
+ popup_info.cb_data = g_strdup(gdata->device_info->profile_name);
+ INFO_LOG(UG_NAME_NORMAL, "Going to create a popup. ug_app_state = 0x%x", ug_app_state);
+ ug_app_state->passpopup = common_pswd_popup_create(ug_app_state->win_main, PACKAGE, &popup_info);
+ INFO_LOG(UG_NAME_NORMAL, "After create a popup");
+ if (ug_app_state->passpopup == NULL) {
+ INFO_LOG(UG_NAME_ERR, "pass popup create failed !");
+ }
+ }
+ break;
+
+ case WLAN_MANAGER_ERR_CONNECT_EAP_SEC_TYPE:
+ {
+ Evas_Object* navi_frame = viewer_manager_get_naviframe();
+ if (navi_frame == NULL) {
+ ERROR_LOG(UG_NAME_NORMAL, "Failed : get naviframe");
+ return;
+ }
+ ug_app_state->eap_view = create_eap_connect(ug_app_state->win_main, navi_frame, PACKAGE, device_info, eap_view_close_cb);
+ }
+ break;
+
+ case WLAN_MANAGER_ERR_NOSERVICE:
+ break;
+
+ default:
+ ERROR_LOG(UG_NAME_NORMAL, "errro code [%d]", ret);
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+void list_select_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ INFO_LOG(UG_NAME_NORMAL,"=================\n");
+ INFO_LOG(UG_NAME_NORMAL," %s %d\n", __func__ ,__LINE__);
+ INFO_LOG(UG_NAME_NORMAL,"=================\n");
+
+ if (data == NULL) {
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ wifi_device_info_t *device_info = (wifi_device_info_t *)data;
+
+ DEBUG_LOG(UG_NAME_NORMAL, "ssid [%s]", device_info->ssid);
+
+ view_detail(device_info, ug_app_state->win_main);
+
+ __COMMON_FUNC_EXIT__;
+}
+
diff --git a/sources/ui-gadget/wifi-wlan-callbacks.c b/sources/ui-gadget/wifi-wlan-callbacks.c
new file mode 100644
index 0000000..e9b157c
--- /dev/null
+++ b/sources/ui-gadget/wifi-wlan-callbacks.c
@@ -0,0 +1,199 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "ug_wifi.h"
+#include "wlan_manager.h"
+#include "viewer_manager.h"
+#include "winset_popup.h"
+#include "wifi-engine-callback.h"
+#include "viewer_list.h"
+#include "motion_control.h"
+
+extern wifi_appdata *ug_app_state;
+
+void wlan_engine_callback(wlan_mgr_event_info_t *event_info, void *user_data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (event_info == NULL) {
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ Elm_Object_Item* target_item = NULL;
+ ug_genlist_data_t* gdata = NULL;
+
+ int header_state = -1;
+ header_state = viewer_manager_header_mode_get();
+
+ INFO_LOG(UG_NAME_NORMAL, "header state [%d]", header_state);
+ INFO_LOG(UG_NAME_NORMAL, "event type [%d]", event_info->event_type);
+ INFO_LOG(UG_NAME_NORMAL, "ap [0x%x]", event_info->ap);
+
+ if (event_info->ap) { /* Is it a response with AP handle? */
+
+ /* All responses with profile names should have an associated genlist item
+ * Verify if the genlist item exists and associated genlist item data exists
+ */
+ target_item = item_get_for_ap(event_info->ap);
+ if (!target_item ||
+ !(gdata = (ug_genlist_data_t *)elm_object_item_data_get(target_item))) {
+ /* This is a case where the profile name exists but no
+ * associated genlist item OR genlist item data exists.
+ * This condition can come when an AP action(Example connect)
+ * is triggered and by the time the response came the genlist is cleared.
+ */
+ ERROR_LOG(UG_NAME_RESP,"Error!!! Target item[0x%x] is NULL OR item data[0x%x] is NULL", target_item, gdata);
+ if (event_info->event_type == WLAN_MANAGER_RESPONSE_TYPE_CONNECTING ||
+ event_info->event_type == WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_OK) {
+ /* This situation comes during hidden AP connecting/connected event.
+ * Anyways its always better to add the connecting/connected AP */
+ target_item = viewer_list_item_insert_after(event_info->ap, NULL);
+ if (!target_item ||
+ !(gdata = (ug_genlist_data_t *)elm_object_item_data_get(target_item))) {
+ ERROR_LOG(UG_NAME_RESP, "Error!!! Fatal: Unable to add a connecting/connected item with item data[0x%x].", gdata);
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+ } else {
+ ERROR_LOG(UG_NAME_RESP, "Fatal: target_item or gdata is NULL");
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ }
+ }
+
+ /* All OK to process the response */
+ switch (event_info->event_type) {
+ case WLAN_MANAGER_RESPONSE_TYPE_POWER_ON_OK:
+ connman_request_scan_mode_set(WIFI_BGSCAN_MODE_PERIODIC);
+ viewer_manager_header_mode_set(HEADER_MODE_SEARCHING);
+ viewer_manager_show(VIEWER_WINSET_SEARCHING);
+ viewer_manager_show(VIEWER_WINSET_SUB_CONTENTS);
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_POWER_OFF_OK:
+ viewer_list_item_clear();
+ viewer_manager_header_mode_set(HEADER_MODE_OFF);
+ viewer_manager_hide(VIEWER_WINSET_SUB_CONTENTS);
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_POWER_ON_NOT_SUPPORTED:
+ viewer_manager_header_mode_set(HEADER_MODE_OFF);
+ common_utils_send_message_to_net_popup("Network connection popup", "not support", "notification", NULL);
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_POWER_ON_RESTRICTED:
+ viewer_manager_header_mode_set(HEADER_MODE_OFF);
+ common_utils_send_message_to_net_popup("Network connection popup", "wifi restricted", "popup", NULL);
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_SCAN_OK:
+ /* Manual scan complete response */
+ if (HEADER_MODE_DEACTIVATING == header_state ||
+ HEADER_MODE_OFF == header_state)
+ break;
+
+ viewer_manager_hidden_disable_set(FALSE);
+ viewer_manager_hide(VIEWER_WINSET_SEARCHING);
+ /* fall through */
+ case WLAN_MANAGER_RESPONSE_TYPE_SCAN_RESULT_IND:
+ /* Auto scan complete response */
+ wlan_manager_scanned_profile_refresh();
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_CONNECTING:
+ target_item = viewer_manager_move_item_to_top(target_item);
+ viewer_manager_update_ap_handle(target_item, event_info->ap);
+ viewer_manager_header_mode_set(HEADER_MODE_CONNECTING);
+ viewer_list_item_radio_mode_set(target_item, VIEWER_ITEM_RADIO_MODE_CONNECTING);
+ viewer_manager_scroll_to_top();
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_OK:
+ case WLAN_MANAGER_RESPONSE_TYPE_WPS_ENROLL_OK:
+ target_item = viewer_manager_move_item_to_top(target_item);
+ viewer_manager_update_ap_handle(target_item, event_info->ap);
+ viewer_list_item_radio_mode_set(target_item , VIEWER_ITEM_RADIO_MODE_CONNECTED);
+ viewer_manager_header_mode_set(HEADER_MODE_CONNECTED);
+ viewer_manager_scroll_to_top();
+
+ if (ug_app_state->passpopup) {
+ /* This is needed to remove the PBC timer popup */
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ }
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_CONNECT_FAILED:
+ case WLAN_MANAGER_RESPONSE_TYPE_WPS_ENROLL_FAIL:
+ viewer_manager_header_mode_set(HEADER_MODE_ON);
+ viewer_list_item_radio_mode_set(target_item , VIEWER_ITEM_RADIO_MODE_OFF);
+
+ if (ug_app_state->passpopup) {
+ common_pswd_popup_destroy(ug_app_state->passpopup);
+ ug_app_state->passpopup = NULL;
+ }
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_DISCONNECTION_OK:
+ viewer_manager_update_ap_handle(target_item, event_info->ap);
+ viewer_list_item_radio_mode_set(target_item, VIEWER_ITEM_RADIO_MODE_OFF);
+ viewer_manager_header_mode_set(HEADER_MODE_ON);
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_CANCEL_WPS_ENROLL_OK:
+ viewer_list_item_radio_mode_set(target_item, VIEWER_ITEM_RADIO_MODE_OFF);
+ viewer_manager_header_mode_set(HEADER_MODE_ON);
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_CANCEL_WPS_ENROLL_FAIL:
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_MAC_ID_IND:
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_SPECIFIC_SCAN_FAIL:
+ case WLAN_MANAGER_RESPONSE_TYPE_SPECIFIC_SCAN_OK:
+ viewer_manager_specific_scan_response_hlr(event_info->bss_info_list, user_data);
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_UPDATE_SIG_STR:
+ viewer_manager_update_connected_ap_sig_str();
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_INVALID_KEY:
+ winset_popup_mode_set(ug_app_state->popup_manager, POPUP_OPTION_WIFI_INVALID_KEY, NULL);
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_NONE:
+ default:
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+void wlan_engine_refresh_callback(void)
+{
+ __COMMON_FUNC_ENTER__;
+ viewer_manager_refresh();
+ __COMMON_FUNC_EXIT__;
+}
diff --git a/sources/ui-gadget/winset_popup.c b/sources/ui-gadget/winset_popup.c
new file mode 100644
index 0000000..7b5636f
--- /dev/null
+++ b/sources/ui-gadget/winset_popup.c
@@ -0,0 +1,346 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "common.h"
+#include "ug_wifi.h"
+#include "i18nmanager.h"
+#include "common_utils.h"
+#include "winset_popup.h"
+#include "wlan_manager.h"
+#include "viewer_manager.h"
+
+struct popup_manager_object {
+ /* General popup attributes */
+ Evas_Object* win;
+ Evas_Object* popup;
+ Evas_Object *popup_user_prompt;
+ char *str_pkg_name;
+};
+
+static void _mobilehotspot_disable_cb(DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ GError *err = NULL;
+ guint type;
+ guint result;
+ DBusGConnection *bus = user_data;
+
+ dbus_g_proxy_end_call(proxy, call, &err, G_TYPE_UINT, &type,
+ G_TYPE_UINT, &result, G_TYPE_INVALID);
+ if (err != NULL) {
+ INFO_LOG(COMMON_NAME_LIB, "Error occured [%s]\n", err->message);
+ g_error_free(err);
+ viewer_manager_header_mode_set(HEADER_MODE_OFF);
+ } else {
+ INFO_LOG(COMMON_NAME_LIB, "TYPE = %d, Result = %d\n", type, result);
+ if (3 == type && (0 == result || 5 == result)) {
+ INFO_LOG(COMMON_NAME_LIB, "OK\n");
+ /* Tethering is now disabled. All OK to switch on Wi-Fi */
+ power_control();
+ } else {
+ viewer_manager_header_mode_set(HEADER_MODE_OFF);
+ }
+ }
+
+ g_pending_call.is_handled = TRUE;
+
+ g_object_unref(proxy);
+ dbus_g_connection_unref(bus);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void _retry_clicked_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ popup_manager_object_t *manager_object = (popup_manager_object_t *)data;
+ if (manager_object == NULL)
+ return;
+
+ INFO_LOG(UG_NAME_NORMAL, "Response OK");
+
+ switch (wlan_manager_start()) {
+ case WLAN_MANAGER_ERR_NONE:
+ break;
+
+ case WLAN_MANAGER_ERR_ALREADY_REGISTERED:
+ break;
+
+ case WLAN_MANAGER_ERR_UNKNOWN:
+ winset_popup_mode_set(manager_object, POPUP_OPTION_REGISTER_FAILED_COMMUNICATION_FAILED, NULL);
+
+ __COMMON_FUNC_EXIT__;
+ return;
+
+ default:
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ switch (wlan_manager_state_get()) {
+ case WLAN_MANAGER_OFF:
+ viewer_manager_header_mode_set(HEADER_MODE_OFF);
+ viewer_manager_hide(VIEWER_WINSET_SUB_CONTENTS);
+ break;
+ case WLAN_MANAGER_UNCONNECTED:
+ case WLAN_MANAGER_CONNECTING:
+ case WLAN_MANAGER_CONNECTED:
+ connman_request_scan_mode_set(WIFI_BGSCAN_MODE_PERIODIC);
+ viewer_manager_header_mode_set(HEADER_MODE_SEARCHING);
+ viewer_manager_hide(VIEWER_WINSET_SEARCHING);
+ viewer_manager_show(VIEWER_WINSET_SUB_CONTENTS);
+ break;
+ case WLAN_MANAGER_ERROR:
+ default:
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void _back_clicked_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ INFO_LOG(UG_NAME_NORMAL, "Response CANCEL");
+ wifi_exit();
+}
+
+static int mobilehotspot_deactivate()
+{
+ __COMMON_FUNC_ENTER__;
+
+ DBusGConnection *bus;
+ DBusGProxy *proxy;
+ GError *error= NULL;
+
+ bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+ if (error != NULL) {
+ INFO_LOG(COMMON_NAME_LIB, "Couldn't connect to the system bus");
+ g_error_free(error);
+ return FALSE;
+ }
+
+ proxy = dbus_g_proxy_new_for_name(bus,
+ "org.tizen.tethering", /* name */
+ "/Tethering", /* obj path */
+ "org.tizen.tethering");/* interface */
+ if (proxy == NULL) {
+ INFO_LOG(COMMON_NAME_LIB, "Couldn't create the proxy object");
+ dbus_g_connection_unref(bus);
+ return FALSE;
+ }
+ g_pending_call.pending_call = dbus_g_proxy_begin_call(proxy, "disable_wifi_tethering",
+ _mobilehotspot_disable_cb, bus, NULL, G_TYPE_INVALID);
+
+ g_pending_call.proxy = proxy;
+ g_pending_call.is_handled = FALSE;
+
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+}
+
+static void _turn_off_mobileap_yes_clicked_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ popup_manager_object_t *manager_object = (popup_manager_object_t *)data;
+ INFO_LOG(UG_NAME_NORMAL, "Response OK");
+ if(manager_object && NULL != manager_object->popup_user_prompt) {
+ evas_object_hide(manager_object->popup_user_prompt);
+ evas_object_del(manager_object->popup_user_prompt);
+ manager_object->popup_user_prompt = NULL;
+ }
+
+ if (FALSE != mobilehotspot_deactivate()) {
+ INFO_LOG(UG_NAME_NORMAL, "Mobile AP return value TRUE");
+ } else {
+ INFO_LOG(UG_NAME_NORMAL, "Mobile AP return value FALSE");
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void _turn_off_mobileap_no_clicked_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ popup_manager_object_t *manager_object = (popup_manager_object_t *)data;
+
+ INFO_LOG(UG_NAME_NORMAL, "Response CANCEL");
+
+ if(manager_object && NULL != manager_object->popup_user_prompt) {
+ evas_object_hide(manager_object->popup_user_prompt);
+ evas_object_del(manager_object->popup_user_prompt);
+ manager_object->popup_user_prompt = NULL;
+ viewer_manager_header_mode_set(HEADER_MODE_OFF);
+ }
+ __COMMON_FUNC_EXIT__;
+}
+
+#if 0
+static void _winset_popup_close_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ popup_manager_object_t *manager_object = (popup_manager_object_t *)data;
+ if (manager_object && manager_object->popup) {
+ evas_object_del(manager_object->popup);
+ manager_object->popup = NULL;
+ }
+ return;
+}
+#endif
+
+popup_manager_object_t *winset_popup_manager_create(Evas_Object* win, const char *str_pkg_name)
+{
+ popup_manager_object_t *manager_object;
+ manager_object = g_new0(popup_manager_object_t, 1);
+ manager_object->win = win;
+ manager_object->str_pkg_name = (char *)str_pkg_name;
+
+ return manager_object;
+}
+
+/*
+ * FIX ME LATER
+ * This function had re-factored as elm_popup's bug
+ */
+void winset_popup_mode_set(popup_manager_object_t *manager_object,
+ POPUP_MODE_OPTIONS option, void *input_data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ char *info_txt;
+ popup_btn_info_t popup_btn_data;
+
+ if (manager_object == NULL)
+ return;
+
+ if(NULL != manager_object->popup) {
+ evas_object_hide(manager_object->popup);
+ evas_object_del(manager_object->popup);
+ manager_object->popup = NULL;
+ }
+ INFO_LOG(UG_NAME_NORMAL, "option = %d", option);
+
+ memset(&popup_btn_data, 0, sizeof(popup_btn_data));
+ switch (option) {
+ case POPUP_OPTION_REGISTER_FAILED_COMMUNICATION_FAILED:
+ popup_btn_data.info_txt = "connman is not working now";
+ popup_btn_data.btn1_cb = _retry_clicked_cb;
+ popup_btn_data.btn2_cb = _back_clicked_cb;
+ popup_btn_data.btn1_data = manager_object;
+ popup_btn_data.btn1_txt = "Retry";
+ popup_btn_data.btn2_txt = "Back";
+ manager_object->popup =
+ common_utils_show_info_popup(
+ manager_object->win, &popup_btn_data);
+ break;
+
+ case POPUP_OPTION_POWER_ON_FAILED_MOBILE_HOTSPOT:
+ if(NULL == manager_object->popup_user_prompt) {
+ popup_btn_data.info_txt =
+ "Connecting Wi-Fi will turn off Mobile hotspot. Continue?";
+ popup_btn_data.btn1_cb = _turn_off_mobileap_yes_clicked_cb;
+ popup_btn_data.btn2_cb = _turn_off_mobileap_no_clicked_cb;
+ popup_btn_data.btn1_data = popup_btn_data.btn2_data = manager_object;
+ popup_btn_data.btn1_txt = sc(manager_object->str_pkg_name, I18N_TYPE_Yes);
+ popup_btn_data.btn2_txt = sc(manager_object->str_pkg_name, I18N_TYPE_No);
+ manager_object->popup_user_prompt =
+ common_utils_show_info_popup(
+ manager_object->win, &popup_btn_data);
+ }
+ break;
+
+ case POPUP_OPTION_CONNECTING_FAILED:
+ if (input_data) {
+ info_txt = g_strdup_printf("Unable to connect %s", (char *)input_data);
+ } else {
+ info_txt = g_strdup("Unable to connect");
+ }
+ manager_object->popup =
+ common_utils_show_info_ok_popup(
+ manager_object->win, manager_object->str_pkg_name, info_txt);
+ g_free(info_txt);
+ break;
+
+ case POPUP_OPTION_HIDDEN_AP_SSID_LEN_ERROR:
+ info_txt = _("SSID can be up to 32 letters.<br>Check your input.");
+ manager_object->popup =
+ common_utils_show_info_ok_popup(
+ manager_object->win, manager_object->str_pkg_name, info_txt);
+ break;
+
+ case POPUP_OPTION_WEP_PSWD_LEN_ERROR:
+ info_txt = WEP_WRONG_PASSWORD_LEN_ERR_MSG_STR;
+ manager_object->popup =
+ common_utils_show_info_ok_popup(
+ manager_object->win, manager_object->str_pkg_name, info_txt);
+ break;
+
+ case POPUP_OPTION_WPA_PSWD_LEN_ERROR:
+ info_txt = WPA_WRONG_PASSWORD_LEN_ERR_MSG_STR;
+ manager_object->popup =
+ common_utils_show_info_ok_popup(
+ manager_object->win, manager_object->str_pkg_name, info_txt);
+ break;
+
+ case POPUP_OPTION_WIFI_INVALID_KEY:
+ info_txt = INVALID_PASSWORD;
+ manager_object->popup =
+ common_utils_show_info_ok_popup(
+ manager_object->win, manager_object->str_pkg_name, info_txt);
+ break;
+
+ default:
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+gboolean winset_popup_manager_destroy(popup_manager_object_t *manager_object)
+{
+ if (manager_object == NULL)
+ return FALSE;
+
+ if (manager_object->popup != NULL) {
+ evas_object_del(manager_object->popup);
+ manager_object->popup = NULL;
+ }
+
+ g_free(manager_object);
+
+ return TRUE;
+}
+
+gboolean winset_popup_hide_popup(popup_manager_object_t *manager_object)
+{
+ if (manager_object == NULL)
+ return FALSE;
+
+ evas_object_hide(manager_object->popup);
+ evas_object_del(manager_object->popup);
+ manager_object->popup = NULL;
+
+ if(manager_object->popup_user_prompt != NULL) {
+ evas_object_hide(manager_object->popup_user_prompt);
+ evas_object_del(manager_object->popup_user_prompt);
+ manager_object->popup_user_prompt = NULL;
+ }
+
+ return TRUE;
+}
diff --git a/sources/wifi-syspopup/CMakeLists.txt b/sources/wifi-syspopup/CMakeLists.txt
new file mode 100644
index 0000000..7fa7e8e
--- /dev/null
+++ b/sources/wifi-syspopup/CMakeLists.txt
@@ -0,0 +1,56 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(wifi-qs C)
+
+# defines
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include")
+SET(VERSION 0.1.0)
+
+# source files
+SET(SRCS
+ ../libraries/i18nManager/i18nmanager.c
+ ../libraries/appcoreWrapper/appcoreWrapper.c
+ ../libraries/WlanManager/wlan-manager/wlan_manager.c
+ ../libraries/Common/common_utils.c
+ ../libraries/Common/common_ip_info.c
+ ../libraries/Common/common_pswd_popup.c
+ ../libraries/Common/common_eap_connect.c
+ ../libraries/Common/common_invalid_password.c
+ ${ENGINE_SOURCES}
+ viewer-popups/view-main.c
+ viewer-popups/view-alerts.c
+ wifi-syspopup.c
+ wifi-syspopup-engine-callback.c)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+
+# add executable
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin)
+
+# install image files
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images/37_wifi_icon_00.png DESTINATION /usr/share/icon)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images/37_wifi_icon_01.png DESTINATION /usr/share/icon)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images/37_wifi_icon_02.png DESTINATION /usr/share/icon)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images/37_wifi_icon_03.png DESTINATION /usr/share/icon)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images/37_wifi_icon_lock_00.png DESTINATION /usr/share/icon)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images/37_wifi_icon_lock_01.png DESTINATION /usr/share/icon)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images/37_wifi_icon_lock_02.png DESTINATION /usr/share/icon)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images/37_wifi_icon_lock_03.png DESTINATION /usr/share/icon)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images/Q02_Notification__wifi_in_range.png DESTINATION /usr/share/icon)
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/net.${PROJECT_NAME}.xml DESTINATION /usr/share/packages/)
+
+# install ini file
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.ini DESTINATION /usr/share/process-info)
+
diff --git a/sources/wifi-syspopup/include/wifi-syspopup-engine-callback.h b/sources/wifi-syspopup/include/wifi-syspopup-engine-callback.h
new file mode 100644
index 0000000..cba393f
--- /dev/null
+++ b/sources/wifi-syspopup/include/wifi-syspopup-engine-callback.h
@@ -0,0 +1,37 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __WIFI_SYSPOPUP_ENGINE_CALLBACK_H__
+#define __WIFI_SYSPOPUP_ENGINE_CALLBACK_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "wlan_manager.h"
+
+void wlan_engine_refresh_callback(void);
+void wlan_engine_callback(wlan_mgr_event_info_t *event_info, void *user_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/wifi-syspopup/include/wifi-syspopup.h b/sources/wifi-syspopup/include/wifi-syspopup.h
new file mode 100644
index 0000000..b499599
--- /dev/null
+++ b/sources/wifi-syspopup/include/wifi-syspopup.h
@@ -0,0 +1,98 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __WIFI_SYSPOPUP_H__
+#define __WIFI_SYSPOPUP_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "common.h"
+#include "common_pswd_popup.h"
+#include "common_eap_connect.h"
+#include "wlan_manager.h"
+
+#define PACKAGE "wifi-qs"
+#define LOCALEDIR "/usr/share/locale"
+#define WIFI_SP_ICON_PATH "/usr/share/icon"
+
+typedef enum {
+ WIFI_SYSPOPUP_SUPPORT_NONE =0,
+ WIFI_SYSPOPUP_SUPPORT_QUICKPANEL=1,
+ WIFI_SYSPOPUP_SUPPORT_MAX
+} WIFI_SYSPOPUP_SUPPORTS;
+
+typedef enum {
+ WIFI_SYSPOPUP_WITH_AP_LIST = 0,
+ WIFI_SYSPOPUP_WITHOUT_AP_LIST
+} WIFI_SYSPOPUP_TYPE;
+
+#define MAX_PROFILE_NUM NETPM_PROFILES_PERSISTENT_MAX
+
+typedef struct wifi_object {
+ /* wifi object attributes */
+ WIFI_SYSPOPUP_SUPPORTS wifi_syspopup_support;
+
+ /* connection_result */
+ int connection_result;
+
+ Eina_Bool update_enabled;
+
+ /* caller type */
+ WIFI_SYSPOPUP_TYPE syspopup_type;
+
+ /* window */
+ Evas_Object* win_main;
+ Evas_Object* conformant;
+ Evas_Object* layout_main;
+
+ Evas* evas;
+ bundle* b;
+
+ /* popups */
+ Evas_Object* syspopup;
+ pswd_popup_t *passpopup;
+ common_eap_connect_data_t *eap_popup;
+ Evas_Object* alertpopup;
+} wifi_object;
+
+typedef enum {
+ ITEM_CONNECTION_MODE_NULL,
+ ITEM_CONNECTION_MODE_OFF,
+ ITEM_CONNECTION_MODE_CONNECTING,
+ ITEM_CONNECTION_MODE_DISCONNECTING,
+ ITEM_CONNECTION_MODE_MAX
+} ITEM_CONNECTION_MODES;
+
+typedef struct {
+ Elm_Object_Item *it;
+ ITEM_CONNECTION_MODES connection_mode;
+ wifi_device_info_t *dev_info;
+} syspopup_genlist_data_t;
+
+int wifi_syspopup_create(void);
+int wifi_syspopup_destroy(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/wifi-syspopup/net.wifi-qs.xml b/sources/wifi-syspopup/net.wifi-qs.xml
new file mode 100644
index 0000000..2ad839d
--- /dev/null
+++ b/sources/wifi-syspopup/net.wifi-qs.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="net.wifi-qs" version="0.4.55-7" install-location="internal-only">
+ <label>Wi-Fi device picker</label>
+ <author email="sanghoon80.cho@samsung.com" href="www.samsung.com">Sanghoon Cho</author>
+ <description>Wi-Fi device picker</description>
+ <ui-application appid="net.wifi-qs" exec="/usr/bin/wifi-qs" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+ <label>Wi-Fi device picker</label>
+ </ui-application>
+</manifest>
diff --git a/sources/wifi-syspopup/viewer-popups/include/view-alerts.h b/sources/wifi-syspopup/viewer-popups/include/view-alerts.h
new file mode 100644
index 0000000..1858b23
--- /dev/null
+++ b/sources/wifi-syspopup/viewer-popups/include/view-alerts.h
@@ -0,0 +1,36 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __WIFI_SYSPOPUP_VIEW_ALERTS_H__
+#define __WIFI_SYSPOPUP_VIEW_ALERTS_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+int view_alerts_powering_on_show(void);
+void view_alerts_popup_show(const char *err_msg);
+void view_alerts_popup_ok_show(const char *err_msg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/wifi-syspopup/viewer-popups/include/view-main.h b/sources/wifi-syspopup/viewer-popups/include/view-main.h
new file mode 100644
index 0000000..5e25385
--- /dev/null
+++ b/sources/wifi-syspopup/viewer-popups/include/view-main.h
@@ -0,0 +1,44 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __WIFI_SYSPOPUP_VIEW_MAIN_H__
+#define __WIFI_SYSPOPUP_VIEW_MAIN_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <Evas.h>
+#include <Eina.h>
+
+#include "wlan_manager.h"
+#include "wifi-syspopup.h"
+
+/* create */
+Evas_Object *view_main_create(Evas_Object* parent);
+int view_main_destroy(void);
+void view_main_item_state_set(wifi_ap_h ap, ITEM_CONNECTION_MODES state);
+Eina_Bool view_main_show(void *data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sources/wifi-syspopup/viewer-popups/view-alerts.c b/sources/wifi-syspopup/viewer-popups/view-alerts.c
new file mode 100644
index 0000000..cf722b4
--- /dev/null
+++ b/sources/wifi-syspopup/viewer-popups/view-alerts.c
@@ -0,0 +1,112 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "common.h"
+#include "common_utils.h"
+#include "wifi-syspopup.h"
+#include "view-alerts.h"
+#include "i18nmanager.h"
+
+extern wifi_object* syspopup_app_state;
+
+int view_alerts_powering_on_show(void)
+{
+ __COMMON_FUNC_ENTER__;
+ if(WIFI_SYSPOPUP_SUPPORT_QUICKPANEL == syspopup_app_state->wifi_syspopup_support){
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+ }
+ if(NULL != syspopup_app_state->alertpopup) {
+ evas_object_del(syspopup_app_state->alertpopup);
+ syspopup_app_state->alertpopup = NULL;
+ }
+
+ syspopup_app_state->alertpopup = elm_popup_add(syspopup_app_state->layout_main);
+
+ Evas_Object *box = elm_box_add(syspopup_app_state->alertpopup);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(box);
+
+ Evas_Object *progressbar = elm_progressbar_add(box);
+ elm_object_style_set(progressbar, "list_process");
+ evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_progressbar_pulse(progressbar, EINA_TRUE);
+ evas_object_show(progressbar);
+ elm_box_pack_end(box, progressbar);
+
+ Evas_Object *label = elm_label_add(box);
+ elm_object_style_set(label, "popup/default");
+ evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(label, sc(PACKAGE, I18N_TYPE_Activating));
+ evas_object_show(label);
+ elm_box_pack_end(box, label);
+
+ elm_object_content_set(syspopup_app_state->alertpopup, box);
+ evas_object_size_hint_weight_set(syspopup_app_state->alertpopup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(syspopup_app_state->alertpopup);
+
+ __COMMON_FUNC_EXIT__;
+
+ return TRUE;
+}
+
+void view_alerts_popup_show(const char *err_msg)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (WIFI_SYSPOPUP_SUPPORT_QUICKPANEL ==
+ syspopup_app_state->wifi_syspopup_support) {
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ if (NULL != syspopup_app_state->alertpopup) {
+ evas_object_del(syspopup_app_state->alertpopup);
+ syspopup_app_state->alertpopup = NULL;
+ }
+
+ syspopup_app_state->alertpopup = common_utils_show_info_timeout_popup(syspopup_app_state->win_main, err_msg, 2.0f);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+void view_alerts_popup_ok_show(const char *err_msg)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (WIFI_SYSPOPUP_SUPPORT_QUICKPANEL ==
+ syspopup_app_state->wifi_syspopup_support) {
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ if (NULL != syspopup_app_state->alertpopup) {
+ evas_object_del(syspopup_app_state->alertpopup);
+ syspopup_app_state->alertpopup = NULL;
+ }
+
+ syspopup_app_state->alertpopup =
+ common_utils_show_info_ok_popup(
+ syspopup_app_state->win_main, PACKAGE, err_msg);
+
+ __COMMON_FUNC_EXIT__;
+}
diff --git a/sources/wifi-syspopup/viewer-popups/view-main.c b/sources/wifi-syspopup/viewer-popups/view-main.c
new file mode 100644
index 0000000..ad283b5
--- /dev/null
+++ b/sources/wifi-syspopup/viewer-popups/view-main.c
@@ -0,0 +1,520 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "common.h"
+#include "view-main.h"
+#include "common_pswd_popup.h"
+#include "common_utils.h"
+#include "view-alerts.h"
+#include "i18nmanager.h"
+#include "common_eap_connect.h"
+
+#define QS_POPUP_CONNECTION_STATE "qs_popup_connection_state"
+
+extern wifi_object* syspopup_app_state;
+
+static Evas_Object* list = NULL;
+static Elm_Genlist_Item_Class itc;
+
+static ITEM_CONNECTION_MODES view_main_state_get()
+{
+ return (ITEM_CONNECTION_MODES)evas_object_data_get(list, QS_POPUP_CONNECTION_STATE);
+}
+
+static void view_main_state_set(ITEM_CONNECTION_MODES state)
+{
+ return evas_object_data_set(list, QS_POPUP_CONNECTION_STATE, (const void *)state);
+}
+
+static void _popup_ok_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!syspopup_app_state->passpopup) {
+ return;
+ }
+ assertm_if(NULL == obj, "obj is NULL!!");
+ assertm_if(NULL == event_info, "event_info is NULL!!");
+
+ wifi_ap_h ap = common_pswd_popup_get_ap(syspopup_app_state->passpopup);
+ wifi_security_type_e sec_type;
+ wifi_ap_get_security_type(ap, &sec_type);
+
+ char* password = NULL;
+ int len_password = 0;
+ int ret = WLAN_MANAGER_ERR_UNKNOWN;
+ password = common_pswd_popup_get_txt(syspopup_app_state->passpopup);
+ len_password = strlen(password);
+ INFO_LOG(SP_NAME_NORMAL, "* password len [%d]", len_password);
+
+ switch (sec_type) {
+ case WIFI_SECURITY_TYPE_WEP:
+ if (len_password == 5 || len_password == 13 || len_password == 26 || len_password == 10) {
+ ret = wlan_manager_connect_with_password(ap, password);
+ } else {
+ view_alerts_popup_show(WEP_WRONG_PASSWORD_LEN_ERR_MSG_STR);
+ goto popup_ok_exit;
+ }
+ break;
+
+ case WIFI_SECURITY_TYPE_WPA_PSK:
+ case WIFI_SECURITY_TYPE_WPA2_PSK:
+ if (len_password < 8 || len_password > 63) {
+ view_alerts_popup_show(WPA_WRONG_PASSWORD_LEN_ERR_MSG_STR);
+ goto popup_ok_exit;
+ } else {
+ ret = wlan_manager_connect_with_password(ap, password);
+ }
+ break;
+
+ default:
+ ret = WLAN_MANAGER_ERR_UNKNOWN;
+ ERROR_LOG(SP_NAME_ERR, "Fatal: Wrong security type : %d", sec_type);
+ break;
+ }
+
+ common_pswd_popup_destroy(syspopup_app_state->passpopup);
+ syspopup_app_state->passpopup = NULL;
+
+popup_ok_exit:
+ g_free(password);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void _popup_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+
+ INFO_LOG(SP_NAME_NORMAL, "button cancel");
+
+ common_pswd_popup_destroy(syspopup_app_state->passpopup);
+ syspopup_app_state->passpopup = NULL;
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static void _wps_pbc_popup_cancel_connecting(void* data, Evas_Object* obj, void* event_info)
+{
+ if (!syspopup_app_state->passpopup) {
+ return;
+ }
+
+ wifi_ap_h ap = common_pswd_popup_get_ap(syspopup_app_state->passpopup);
+ int ret = wlan_manager_request_disconnection(ap);
+ if (ret == WLAN_MANAGER_ERR_NONE) {
+ INFO_LOG(SP_NAME_NORMAL, "WPS conection cancelled successfully for AP[0x%x]", ap);
+ } else {
+ ERROR_LOG(SP_NAME_ERR, "Error!!! wlan_manager_request_disconnection failed for AP[0x%x]", ap);
+ }
+ common_pswd_popup_destroy(syspopup_app_state->passpopup);
+ syspopup_app_state->passpopup = NULL;
+ return;
+}
+
+static void _wps_btn_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ if (!syspopup_app_state->passpopup) {
+ return;
+ }
+
+ wifi_ap_h ap = common_pswd_popup_get_ap(syspopup_app_state->passpopup);
+ int ret = wlan_manager_request_wps_connection(ap);
+ if (ret == WLAN_MANAGER_ERR_NONE) {
+ common_pswd_popup_pbc_popup_create(syspopup_app_state->passpopup, _wps_pbc_popup_cancel_connecting, NULL);
+ } else {
+ ERROR_LOG(SP_NAME_ERR, "Error!!! wlan_manager_request_wps_connection failed");
+ wifi_ap_destroy(ap);
+ }
+ __COMMON_FUNC_EXIT__;
+}
+
+static void __view_main_request_connection(syspopup_genlist_data_t *gdata)
+{
+ if (!gdata)
+ return;
+
+ int ret = WLAN_MANAGER_ERR_UNKNOWN;
+ ret = wlan_manager_request_connection(gdata->dev_info->ap);
+ switch (ret) {
+ case WLAN_MANAGER_ERR_NONE:
+ INFO_LOG( SP_NAME_NORMAL, "ERROR_NONE");
+ view_main_state_set(ITEM_CONNECTION_MODE_CONNECTING);
+ break;
+ case WLAN_MANAGER_ERR_CONNECT_PASSWORD_NEEDED:
+ INFO_LOG( SP_NAME_NORMAL, "Password view will show up");
+ pswd_popup_create_req_data_t popup_info;
+ memset(&popup_info, 0, sizeof(pswd_popup_create_req_data_t));
+ popup_info.title = gdata->dev_info->ssid;
+ popup_info.ok_cb = _popup_ok_cb;
+ popup_info.cancel_cb = _popup_cancel_cb;
+ popup_info.show_wps_btn = gdata->dev_info->wps_mode;
+ popup_info.wps_btn_cb = _wps_btn_cb;
+ popup_info.ap = gdata->dev_info->ap;
+ popup_info.cb_data = NULL;
+ syspopup_app_state->passpopup = common_pswd_popup_create(syspopup_app_state->layout_main, PACKAGE, &popup_info);
+ break;
+ case WLAN_MANAGER_ERR_CONNECT_EAP_SEC_TYPE:
+ syspopup_app_state->eap_popup = create_eap_connect_popup(syspopup_app_state->layout_main, PACKAGE, gdata->dev_info);
+ break;
+ default:
+ ERROR_LOG( SP_NAME_NORMAL, "errro code [%d]", ret);
+ break;
+ }
+}
+
+Elm_Object_Item *__view_main_get_item_in_mode(ITEM_CONNECTION_MODES mode)
+{
+ Elm_Object_Item* it = NULL;
+ it = elm_genlist_first_item_get(list);
+ __COMMON_FUNC_ENTER__;
+ while (it) {
+ syspopup_genlist_data_t *gdata = (syspopup_genlist_data_t *)elm_object_item_data_get(it);
+ if (gdata && gdata->connection_mode == mode) {
+ INFO_LOG( SP_NAME_NORMAL, "Found Item [%s] in mode[%d]", gdata->dev_info->ssid, mode);
+ __COMMON_FUNC_EXIT__;
+ return it;
+ }
+ it = elm_genlist_item_next_get(it);
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return NULL;
+}
+
+static void _gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ assertm_if(NULL == data, "data is NULL!!");
+ assertm_if(NULL == obj, "obj is NULL!!");
+ assertm_if(NULL == event_info, "event_info is NULL!!");
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ ITEM_CONNECTION_MODES state = view_main_state_get();
+ syspopup_genlist_data_t *gdata = (syspopup_genlist_data_t *)data;
+
+ if (ITEM_CONNECTION_MODE_OFF == state) {
+ INFO_LOG(SP_NAME_NORMAL, "item state: off");
+ __view_main_request_connection(gdata);
+ elm_genlist_item_update(item);
+ } else if (ITEM_CONNECTION_MODE_CONNECTING == state) {
+ if (ITEM_CONNECTION_MODE_CONNECTING == gdata->connection_mode) { // Connecting Item Selected
+ if (WLAN_MANAGER_ERR_NONE == wlan_manager_request_disconnection(gdata->dev_info->ap)) {
+ view_main_state_set(ITEM_CONNECTION_MODE_DISCONNECTING);
+ gdata->connection_mode = ITEM_CONNECTION_MODE_DISCONNECTING;
+ elm_genlist_item_update(item);
+ }
+ } else { // Item Selected while other item is in connecting state
+#if 0 // Enable this later when two connect requests is supported by libnet.
+ Elm_Object_Item *connecting_it = __view_main_get_item_in_mode(ITEM_CONNECTION_MODE_CONNECTING);
+ view_main_state_set(ITEM_CONNECTION_MODE_OFF);
+ __view_main_request_connection(gdata);
+ if (connecting_it) {
+ syspopup_genlist_data_t *connecting_gdata = elm_object_item_data_get(connecting_it);
+ if (connecting_gdata && WLAN_MANAGER_ERR_NONE == wlan_manager_request_disconnection(connecting_gdata->dev_info->ap)) {
+ gdata->connection_mode = ITEM_CONNECTION_MODE_OFF;
+ elm_genlist_item_update(connecting_it);
+ }
+ } else {
+ ERROR_LOG(SP_NAME_NORMAL, "Could not find connecting item");
+ }
+#endif
+ }
+ } else {
+ INFO_LOG(SP_NAME_NORMAL, "In wrong state, nothing can do" );
+ }
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static char *_gl_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ __COMMON_FUNC_ENTER__;
+ char *ret = NULL;
+ assertm_if(NULL == data, "data param is NULL!!");
+ assertm_if(NULL == obj, "obj param is NULL!!");
+ assertm_if(NULL == part, "part param is NULL!!");
+
+ syspopup_genlist_data_t *gdata = (syspopup_genlist_data_t *) data;
+ if (!strncmp(part, "elm.text.1", strlen(part))) {
+ ret = gdata->dev_info->ssid;
+ if (ret == NULL) {
+ ERROR_LOG(SP_NAME_NORMAL, "ssid name is NULL!!");
+ }
+ } else if (!strncmp(part, "elm.text.2", strlen(part))) {
+ if (ITEM_CONNECTION_MODE_CONNECTING == gdata->connection_mode) {
+ ret = sc(PACKAGE, I18N_TYPE_Connecting);
+ } else if (ITEM_CONNECTION_MODE_DISCONNECTING == gdata->connection_mode) {
+ ret = sc(PACKAGE, I18N_TYPE_Disconnecting);
+ } else {
+ ret = gdata->dev_info->ap_status_txt;
+ }
+ if (ret == NULL) {
+ ERROR_LOG(SP_NAME_NORMAL, "ap_status_txt is NULL!!");
+ }
+ }
+
+ __COMMON_FUNC_EXIT__;
+
+ return g_strdup(ret);
+}
+
+static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ __COMMON_FUNC_ENTER__;
+ if (data == NULL)
+ return NULL;
+
+ syspopup_genlist_data_t *gdata = (syspopup_genlist_data_t *) data;
+
+ const char* ssid_name = gdata->dev_info->ssid;
+ INFO_LOG(SP_NAME_NORMAL, "ssid name [%s]", ssid_name);
+
+ Evas_Object* icon = NULL;
+
+ if (!strncmp(part, "elm.icon.1", strlen(part))) {
+ icon = elm_image_add(obj);
+ elm_image_file_set(icon, gdata->dev_info->ap_image_path, NULL);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 5, 5);
+ } else if (!strncmp(part, "elm.icon.2", strlen(part))) {
+ switch (gdata->connection_mode) {
+ case ITEM_CONNECTION_MODE_OFF:
+ default:
+ break;
+ case ITEM_CONNECTION_MODE_CONNECTING:
+ case ITEM_CONNECTION_MODE_DISCONNECTING:
+ icon = elm_progressbar_add(obj);
+ elm_object_style_set(icon, "list_process");
+ evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_progressbar_pulse(icon, TRUE);
+ break;
+ }
+
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return icon;
+}
+
+static void _gl_list_del(void* data, Evas_Object* obj)
+{
+ if (data == NULL)
+ return;
+
+ syspopup_genlist_data_t* gdata = (syspopup_genlist_data_t *) data;
+
+ if (gdata->dev_info) {
+ DEBUG_LOG(UG_NAME_NORMAL, "del target ssid: [%s]", gdata->dev_info->ssid);
+ g_free(gdata->dev_info->ap_image_path);
+ g_free(gdata->dev_info->ap_status_txt);
+ g_free(gdata->dev_info->ssid);
+ wifi_ap_destroy(gdata->dev_info->ap);
+ g_free(gdata->dev_info);
+ }
+ elm_object_item_data_set(gdata->it, NULL);
+ g_free(gdata);
+
+ return;
+}
+
+Evas_Object *view_main_create(Evas_Object* parent)
+{
+ __COMMON_FUNC_ENTER__;
+ assertm_if(NULL == parent, "parent is NULL!!");
+
+ list = elm_genlist_add(parent);
+ assertm_if(NULL == list, "list allocation fail!!");
+
+ evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ __COMMON_FUNC_EXIT__;
+
+ return list;
+}
+
+int view_main_destroy(void)
+{
+ __COMMON_FUNC_ENTER__;
+ if(NULL != list) {
+ evas_object_del(list);
+ list = NULL;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+}
+
+static void view_main_scan_ui_clear(void)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (list == NULL)
+ return;
+ elm_genlist_clear(list);
+
+ __COMMON_FUNC_EXIT__;
+}
+
+void view_main_item_state_set(wifi_ap_h ap, ITEM_CONNECTION_MODES state)
+{
+ char *item_ssid = NULL;
+ wifi_security_type_e sec_type;
+ wlan_security_mode_type_t item_sec_mode;
+ Elm_Object_Item* it = NULL;
+ it = elm_genlist_first_item_get(list);
+ __COMMON_FUNC_ENTER__;
+ if (!it ||
+ !ap ||
+ (WIFI_ERROR_NONE != wifi_ap_get_essid(ap, &item_ssid)) ||
+ (WIFI_ERROR_NONE != wifi_ap_get_security_type(ap, &sec_type))) {
+ ERROR_LOG(SP_NAME_NORMAL, "Invalid params");
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+ item_sec_mode = common_utils_get_sec_mode(sec_type);
+ INFO_LOG(SP_NAME_NORMAL, "item state set for AP[%s] with sec mode[%d]", item_ssid, item_sec_mode);
+ while (it) {
+ syspopup_genlist_data_t *gdata = (syspopup_genlist_data_t *)elm_object_item_data_get(it);
+ INFO_LOG(SP_NAME_NORMAL, "gdata AP[%s] with sec mode[%d]", gdata->dev_info->ssid, gdata->dev_info->security_mode);
+ if (gdata->dev_info->security_mode == item_sec_mode &&
+ !g_strcmp0(gdata->dev_info->ssid, item_ssid)) {
+ if (gdata->connection_mode != state) {
+ gdata->connection_mode = state;
+ INFO_LOG(SP_NAME_NORMAL, "State transition from [%d] --> [%d]", view_main_state_get(), state);
+ view_main_state_set(state);
+ elm_genlist_item_update(it);
+ }
+ break;
+ }
+
+ it = elm_genlist_item_next_get(it);
+ }
+ g_free(item_ssid);
+ __COMMON_FUNC_EXIT__;
+ return;
+}
+
+static wifi_device_info_t *view_main_item_device_info_create(wifi_ap_h ap)
+{
+ __COMMON_FUNC_ENTER__;
+
+ wifi_device_info_t *wifi_device = g_new0(wifi_device_info_t, 1);
+ wifi_security_type_e sec_type;
+
+ if (WIFI_ERROR_NONE != wifi_ap_clone(&(wifi_device->ap), ap)) {
+ g_free(wifi_device);
+ return NULL;
+ } else if (WIFI_ERROR_NONE != wifi_ap_get_essid(ap, &(wifi_device->ssid))) {
+ g_free(wifi_device);
+ return NULL;
+ } else if (WIFI_ERROR_NONE != wifi_ap_get_rssi(ap, &(wifi_device->rssi))) {
+ g_free(wifi_device->ssid);
+ g_free(wifi_device);
+ return NULL;
+ } else if (WIFI_ERROR_NONE != wifi_ap_get_security_type (ap, &sec_type)) {
+ g_free(wifi_device->ssid);
+ g_free(wifi_device);
+ return NULL;
+ } else if (WIFI_ERROR_NONE != wifi_ap_is_wps_supported (ap, &(wifi_device->wps_mode))) {
+ g_free(wifi_device->ssid);
+ g_free(wifi_device);
+ return NULL;
+ }
+ wifi_device->security_mode = common_utils_get_sec_mode(sec_type);
+ wifi_device->ap_status_txt = common_utils_get_ap_security_type_info_txt(PACKAGE, wifi_device);
+ wifi_device->ap_image_path = common_utils_get_device_icon(WIFI_SP_ICON_PATH, wifi_device);
+
+ __COMMON_FUNC_EXIT__;
+ return wifi_device;
+}
+
+static bool view_main_wifi_found_ap_cb(wifi_ap_h ap, void* user_data)
+{
+ int *profile_size = (int *)user_data;
+ syspopup_genlist_data_t *gdata = g_new0(syspopup_genlist_data_t, 1);
+ wifi_connection_state_e state;
+
+ gdata->dev_info = view_main_item_device_info_create(ap);
+ if (gdata->dev_info == NULL) {
+ g_free(gdata);
+
+ return true;
+ }
+
+ wifi_ap_get_connection_state(ap, &state);
+
+ if (WIFI_CONNECTION_STATE_ASSOCIATION == state ||
+ WIFI_CONNECTION_STATE_CONFIGURATION == state) {
+ gdata->connection_mode = ITEM_CONNECTION_MODE_CONNECTING;
+ gdata->it = elm_genlist_item_append(list, &itc, gdata, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel, gdata);
+ *profile_size += 1;
+ view_main_state_set(ITEM_CONNECTION_MODE_CONNECTING);
+
+ return true;
+ }
+
+ gdata->connection_mode = ITEM_CONNECTION_MODE_OFF;
+ gdata->it = elm_genlist_item_append(list, &itc, gdata, NULL,
+ ELM_GENLIST_ITEM_NONE, _gl_sel, gdata);
+ *profile_size += 1;
+
+ return true;
+}
+
+Eina_Bool view_main_show(void *data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (list == NULL) {
+ ERROR_LOG( SP_NAME_NORMAL, "list is NULL!!" );
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ view_main_scan_ui_clear();
+ view_main_state_set(ITEM_CONNECTION_MODE_OFF);
+
+ int state = wlan_manager_state_get();
+ if (WLAN_MANAGER_ERROR == state || WLAN_MANAGER_OFF == state) {
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ itc.item_style = "2text.2icon.4";
+ itc.func.text_get = _gl_text_get;
+ itc.func.content_get = _gl_content_get;
+ itc.func.state_get = NULL;
+ itc.func.del = _gl_list_del;
+
+ int profiles_list_size = 0;
+
+ wifi_foreach_found_aps(view_main_wifi_found_ap_cb, &profiles_list_size);
+
+ INFO_LOG(SP_NAME_NORMAL, "profiles list count [%d]\n", profiles_list_size);
+ if (profiles_list_size <= 0) {
+ WARN_LOG(SP_NAME_NORMAL, "scan size is ZERO");
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ evas_object_show(list);
+ __COMMON_FUNC_EXIT__;
+
+ return ECORE_CALLBACK_CANCEL;
+}
diff --git a/sources/wifi-syspopup/wifi-qs.ini b/sources/wifi-syspopup/wifi-qs.ini
new file mode 100644
index 0000000..5abbace
--- /dev/null
+++ b/sources/wifi-syspopup/wifi-qs.ini
@@ -0,0 +1,2 @@
+[ProcessSetting]
+BG_SCHEDULE=true
diff --git a/sources/wifi-syspopup/wifi-syspopup-engine-callback.c b/sources/wifi-syspopup/wifi-syspopup-engine-callback.c
new file mode 100644
index 0000000..93ca3e9
--- /dev/null
+++ b/sources/wifi-syspopup/wifi-syspopup-engine-callback.c
@@ -0,0 +1,157 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <vconf-keys.h>
+#include <syspopup_caller.h>
+
+#include "common.h"
+#include "view-main.h"
+#include "view-alerts.h"
+#include "common_utils.h"
+#include "wifi-syspopup-engine-callback.h"
+
+extern wifi_object* syspopup_app_state;
+
+void wlan_engine_callback(wlan_mgr_event_info_t *event_info, void *user_data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ char *ssid = NULL;
+
+ if (event_info == NULL) {
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ INFO_LOG(SP_NAME_NORMAL, "event type [%d]", event_info->event_type);
+
+ switch (event_info->event_type) {
+ case WLAN_MANAGER_RESPONSE_TYPE_NONE:
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_OK:
+ case WLAN_MANAGER_RESPONSE_TYPE_WPS_ENROLL_OK:
+ ssid = wlan_manager_get_connected_ssid();
+
+ common_utils_send_message_to_net_popup(
+ "Network connection popup", "wifi connected",
+ "notification", ssid);
+ syspopup_app_state->connection_result = VCONFKEY_WIFI_QS_WIFI_CONNECTED;
+ wifi_syspopup_destroy();
+ g_free(ssid);
+
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_CONNECT_FAILED:
+ case WLAN_MANAGER_RESPONSE_TYPE_WPS_ENROLL_FAIL:
+ if (syspopup_app_state->passpopup) {
+ common_pswd_popup_destroy(syspopup_app_state->passpopup);
+ syspopup_app_state->passpopup = NULL;
+ }
+
+ view_main_item_state_set(event_info->ap, ITEM_CONNECTION_MODE_OFF);
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_DISCONNECTION_OK:
+ view_main_item_state_set(event_info->ap, ITEM_CONNECTION_MODE_OFF);
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_POWER_ON_OK:
+ connman_request_scan_mode_set(WIFI_BGSCAN_MODE_PERIODIC);
+
+ if (syspopup_app_state->syspopup_type == WIFI_SYSPOPUP_WITHOUT_AP_LIST)
+ wifi_syspopup_destroy();
+
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_POWER_ON_NOT_SUPPORTED:
+ if (syspopup_app_state->alertpopup) {
+ evas_object_del(syspopup_app_state->alertpopup);
+ syspopup_app_state->alertpopup = NULL;
+ }
+
+ common_utils_send_message_to_net_popup("Network connection popup", "not support", "notification", NULL);
+ wifi_syspopup_destroy();
+
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_POWER_ON_RESTRICTED:
+ if (syspopup_app_state->alertpopup) {
+ evas_object_del(syspopup_app_state->alertpopup);
+ syspopup_app_state->alertpopup = NULL;
+ }
+
+ common_utils_send_message_to_net_popup("Network connection popup", "wifi restricted", "popup", NULL);
+ wifi_syspopup_destroy();
+
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_POWER_OFF_OK:
+ wifi_syspopup_destroy();
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_SCAN_OK:
+ wlan_manager_scanned_profile_refresh();
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_CONNECTING:
+ view_main_item_state_set(event_info->ap,
+ ITEM_CONNECTION_MODE_CONNECTING);
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_SCAN_RESULT_IND:
+ wlan_manager_scanned_profile_refresh();
+ break;
+
+ case WLAN_MANAGER_RESPONSE_TYPE_CONNECTION_INVALID_KEY:
+ view_alerts_popup_ok_show(INVALID_PASSWORD);
+ break;
+
+ default:
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+}
+
+void wlan_engine_refresh_callback(void)
+{
+ __COMMON_FUNC_ENTER__;
+
+ if (NULL == syspopup_app_state) {
+ INFO_LOG(SP_NAME_ERR, "syspopup_app_state is NULL!! Is it test mode?");
+
+ __COMMON_FUNC_EXIT__;
+ return;
+ }
+
+ /* Make System popup filled, if it was first launched */
+ if (NULL != syspopup_app_state->alertpopup) {
+ /* deallocate alert popup if it has allocated */
+ evas_object_del(syspopup_app_state->alertpopup);
+ syspopup_app_state->alertpopup = NULL;
+ }
+
+ INFO_LOG(SP_NAME_NORMAL, "Wi-Fi QS launch");
+
+ ecore_idler_add(view_main_show, NULL);
+
+ __COMMON_FUNC_EXIT__;
+ return;
+}
diff --git a/sources/wifi-syspopup/wifi-syspopup.c b/sources/wifi-syspopup/wifi-syspopup.c
new file mode 100644
index 0000000..03f35e3
--- /dev/null
+++ b/sources/wifi-syspopup/wifi-syspopup.c
@@ -0,0 +1,641 @@
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <wifi.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#include <Ecore_X.h>
+#include <syspopup.h>
+#include <vconf-keys.h>
+#include <appcore-efl.h>
+
+#include "common.h"
+#include "view-main.h"
+#include "i18nmanager.h"
+#include "view-alerts.h"
+#include "common_utils.h"
+#include "wlan_manager.h"
+#include "wifi-syspopup.h"
+#include "appcoreWrapper.h"
+#include "wifi-syspopup-engine-callback.h"
+
+#define POPUP_HEAD_AREA 134
+#define POPUP_BUTTON_AREA 200
+#define MAX_INITIAL_QS_POPUP_LIST_SIZE 8
+
+wifi_object* syspopup_app_state = NULL;
+
+/* static */
+static int myterm(bundle* b, void* data);
+static int mytimeout(bundle *b, void* data);
+static int wifi_syspopup_exit( void );
+static void _exit_cb(void *data, Evas_Object *obj, void *event_info);
+static int syspopup_support_set(const char* support);
+static int app_reset(bundle *b, void *data);
+static int app_init(void *data);
+static int app_exit(void *data);
+static int app_start(void *data);
+static int app_stop(void *data);
+
+static int __get_window_property(Display *dpy, Window win, Atom atom,
+ Atom type, unsigned int *val,
+ unsigned int len)
+{
+ __COMMON_FUNC_ENTER__;
+ unsigned char *prop_ret = NULL;
+ Atom type_ret = -1;
+ unsigned long bytes_after = 0;
+ unsigned long num_ret = -1;
+ int format_ret = -1;
+ unsigned int i = 0;
+ int num = 0;
+
+ prop_ret = NULL;
+ if (XGetWindowProperty(dpy, win, atom, 0, 0x7fffffff, False,
+ type, &type_ret, &format_ret, &num_ret,
+ &bytes_after, &prop_ret) != Success) {
+ return -1;
+ }
+
+ if (type_ret != type || format_ret != 32) {
+ num = -1;
+ } else if (num_ret == 0 || !prop_ret) {
+ num = 0;
+ } else {
+ if (num_ret < len) {
+ len = num_ret;
+ }
+ for (i = 0; i < len; i++) {
+ val[i] = ((unsigned long *)prop_ret)[i];
+ }
+ num = len;
+ }
+
+ if (prop_ret) {
+ XFree(prop_ret);
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return num;
+}
+
+static int __x_rotation_get(Display *dpy, Window win)
+{
+ __COMMON_FUNC_ENTER__;
+ Window active_win = 0;
+ Window root_win = 0;
+ int rotation = -1;
+ int ret = -1;
+
+ Atom atom_active_win;
+ Atom atom_win_rotate_angle;
+
+ root_win = XDefaultRootWindow(dpy);
+
+ atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
+ ret = __get_window_property(dpy, root_win, atom_active_win,
+ XA_WINDOW,
+ (unsigned int *)&active_win, 1);
+
+ if (ret < 0)
+ return ret;
+
+ atom_win_rotate_angle =
+ XInternAtom(dpy, "_E_ILLUME_ROTATE_WINDOW_ANGLE", False);
+ ret = __get_window_property(dpy, active_win ,
+ atom_win_rotate_angle, XA_CARDINAL,
+ (unsigned int *)&rotation, 1);
+
+ __COMMON_FUNC_EXIT__;
+
+ if (ret != -1) {
+ return rotation;
+ }
+
+ return -1;
+}
+
+static Eina_Bool __rotate(void *data, int type, void *event)
+{
+ __COMMON_FUNC_ENTER__;
+ struct wifi_object *ad = data;
+ Ecore_X_Event_Client_Message *ev = event;
+ int visible_area_width, visible_area_height;
+ int rotate_angle;
+
+ Evas_Object *box = NULL;
+
+ if (!event)
+ return ECORE_CALLBACK_RENEW;
+
+ if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE) {
+ box = elm_object_content_get(syspopup_app_state->syspopup);
+
+ if (box) {
+ rotate_angle = __x_rotation_get(ecore_x_display_get(), elm_win_xwindow_get(syspopup_app_state->win_main));
+ __common_popup_size_set(NULL ,&visible_area_width, &visible_area_height, rotate_angle);
+ elm_win_rotation_with_resize_set(syspopup_app_state->win_main, rotate_angle);
+ evas_object_size_hint_min_set(box, visible_area_width * elm_config_scale_get(), visible_area_height * elm_config_scale_get());
+ }
+
+ if (syspopup_app_state->eap_popup)
+ eap_view_rotate_popup(syspopup_app_state->eap_popup, rotate_angle);
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return 0;
+}
+
+void __common_popup_size_set(Ecore_IMF_Context *target_imf, int *width, int *height, int rotate_angle)
+{
+ __COMMON_FUNC_ENTER__;
+
+ int window_width, window_height;
+ int start_x, start_y, imf_width, imf_height;
+ float resize_scale = 0.7f;
+
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &window_width, &window_height);
+
+ *width = window_width;
+
+ if (rotate_angle == 0 || rotate_angle == 180)
+ {
+ *height = window_height * resize_scale;
+ }else
+ *height = window_width;
+
+ if (target_imf != NULL) {
+ ecore_imf_context_input_panel_geometry_get(target_imf, &start_x, &start_y, &imf_width, &imf_height);
+ *height = start_y * resize_scale;
+ }else
+ *height = *height-POPUP_HEAD_AREA-POPUP_BUTTON_AREA;
+
+ __COMMON_FUNC_EXIT__;
+}
+
+static int wifi_syspopup_rotate_cb(enum appcore_rm rotate_mode, void *data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ int rotate_angle;
+ int visible_area_width, visible_area_height;
+
+ Evas_Object *box = NULL;
+
+ rotate_angle = common_utils_get_rotate_angle(rotate_mode);
+ box = elm_object_content_get(syspopup_app_state->syspopup);
+ elm_win_rotation_with_resize_set(syspopup_app_state->win_main, rotate_angle);
+
+ __common_popup_size_get(NULL ,&visible_area_width, &visible_area_height);
+ evas_object_size_hint_min_set(box, visible_area_width * elm_config_scale_get(), visible_area_height * elm_config_scale_get());
+
+ if (syspopup_app_state->eap_popup)
+ eap_view_rotate_popup(syspopup_app_state->eap_popup, rotate_angle);
+
+ INFO_LOG(SP_NAME_NORMAL, "rotate_angle : %d", rotate_angle);
+
+ __COMMON_FUNC_EXIT__;
+ return 0;
+}
+
+/* implements */
+static int myterm(bundle* b, void* data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ wifi_syspopup_exit();
+
+ __COMMON_FUNC_EXIT__;
+
+ return 0;
+}
+
+static int mytimeout(bundle *b, void* data)
+{
+ __COMMON_FUNC_ENTER__;
+ __COMMON_FUNC_EXIT__;
+
+ return FALSE;
+}
+
+syspopup_handler handler = {
+ .def_term_fn = myterm,
+ .def_timeout_fn = mytimeout
+};
+
+static int wifi_syspopup_exit(void)
+{
+ __COMMON_FUNC_ENTER__;
+
+ view_main_destroy();
+
+ if (VCONFKEY_WIFI_QS_WIFI_CONNECTED == syspopup_app_state->connection_result)
+ INFO_LOG(SP_NAME_NORMAL, "Result : WIFI");
+ else if (VCONFKEY_WIFI_QS_3G == syspopup_app_state->connection_result)
+ INFO_LOG(SP_NAME_NORMAL, "Result : 3G");
+ else {
+ WARN_LOG(SP_NAME_NORMAL, "Result : ?? [%d]", syspopup_app_state->connection_result);
+ syspopup_app_state->connection_result = VCONFKEY_WIFI_QS_3G;
+ }
+
+ common_util_set_system_registry("memory/wifi/wifi_qs_exit",
+ syspopup_app_state->connection_result);
+
+ elm_exit();
+
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+}
+
+static void _exit_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __COMMON_FUNC_ENTER__;
+ wifi_syspopup_exit();
+ __COMMON_FUNC_EXIT__;
+}
+
+int wifi_syspopup_destroy(void)
+{
+ if (syspopup_app_state->passpopup) {
+ common_pswd_popup_destroy(syspopup_app_state->passpopup);
+ syspopup_app_state->passpopup = NULL;
+ }
+
+ if (syspopup_app_state->syspopup) {
+ evas_object_del(syspopup_app_state->syspopup);
+ syspopup_app_state->syspopup = NULL;
+ }
+
+ if (syspopup_app_state->layout_main) {
+ evas_object_del(syspopup_app_state->layout_main);
+ syspopup_app_state->layout_main = NULL;
+ }
+
+ if (syspopup_app_state->conformant) {
+ evas_object_del(syspopup_app_state->conformant);
+ syspopup_app_state->conformant = NULL;
+ }
+
+ if (syspopup_app_state->win_main) {
+ evas_object_del(syspopup_app_state->win_main);
+ syspopup_app_state->win_main = NULL;
+ }
+
+ wifi_syspopup_exit();
+
+ return TRUE;
+}
+
+int wifi_syspopup_create(void)
+{
+ __COMMON_FUNC_ENTER__;
+ int rotate_angle;
+ int visible_area_height;
+ int visible_area_width;
+
+ if (NULL == syspopup_app_state->syspopup) {
+ syspopup_app_state->syspopup = elm_popup_add(syspopup_app_state->layout_main);
+ elm_object_content_set(syspopup_app_state->layout_main, syspopup_app_state->syspopup);
+ assertm_if(NULL == syspopup_app_state->syspopup, "syspopup is NULL!!");
+ }
+ elm_object_style_set(syspopup_app_state->syspopup,"min_menustyle");
+ elm_object_part_text_set(syspopup_app_state->syspopup, "title,text", sc(PACKAGE, I18N_TYPE_WiFi_network));
+ evas_object_size_hint_weight_set(syspopup_app_state->syspopup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ Evas_Object *btn_cancel = elm_button_add(syspopup_app_state->syspopup);
+ elm_object_text_set(btn_cancel, sc(PACKAGE, I18N_TYPE_Cancel));
+ elm_object_part_content_set(syspopup_app_state->syspopup, "button1", btn_cancel);
+ evas_object_smart_callback_add(btn_cancel, "clicked", _exit_cb, NULL);
+
+ /* Create and add a box into the layout. */
+ Evas_Object *box = elm_box_add(syspopup_app_state->syspopup);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ Evas_Object *main_list = view_main_create(box);
+ elm_box_pack_end(box, main_list);
+ evas_object_show(main_list);
+
+ rotate_angle = __x_rotation_get(ecore_x_display_get(), elm_win_xwindow_get(syspopup_app_state->win_main));
+ if (rotate_angle < 0)
+ rotate_angle = 0;
+
+ ecore_x_icccm_hints_set(elm_win_xwindow_get(syspopup_app_state->win_main), 1, 0, 0, 0, 0, 0, 0);
+
+ elm_win_rotation_with_resize_set(syspopup_app_state->win_main, rotate_angle);
+
+ __common_popup_size_set(NULL ,&visible_area_width, &visible_area_height, rotate_angle);
+ evas_object_size_hint_min_set(box, visible_area_width * elm_config_scale_get(), visible_area_height * elm_config_scale_get());
+
+ elm_object_content_set(syspopup_app_state->syspopup, box);
+ evas_object_show(syspopup_app_state->syspopup);
+ evas_object_show(syspopup_app_state->win_main);
+
+ memset(&g_pending_call, 0, sizeof(wifi_pending_call_info_t));
+
+ __COMMON_FUNC_EXIT__;
+
+ return TRUE;
+}
+
+int wifi_syspopup_init()
+{
+ __COMMON_FUNC_ENTER__;
+
+ int wlan_ret;
+ bool activated = FALSE;
+
+ wlan_manager_create();
+ wlan_manager_set_message_callback(wlan_engine_callback);
+ wlan_manager_set_refresh_callback(wlan_engine_refresh_callback);
+
+ wlan_ret = wlan_manager_start(NULL);
+ switch (wlan_ret) {
+ case WLAN_MANAGER_ERR_NONE:
+ wlan_ret = wifi_is_activated (&activated);
+ if (WIFI_ERROR_NONE != wlan_ret) {
+ ERROR_LOG(UG_NAME_ERR, "Failed to get the Wi-Fi State. Return error = %d", wlan_ret);
+ return WLAN_MANAGER_ERR_UNKNOWN;
+ }
+
+ if (activated) {
+ INFO_LOG(UG_NAME_NORMAL, "WiFi is activated");
+ if (connman_request_scan_mode_set(WIFI_BGSCAN_MODE_PERIODIC) == WLAN_MANAGER_ERR_NONE) {
+ INFO_LOG(SP_NAME_NORMAL, "Set BG scan mode - PERIODIC");
+ }
+ }
+ INFO_LOG(SP_NAME_NORMAL, "wlan_manager start complete" );
+ break;
+
+ case WLAN_MANAGER_ERR_ALREADY_REGISTERED:
+ ERROR_LOG(SP_NAME_ERR, "Already registered.");
+ break;
+
+ case WLAN_MANAGER_ERR_UNKNOWN:
+ ERROR_LOG(SP_NAME_ERR, "wlan fail communication." );
+ break;
+
+ default:
+ ERROR_LOG(SP_NAME_ERR, "wlan_manager start fail ret[%d]", wlan_ret );
+ break;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return wlan_ret;
+}
+
+static int syspopup_support_set(const char* support) {
+ __COMMON_FUNC_ENTER__;
+ if(NULL == support) {
+ __COMMON_FUNC_EXIT__;
+ return FALSE;
+ }
+
+ if(strcmp("WIFI_SYSPOPUP_SUPPORT_QUICKPANEL",support) == 0) {
+ syspopup_app_state->wifi_syspopup_support = WIFI_SYSPOPUP_SUPPORT_QUICKPANEL;
+ } else {
+ __COMMON_FUNC_EXIT__;
+ return FALSE;
+ }
+ __COMMON_FUNC_EXIT__;
+
+ return TRUE;
+}
+
+static int _power_on_check(void)
+{
+ int connection_state = wlan_manager_state_get();
+ switch (connection_state) {
+ case WLAN_MANAGER_OFF:
+ INFO_LOG(SP_NAME_NORMAL, "current state is wifi-off");
+ int wlan_ret = wlan_manager_request_power_on();
+ if (wlan_ret == WLAN_MANAGER_ERR_NONE) {
+ view_alerts_powering_on_show();
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+ } else if (wlan_ret == WLAN_MANAGER_ERR_MOBILE_HOTSPOT_OCCUPIED) {
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+ } else {
+ __COMMON_FUNC_EXIT__;
+ return FALSE;
+ }
+ break;
+ case WLAN_MANAGER_UNCONNECTED:
+ case WLAN_MANAGER_CONNECTING:
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+ case WLAN_MANAGER_CONNECTED:
+ ERROR_LOG(SP_NAME_NORMAL, "current state is wifi-connected");
+ __COMMON_FUNC_EXIT__;
+ return FALSE;
+ case WLAN_MANAGER_ERROR:
+ ERROR_LOG(SP_NAME_NORMAL, "current state is wifi error");
+ __COMMON_FUNC_EXIT__;
+ return FALSE;
+ default:
+ ERROR_LOG(SP_NAME_NORMAL, "current state is wifi etc");
+ __COMMON_FUNC_EXIT__;
+ return FALSE;
+ }
+
+ __COMMON_FUNC_EXIT__;
+ return TRUE;
+}
+
+static Eina_Bool __wifi_syspopup_del_found_ap_noti(void *data)
+{
+ common_utils_send_message_to_net_popup(NULL, NULL, "del_found_ap_noti", NULL);
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static int app_reset(bundle *b, void *data)
+{
+ __COMMON_FUNC_ENTER__;
+
+ Evas_Object *win_main = NULL;
+ Evas *evas = NULL;
+ int ret = 0;
+ int w, h = 0;
+
+ assertm_if(NULL == data, "data param is NULL!!");
+ assertm_if(NULL == b, "bundle is NULL!!");
+
+ /* Remove the "WiFi networks found" from the notification tray.*/
+ ecore_idler_add(__wifi_syspopup_del_found_ap_noti, NULL);
+
+ if (syspopup_has_popup(b)) {
+ INFO_LOG(SP_NAME_NORMAL, "Wi-Fi Syspopup is already launched. So, no more.");
+ syspopup_reset(b);
+ } else {
+ win_main = appcore_create_win(PACKAGE);
+ assertm_if(NULL == win_main, "win_main is NULL!!");
+ evas = evas_object_evas_get(win_main);
+ assertm_if(NULL == evas, "evas is NULL!!");
+
+ syspopup_app_state = data;
+ syspopup_app_state->win_main = win_main;
+ syspopup_app_state->evas = evas;
+ syspopup_app_state->b = bundle_dup(b);
+
+ elm_win_alpha_set(syspopup_app_state->win_main, EINA_TRUE); /* invisible window */
+ elm_win_borderless_set(syspopup_app_state->win_main, EINA_TRUE); /* No borders */
+ elm_win_conformant_set(syspopup_app_state->win_main, TRUE); /* Popup autoscroll */
+
+ Evas_Object *conformant = elm_conformant_add(syspopup_app_state->win_main);
+ elm_win_conformant_set(syspopup_app_state->win_main, EINA_TRUE);
+ elm_win_resize_object_add(syspopup_app_state->win_main, conformant);
+ evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(conformant);
+ syspopup_app_state->conformant = conformant;
+
+ Evas_Object *layout = elm_layout_add(conformant);
+ elm_object_content_set(conformant, layout);
+ syspopup_app_state->layout_main = layout;
+
+ const char* is_onoff = bundle_get_val(b, "-t");
+
+ if (is_onoff != NULL) {
+ INFO_LOG(SP_NAME_NORMAL, "is_onoff [%s]", is_onoff);
+
+ syspopup_app_state->syspopup_type = WIFI_SYSPOPUP_WITHOUT_AP_LIST;
+ int wlan_ret = wifi_syspopup_init();
+
+ if (WLAN_MANAGER_ERR_NONE != wlan_ret) {
+ INFO_LOG(SP_NAME_ERR, "wifi_syspopup_init failed. wlan_ret = %d", wlan_ret);
+ } else if (strcmp(is_onoff, "on") == 0) {
+ INFO_LOG(SP_NAME_NORMAL, "request power on");
+ ret = wlan_manager_request_power_on();
+ INFO_LOG(SP_NAME_NORMAL, "* ret [%d]", ret);
+ } else if (strcmp(is_onoff, "off") == 0) {
+ INFO_LOG(SP_NAME_NORMAL, "request power off");
+ ret = wlan_manager_request_power_off();
+ INFO_LOG(SP_NAME_NORMAL, "* ret [%d]", ret);
+ }
+
+ wifi_syspopup_destroy();
+ return 0;
+ } else {
+ syspopup_app_state->syspopup_type = WIFI_SYSPOPUP_WITH_AP_LIST;
+ int wlan_ret = wifi_syspopup_init();
+ if (WLAN_MANAGER_ERR_NONE != wlan_ret || _power_on_check() == FALSE) {
+ wifi_syspopup_destroy();
+ __COMMON_FUNC_EXIT__;
+ return 0;
+ }
+ }
+
+ syspopup_app_state->syspopup = elm_popup_add(syspopup_app_state->win_main);
+ ret = syspopup_create(b, &handler, syspopup_app_state->win_main, syspopup_app_state);
+ if(ret != 0){
+ ERROR_LOG(SP_NAME_ERR, "Syspopup create error!! return [%d]", ret );
+
+ wlan_manager_destroy();
+
+ __COMMON_FUNC_EXIT__;
+ elm_exit();
+
+ return 0;
+ } else {
+ const char* support = bundle_get_val(b, "[Wi-Fi_syspopup wifi_syspopup_supports:support]");
+ if(NULL != support) {
+ syspopup_support_set(support);
+ }
+
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+
+ wifi_syspopup_create();
+ wlan_manager_scanned_profile_refresh_with_count(MAX_INITIAL_QS_POPUP_LIST_SIZE);
+ ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, __rotate, (void *)syspopup_app_state);
+
+ }
+ }
+ __COMMON_FUNC_EXIT__;
+
+ return 0;
+}
+
+static int app_init(void *data)
+{
+ __COMMON_FUNC_ENTER__;
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ __COMMON_FUNC_EXIT__;
+
+ return 0;
+}
+
+static int app_exit(void *data)
+{
+ __COMMON_FUNC_ENTER__;
+ wlan_manager_destroy();
+ __COMMON_FUNC_EXIT__;
+
+ return 0;
+}
+
+static int app_start(void *data)
+{
+ __COMMON_FUNC_ENTER__;
+ if (connman_request_scan_mode_set(WIFI_BGSCAN_MODE_PERIODIC) == WLAN_MANAGER_ERR_NONE) {
+ INFO_LOG(SP_NAME_NORMAL, "Set BG scan mode - PERIODIC");
+ }
+ __COMMON_FUNC_EXIT__;
+
+ return 0;
+}
+
+static int app_stop(void *data)
+{
+ __COMMON_FUNC_ENTER__;
+ if (connman_request_scan_mode_set(WIFI_BGSCAN_MODE_EXPONENTIAL) == WLAN_MANAGER_ERR_NONE) {
+ INFO_LOG(SP_NAME_NORMAL, "Set BG scan mode - EXPONENTIAL");
+ }
+ __COMMON_FUNC_EXIT__;
+
+ return 0;
+}
+
+int main(int argc, char* argv[])
+{
+ __COMMON_FUNC_ENTER__;
+ INFO_LOG( SP_NAME_NORMAL, "argc [%d]", argc);
+
+ wifi_object ad;
+ memset(&ad, 0x0, sizeof(wifi_object));
+
+ ad.connection_result = VCONFKEY_WIFI_QS_3G;
+ ad.win_main = NULL;
+ ad.evas = NULL;
+ ad.b = NULL;
+ ad.syspopup = NULL;
+ ad.passpopup = NULL;
+ ad.alertpopup = NULL;
+
+ struct appcore_ops ops = {
+ .create = app_init,
+ .terminate = app_exit,
+ .pause = app_stop,
+ .resume = app_start,
+ .reset = app_reset,
+ };
+
+ ops.data = &ad;
+
+ __COMMON_FUNC_EXIT__;
+ return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
+}