fixed text bug
[apps/home/ug-wifi-direct.git] / ug-wifidirect / include / wfd_ug.h
1 /*
2 *  WiFi-Direct UG
3 *
4 * Copyright 2012  Samsung Electronics Co., Ltd
5
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
9
10 * http://www.tizenopensource.org/license
11
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.
17 *
18 */
19
20
21 #ifndef __WFD_UG_H__
22 #define __WFD_UG_H__
23
24 #include <dlog.h>
25 #include <ui-gadget-module.h>
26 #include <tethering.h>
27
28 #define PACKAGE "ug-setting-wifidirect-efl"
29 #define LOCALEDIR "/opt/ug/res/locale"
30
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)
34
35 #define __FUNC_ENTER__  DBG(LOG_VERBOSE, "+\n")
36 #define __FUNC_EXIT__   DBG(LOG_VERBOSE, "-\n")
37
38 #define VCONF_WFD_APNAME                        "db/setting/device_name"
39
40 #define assertm_if(expr, fmt, arg...) do { \
41    if(expr) { \
42           DBG(LOG_VERBOSE, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \
43                  assert(1); \
44    } \
45 } while (0)                     // retvm if
46
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"
49
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             "=,"
54
55 #define DEFAULT_DEV_NAME        "GT_I9500"
56 #define MAC_LENGTH  18
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
62
63 #define _(s)        dgettext(PACKAGE, s)
64 #define N_(s)      dgettext_noop(s)
65 #define S_(s)      dgettext("sys_string", s)
66
67
68 #if 1   //To-Do : Text should be translated.
69
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"
73  
74 #endif
75
76
77 #define WFD_GLOBALIZATION_STR_LENGTH 256
78
79 typedef enum {
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;
84
85 typedef enum
86 {
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,
93 } conn_status_e;
94
95
96 typedef struct
97 {
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;
107 } device_type_s;
108
109 typedef struct
110 {
111     bool dev_sel_state;
112     device_type_s peer;
113 } wfd_multi_sel_data_s;
114
115 struct ug_data
116 {
117     Evas_Object *base;
118     ui_gadget_h ug;
119
120     Evas_Object *win;
121     Evas_Object *bg;
122     Evas_Object *naviframe;
123     Evas_Object *genlist;
124     Evas_Object *multiconn_view_genlist;
125     Evas_Object *popup;
126     Evas_Object *act_popup;
127     Evas_Object *warn_popup;
128
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;
133
134     Elm_Object_Item *nodevice_title_item;
135     Elm_Object_Item *nodevice_item;
136     Elm_Object_Item *nodevice_sep_low_item;
137
138     Elm_Object_Item *about_wfd_item;
139     Elm_Object_Item *about_wfdsp_sep_end_item;
140
141     Elm_Object_Item *conn_wfd_item;
142
143     Elm_Object_Item *conn_failed_wfd_item;
144     Elm_Object_Item *conn_failed_wfd_sep_item;
145
146     Elm_Object_Item *avlbl_wfd_item;
147
148     Elm_Object_Item *busy_wfd_item;
149     Elm_Object_Item *busy_wfd_sep_item;
150
151     Elm_Object_Item *multi_connect_wfd_item;
152
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;
156
157
158     Elm_Object_Item *mcview_select_all_item;
159     Elm_Object_Item *mcview_title_item;
160     Elm_Object_Item *mcview_nodevice_item;
161
162
163     Evas_Object *multi_btn;
164
165     int head_text_mode;
166
167     // Raw peer data
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;
172
173     // Peer data in the Genlist
174     device_type_s gl_connected_peers[MAX_PEER_NUM];
175     int gl_connected_peer_cnt;
176
177     device_type_s gl_connected_failed_peers[MAX_PEER_NUM];
178     int gl_connected_failed_peer_cnt;
179
180     device_type_s gl_available_peers[MAX_PEER_NUM];
181     int gl_available_peer_cnt;
182
183     device_type_s gl_busy_peers[MAX_PEER_NUM];
184     int gl_busy_peer_cnt;
185
186     device_type_s raw_multi_selected_peers[MAX_PEER_NUM];
187     int raw_multi_selected_peer_cnt;
188
189     device_type_s gl_multi_connect_peers[MAX_PEER_NUM];
190     int gl_multi_connect_peer_cnt;
191
192     // My status
193     bool I_am_group_owner;
194     bool I_am_connected;
195
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;
201
202     int wfd_onoff;
203     int wfd_status;
204     char *dev_name;
205     char *dev_pass;
206
207     // For connect failed peers
208     int last_display_time;
209     Ecore_Timer *display_timer;
210
211     //tethering
212     tethering_h hotspot_handle;
213     
214 };
215
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;
225
226 extern Elm_Gen_Item_Class title_conn_itc;
227 extern Elm_Gen_Item_Class peer_conn_itc;
228
229 extern Elm_Gen_Item_Class title_busy_itc;
230 extern Elm_Gen_Item_Class peer_busy_itc;
231
232 extern Elm_Gen_Item_Class title_multi_connect_itc;
233 extern Elm_Gen_Item_Class peer_multi_connect_itc;
234
235 extern Elm_Gen_Item_Class title_conn_failed_itc;
236 extern Elm_Gen_Item_Class peer_conn_failed_itc;
237
238
239 #endif  /* __WFD_UG_H__ */