4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.tizenopensource.org/license
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
25 #include <ui-gadget-module.h>
26 #include <tethering.h>
28 #define PACKAGE "ug-setting-wifidirect-efl"
29 #define LOCALEDIR "/opt/ug/res/locale"
31 #define DIRECT_TAG "wfd_ug"
32 #define DBG(log_level, format, args...) \
33 LOG(log_level, DIRECT_TAG, "[%s()][%d] " format, __FUNCTION__, __LINE__, ##args)
35 #define __FUNC_ENTER__ DBG(LOG_VERBOSE, "+\n")
36 #define __FUNC_EXIT__ DBG(LOG_VERBOSE, "-\n")
38 #define VCONF_WFD_APNAME "db/setting/device_name"
40 #define assertm_if(expr, fmt, arg...) do { \
42 DBG(LOG_VERBOSE, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \
45 } while (0) // retvm if
47 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
48 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
50 #define AP_NAME_LENGTH_MAX 32 //allowed lenght is 31 + '\0'
51 #define AP_PASSWORD_LENGTH_MAX 64 //allowed lenght is 63 + '\0'
52 #define AP_PASSWORD_LENGTH_MIN 8 //min limit
53 #define AP_REJECT_CHAR_LIST "=,"
55 #define DEFAULT_DEV_NAME "GT_I9500"
57 #define SSID_LENGTH 32
58 #define MAX_PEER_NUM 10
59 #define MAX_POPUP_PEER_NUM 7
60 #define MAX_POPUP_TEXT_SIZE 256
61 #define MAX_DISPLAY_TIME_OUT 30
63 #define _(s) dgettext(PACKAGE, s)
64 #define N_(s) dgettext_noop(s)
65 #define S_(s) dgettext("sys_string", s)
68 #if 1 //To-Do : Text should be translated.
70 #define IDS_WFD_POP_SCAN_AGAIN "To start new scanning,<br>current connection will be<br>ended.Continue?"
71 #define IDS_WFD_POP_WARN_BUSY_DEVICE "Unavailable device. Device is connected to another device."
72 #define IDS_WFD_BODY_FAILED_DEVICES "Failed Devices"
77 #define WFD_GLOBALIZATION_STR_LENGTH 256
80 WFD_MULTI_CONNECT_MODE_NONE,
81 WFD_MULTI_CONNECT_MODE_IN_PROGRESS,
82 WFD_MULTI_CONNECT_MODE_COMPLETED,
83 } wfd_multi_connect_mode_e;
87 PEER_CONN_STATUS_DISCONNECTED,
88 PEER_CONN_STATUS_DISCONNECTING,
89 PEER_CONN_STATUS_CONNECTING = PEER_CONN_STATUS_DISCONNECTING,
90 PEER_CONN_STATUS_CONNECTED,
91 PEER_CONN_STATUS_FAILED_TO_CONNECT,
92 PEER_CONN_STATUS_WAIT_FOR_CONNECT,
98 char ssid[SSID_LENGTH]; // 31 + 1('\0')
99 unsigned int category;
100 char mac_addr[MAC_LENGTH];
101 char if_addr[MAC_LENGTH];
102 conn_status_e conn_status;
103 bool is_group_owner; /** Is an active P2P Group Owner */
104 bool is_persistent_group_owner; /** Is a stored Persistent GO */
105 bool is_connected; /** Is peer connected*/
106 Elm_Object_Item *gl_item;
113 } wfd_multi_sel_data_s;
122 Evas_Object *naviframe;
123 Evas_Object *genlist;
124 Evas_Object *multiconn_view_genlist;
126 Evas_Object *act_popup;
127 Evas_Object *warn_popup;
129 Elm_Object_Item *head;
130 Elm_Object_Item *scan_btn;
131 Elm_Object_Item *multi_scan_btn;
132 Elm_Object_Item *multi_connect_btn;
134 Elm_Object_Item *nodevice_title_item;
135 Elm_Object_Item *nodevice_item;
136 Elm_Object_Item *nodevice_sep_low_item;
138 Elm_Object_Item *about_wfd_item;
139 Elm_Object_Item *about_wfdsp_sep_end_item;
141 Elm_Object_Item *conn_wfd_item;
143 Elm_Object_Item *conn_failed_wfd_item;
144 Elm_Object_Item *conn_failed_wfd_sep_item;
146 Elm_Object_Item *avlbl_wfd_item;
148 Elm_Object_Item *busy_wfd_item;
149 Elm_Object_Item *busy_wfd_sep_item;
151 Elm_Object_Item *multi_connect_wfd_item;
153 Elm_Object_Item *multi_button_item;
154 Elm_Object_Item *multi_button_sep_high_item;
155 Elm_Object_Item *multi_button_sep_low_item;
158 Elm_Object_Item *mcview_select_all_item;
159 Elm_Object_Item *mcview_title_item;
160 Elm_Object_Item *mcview_nodevice_item;
163 Evas_Object *multi_btn;
168 device_type_s raw_connected_peers[MAX_PEER_NUM];
169 int raw_connected_peer_cnt;
170 device_type_s raw_discovered_peers[MAX_PEER_NUM];
171 int raw_discovered_peer_cnt;
173 // Peer data in the Genlist
174 device_type_s gl_connected_peers[MAX_PEER_NUM];
175 int gl_connected_peer_cnt;
177 device_type_s gl_connected_failed_peers[MAX_PEER_NUM];
178 int gl_connected_failed_peer_cnt;
180 device_type_s gl_available_peers[MAX_PEER_NUM];
181 int gl_available_peer_cnt;
183 device_type_s gl_busy_peers[MAX_PEER_NUM];
184 int gl_busy_peer_cnt;
186 device_type_s raw_multi_selected_peers[MAX_PEER_NUM];
187 int raw_multi_selected_peer_cnt;
189 device_type_s gl_multi_connect_peers[MAX_PEER_NUM];
190 int gl_multi_connect_peer_cnt;
193 bool I_am_group_owner;
196 // Following variables are used at the Multi connect view.
197 wfd_multi_connect_mode_e multi_connect_mode;
198 wfd_multi_sel_data_s multi_conn_dev_list[MAX_PEER_NUM];
199 int gl_available_dev_cnt_at_multiconn_view;
200 int g_source_multi_connect_next;
207 // For connect failed peers
208 int last_display_time;
209 Ecore_Timer *display_timer;
212 tethering_h hotspot_handle;
216 extern Elm_Gen_Item_Class sep_itc;
217 extern Elm_Gen_Item_Class sep_itc_end;
218 extern Elm_Gen_Item_Class head_itc;
219 extern Elm_Gen_Item_Class name_itc;
220 extern Elm_Gen_Item_Class title_itc;
221 extern Elm_Gen_Item_Class peer_itc;
222 extern Elm_Gen_Item_Class noitem_itc;
223 extern Elm_Gen_Item_Class help_itc;
224 extern Elm_Gen_Item_Class button_itc;
226 extern Elm_Gen_Item_Class title_conn_itc;
227 extern Elm_Gen_Item_Class peer_conn_itc;
229 extern Elm_Gen_Item_Class title_busy_itc;
230 extern Elm_Gen_Item_Class peer_busy_itc;
232 extern Elm_Gen_Item_Class title_multi_connect_itc;
233 extern Elm_Gen_Item_Class peer_multi_connect_itc;
235 extern Elm_Gen_Item_Class title_conn_failed_itc;
236 extern Elm_Gen_Item_Class peer_conn_failed_itc;
239 #endif /* __WFD_UG_H__ */