4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.1 (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://floralicense.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.
24 #include <ui-gadget-module.h>
25 #include <tethering.h>
26 #include <wifi-direct.h>
28 #define PACKAGE "ug-setting-wifidirect-efl"
29 #define LOCALEDIR "/usr/ug/res/locale"
30 #define VCONF_WFD_APNAME "db/setting/device_name"
36 #define LOG_TAG "UG_WIFI_DIRECT"
38 #define WDUG_LOGV(format, args...) LOGV(format, ##args)
39 #define WDUG_LOGD(format, args...) LOGD(format, ##args)
40 #define WDUG_LOGI(format, args...) LOGI(format, ##args)
41 #define WDUG_LOGW(format, args...) LOGW(format, ##args)
42 #define WDUG_LOGE(format, args...) LOGE(format, ##args)
43 #define WDUG_LOGF(format, args...) LOGF(format, ##args)
45 #define __WDUG_LOG_FUNC_ENTER__ LOGV("Enter")
46 #define __WDUG_LOG_FUNC_EXIT__ LOGV("Quit")
48 #define assertm_if(expr, fmt, args...) do { \
50 WDUG_LOGF(" ##(%s) -> assert!!## "fmt, #expr, ##args); \
55 #else /** _DLOG_UTIL */
57 #define WDUG_LOGV(format, args...)
58 #define WDUG_LOGD(format, args...)
59 #define WDUG_LOGI(format, args...)
60 #define WDUG_LOGW(format, args...)
61 #define WDUG_LOGE(format, args...)
62 #define WDUG_LOGF(format, args...)
64 #define __WDUG_LOG_FUNC_ENTER__
65 #define __WDUG_LOG_FUNC_EXIT__
67 #endif /** _DLOG_UTIL */
69 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
70 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
72 #define AP_NAME_LENGTH_MAX 32
73 #define AP_PASSWORD_LENGTH_MAX 64
74 #define AP_PASSWORD_LENGTH_MIN 8
75 #define AP_REJECT_CHAR_LIST "=,"
77 #define DEFAULT_DEV_NAME "Tizen"
79 #define SSID_LENGTH 32
80 #define MAX_PEER_NUM 10
81 #define MAX_POPUP_PEER_NUM 7
82 #define MAX_POPUP_TEXT_SIZE 256
83 #define MAX_DISPLAY_TIME_OUT 30
84 #define MAX_NO_ACTION_TIME_OUT 300 /*5min*/
85 #define MAX_SCAN_TIME_OUT 30
87 #define _(s) dgettext(PACKAGE, s)
88 #define N_(s) dgettext_noop(s)
89 #define S_(s) dgettext("sys_string", s)
92 /* To-Do : Text should be translated. */
93 #define IDS_WFD_POP_SCAN_AGAIN "Current connection will be disconnected so that scanning can start.Continue?"
94 #define IDS_WFD_POP_WARN_BUSY_DEVICE "Unavailable device. Device is connected to another device."
95 #define IDS_WFD_POP_AUTOMATIC_TURN_OFF "There has been no activity for 5 minutes since Wi-Fi Direct was enabled. To extend battery life, Wi-Fi Direct has been disabled."
96 #define IDS_WFD_BODY_FAILED_DEVICES "Failed Devices"
97 #define IDS_WFD_TITLE_ABOUT_WIFI_DIRECT "About Wi-Fi Direct"
101 #define WFD_GLOBALIZATION_STR_LENGTH 256
104 WFD_MULTI_CONNECT_MODE_NONE,
105 WFD_MULTI_CONNECT_MODE_IN_PROGRESS,
106 WFD_MULTI_CONNECT_MODE_COMPLETED,
107 } wfd_multi_connect_mode_e;
110 PEER_CONN_STATUS_DISCONNECTED,
111 PEER_CONN_STATUS_DISCONNECTING,
112 PEER_CONN_STATUS_CONNECTING = PEER_CONN_STATUS_DISCONNECTING,
113 PEER_CONN_STATUS_CONNECTED,
114 PEER_CONN_STATUS_FAILED_TO_CONNECT,
115 PEER_CONN_STATUS_WAIT_FOR_CONNECT,
120 char ssid[SSID_LENGTH];
121 unsigned int category;
122 char mac_addr[MAC_LENGTH];
123 char if_addr[MAC_LENGTH];
124 conn_status_e conn_status;
125 bool is_group_owner; /** Is an active P2P Group Owner */
126 bool is_persistent_group_owner; /** Is a stored Persistent GO */
127 bool is_connected; /** Is peer connected*/
128 Elm_Object_Item *gl_item;
134 } wfd_multi_sel_data_s;
142 Evas_Object *naviframe;
143 Evas_Object *genlist;
144 Evas_Object *multiconn_view_genlist;
146 Evas_Object *act_popup;
147 Evas_Object *warn_popup;
149 Elm_Object_Item *head;
150 Evas_Object *scan_btn;
151 Evas_Object *multi_scan_btn;
152 Evas_Object *multi_connect_btn;
154 Elm_Object_Item *nodevice_title_item;
155 Elm_Object_Item *nodevice_item;
157 Elm_Object_Item *about_wfd_item;
158 Elm_Object_Item *about_wfd_sep_high_item;
159 Elm_Object_Item *about_wfd_sep_low_item;
161 Elm_Object_Item *conn_wfd_item;
162 Elm_Object_Item *conn_failed_wfd_item;
163 Elm_Object_Item *avlbl_wfd_item;
164 Elm_Object_Item *busy_wfd_item;
165 Elm_Object_Item *multi_connect_wfd_item;
167 Elm_Object_Item *multi_button_item;
168 Elm_Object_Item *multi_button_sep_item;
170 Elm_Object_Item *mcview_select_all_item;
171 Elm_Object_Item *mcview_title_item;
172 Elm_Object_Item *mcview_nodevice_item;
174 Evas_Object *back_btn;
175 Evas_Object *multi_btn;
179 Evas_Object *notify_layout;
184 device_type_s raw_connected_peers[MAX_PEER_NUM];
185 int raw_connected_peer_cnt;
186 device_type_s raw_discovered_peers[MAX_PEER_NUM];
187 int raw_discovered_peer_cnt;
189 // Peer data in the Genlist
190 device_type_s gl_connected_peers[MAX_PEER_NUM];
191 int gl_connected_peer_cnt;
193 device_type_s gl_connected_failed_peers[MAX_PEER_NUM];
194 int gl_connected_failed_peer_cnt;
196 device_type_s gl_available_peers[MAX_PEER_NUM];
197 int gl_available_peer_cnt;
199 device_type_s gl_busy_peers[MAX_PEER_NUM];
200 int gl_busy_peer_cnt;
202 device_type_s raw_multi_selected_peers[MAX_PEER_NUM];
203 int raw_multi_selected_peer_cnt;
205 device_type_s gl_multi_connect_peers[MAX_PEER_NUM];
206 int gl_multi_connect_peer_cnt;
209 bool I_am_group_owner;
212 // Following variables are used at the Multi connect view.
213 wfd_multi_connect_mode_e multi_connect_mode;
214 wfd_multi_sel_data_s multi_conn_dev_list[MAX_PEER_NUM];
215 int gl_available_dev_cnt_at_multiconn_view;
216 int g_source_multi_connect_next;
219 wifi_direct_state_e wfd_status;
223 // For connect failed peers
224 int last_display_time;
225 Ecore_Timer *display_timer;
229 tethering_h hotspot_handle;
231 // Used for automatic turn off
234 Ecore_Timer *monitor_timer;
236 // Re-discover or not
240 extern Elm_Gen_Item_Class head_itc;
241 extern Elm_Gen_Item_Class name_itc;
242 extern Elm_Gen_Item_Class title_itc;
243 extern Elm_Gen_Item_Class peer_itc;
244 extern Elm_Gen_Item_Class noitem_itc;
245 extern Elm_Gen_Item_Class button_itc;
247 extern Elm_Gen_Item_Class title_conn_itc;
248 extern Elm_Gen_Item_Class peer_conn_itc;
250 extern Elm_Gen_Item_Class title_busy_itc;
251 extern Elm_Gen_Item_Class peer_busy_itc;
253 extern Elm_Gen_Item_Class title_multi_connect_itc;
254 extern Elm_Gen_Item_Class peer_multi_connect_itc;
256 extern Elm_Gen_Item_Class title_conn_failed_itc;
257 extern Elm_Gen_Item_Class peer_conn_failed_itc;
260 #endif /* __WFD_UG_H__ */