Tizen directory path migration
[apps/native/ug-wifi-direct.git] / ug-wifidirect / include / wfd_ug_view.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 #ifndef __WFD_UG_VIEW_H__
21 #define __WFD_UG_VIEW_H__
22
23 #include <glib.h>
24
25 #define EDJDIR "/usr/apps/ug-setting-wifidirect-efl/res/edje/ug-setting-wifidirect-efl"
26 #define WFD_UG_EDJ_PATH  EDJDIR"/wfd_ug.edj"
27
28 /* Genlist new style for Tizen 2.4 */
29 #define WFD_GENLIST_1LINE_TEXT_STYLE "type1"
30 #define WFD_GENLIST_1LINE_TEXT_ICON_STYLE "type1"
31 #define WFD_GENLIST_2LINE_TOP_TEXT_STYLE "type1"
32 #define WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE "type1"
33 #define WFD_GENLIST_2LINE_BOTTOM_TEXT_STYLE "type2"
34 #define WFD_GENLIST_2LINE_BOTTOM_TEXT_ICON_STYLE "type2"
35 #define WFD_GENLIST_MULTILINE_TEXT_STYLE "multiline"
36 #define WFD_GENLIST_GROUP_INDEX_STYLE "group_index"
37
38 /* Define icons */
39 #define WFD_ICON_DEVICE_COMPUTER                        "A09_device_computer.png"
40 #define WFD_ICON_DEVICE_INPUT_DEVICE            "A09_device_input_device.png"
41 #define WFD_ICON_DEVICE_PRINTER                         "A09_device_printer.png"
42 #define WFD_ICON_DEVICE_CAMERA                          "A09_device_camera.png"
43 #define WFD_ICON_DEVICE_STORAGE                         "A09_device_storage.png"
44 #define WFD_ICON_DEVICE_NETWORK_INFRA           "A09_device_network_infrastructure.png"
45 #define WFD_ICON_DEVICE_DISPLAY                         "A09_device_display.png"
46 #define WFD_ICON_DEVICE_MULTIMEDIA                      "A09_device_multimedia.png"
47 #define WFD_ICON_DEVICE_GAMING                          "A09_device_gaming.png"
48 #define WFD_ICON_DEVICE_TELEPHONE                       "A09_device_telephone.png"
49 #define WFD_ICON_DEVICE_HEADSET                         "A09_device_headset.png"
50 #define WFD_ICON_DEVICE_UNKNOWN                         "A09_device_unknown.png"
51 #define WFD_ICON_DEVICE_BD                                      "U04_device_BD.png"
52 #define WFD_ICON_DEVICE_DONGLE                          "U04_device_Dongle.png"
53 #define WFD_ICON_DEVICE_HOME_THEATER            "U04_device_Home_Theater.png"
54 #define WFD_ICON_DEVICE_STB                                     "U04_device_STB.png"
55
56 /* Not support */
57 #define WFD_ICON_DEVICE_HEADPHONE                       "A09_device_headphone.png"
58 #define WFD_ICON_DEVICE_MEDICAL                         "A09_device_Medical.png"
59 #define WFD_ICON_DEVICE_MOUSE                           "A09_device_mouse.png"
60
61 #define WFD_ICON_DEVICE_MORE_HELP                               "A09_popup_help.png"
62
63 enum {
64         HEAD_TEXT_TYPE_DIRECT,
65         HEAD_TEXT_TYPE_DEACTIVATING,
66         HEAD_TEXT_TYPE_ACTIVATING,
67         HEAD_TEXT_TYPE_ACTIVATED,
68 };
69
70 enum {
71         TITLE_CONTENT_TYPE_NONE,
72         TITLE_CONTENT_TYPE_SCANNING,
73         TITLE_CONTENT_TYPE_FOUND,
74 };
75
76
77 enum {
78         /* User confirm */
79 #ifndef MODEL_BUILD_FEATURE_WLAN_CONCURRENT_MODE
80         POPUP_TYPE_WIFI_OFF,
81 #endif
82
83         POPUP_TYPE_HOTSPOT_OFF = 1,
84
85         /* Activation */
86         POPUP_TYPE_ACTIVATE_FAIL,
87         POPUP_TYPE_ACTIVATE_FAIL_POLICY_RESTRICTS,
88         POPUP_TYPE_DEACTIVATE_FAIL,
89
90         /* Connection */
91         POPUP_TYPE_LINK_TIMEOUT,
92         POPUP_TYPE_AUTH_FAIL,
93         POPUP_TYPE_LINK_FAIL,
94         POPUP_TYPE_UNKNOWN_ERROR,
95
96         POPUP_TYPE_INFO,
97         POPUP_TYPE_TERMINATE,
98         POPUP_TYPE_TERMINATE_DEACTIVATE_FAIL,
99         POPUP_TYPE_TERMINATE_NOT_SUPPORT,
100
101         /* Disconnect */
102         POP_TYPE_DISCONNECT,
103
104         POP_TYPE_CANCEL_CONNECT,
105
106         POP_TYPE_ACCEPT_CONNECTION,
107
108         /* Scan again */
109         POP_TYPE_SCAN_AGAIN,
110
111         /* multi connect */
112         POP_TYPE_MULTI_CONNECT_POPUP,
113
114         /* Busy device */
115         POP_TYPE_BUSY_DEVICE_POPUP,
116
117         /* Automaticlly turn off */
118         POP_TYPE_AUTOMATIC_TURN_OFF,
119 };
120
121 struct ug_data *wfd_get_ug_data();
122
123 void scan_button_create(struct ug_data *ugd);
124
125 /**
126  *      This function let the ug create the main view
127  *      @return   void
128  *      @param[in] data the pointer to the main data structure
129  */
130 void create_wfd_ug_view(void *data);
131
132 /**
133  *      This function let the ug destroy the main view
134  *      @return   void
135  *      @param[in] data the pointer to the main data structure
136  */
137 void destroy_wfd_ug_view(void *data);
138
139 /**
140  *      This function let the ug update the genlist item
141  *      @return   void
142  *      @param[in] gl_item the pointer to genlist item
143  */
144 void wfd_ug_view_refresh_glitem(Elm_Object_Item *gl_item);
145
146 /**
147  *      This function let the ug refresh the attributes of button
148  *      @return   void
149  *      @param[in] tb_item the pointer to the toolbar button
150  *      @param[in] text the pointer to the text of button
151  *      @param[in] enable whether the button is disabled
152  */
153 void wfd_ug_view_refresh_button(Evas_Object *tb_item, const char *text,
154                 int enable);
155
156 /**
157  *      This function let the ug update the peers
158  *      @return   void
159  *      @param[in] data the pointer to the main data structure
160  */
161 void wfd_ug_view_update_peers(void *data);
162
163 /**
164  *      This function let the ug free the peers
165  *      @return   void
166  *      @param[in] data the pointer to the main data structure
167  */
168 void wfd_ug_view_free_peers(void *data);
169
170 /**
171  *      This function let the ug create a action popup
172  *      @return   void
173  *      @param[in] data the pointer to the main data structure
174  *      @param[in] message the pointer to the text of popup
175  *      @param[in] popup_type the message type
176  */
177 void wfd_ug_act_popup(void *data, const char *message, int popup_type);
178
179 /**
180  *      This function let the ug remove the action popup
181  *      @return   void
182  *      @param[in] data the pointer to the main data structure
183  */
184 void wfg_ug_act_popup_remove(void *data);
185
186 /**
187  *      This function let the ug create a warning popup
188  *      @return   void
189  *      @param[in] data the pointer to the main data structure
190  *      @param[in] message the pointer to the text of popup
191  *      @param[in] popup_type the message type
192  */
193 void wfd_ug_warn_popup(void *data, const char *message, int popup_type);
194
195 /**
196  *      This function let the ug create the view for multi connection
197  *      @return   void
198  *      @param[in] ugd the pointer to the main data structure
199  */
200 void _wifid_create_multiconnect_view(struct ug_data *ugd);
201
202 /**
203  *      This function let the ug call it when click 'back' button
204  *      @return   void
205  *      @param[in] data the pointer to the main data structure
206  *      @param[in] obj the pointer to the evas object
207  *      @param[in] event_info the pointer to the event information
208  */
209 Eina_Bool _back_btn_cb(void *data, Elm_Object_Item *it);
210
211 /**
212  *      This function let the ug call it when click 'scan' button
213  *      @return   void
214  *      @param[in] data the pointer to the main data structure
215  *      @param[in] obj the pointer to the evas object
216  *      @param[in] event_info the pointer to the event information
217  */
218 void _scan_btn_cb(void *data, Evas_Object * obj, void *event_info);
219
220 /**
221  *      This function let the ug call it when click 'disconnect' button
222  *      @return   void
223  *      @param[in] data the pointer to the main data structure
224  *      @param[in] obj the pointer to the evas object
225  *      @param[in] event_info the pointer to the event information
226  */
227 void _wfd_ug_disconnect_button_cb(void *data, Evas_Object *obj, void *event_info);
228
229 /**
230  *      This function let the ug call it when click "Cancel Connection" button
231  *      @return   void
232  *      @param[in] data the pointer to the main data structure
233  *      @param[in] obj the pointer to the evas object
234  *      @param[in] event_info the pointer to the event information
235  */
236 void _wfd_ug_cancel_connection_button_cb(void *data, Evas_Object *obj, void *event_info);
237
238 /**
239  *      This function let the ug get the found peers
240  *      @return   If success, return 0, else return -1
241  *      @param[in] ugd the pointer to the main data structure
242  */
243 int wfd_ug_get_discovered_peers(struct ug_data *ugd);
244
245 /**
246  *      This function let the ug get the connecting peer mac
247  *      @return   If success, return 0, else return -1
248  *      @param[in] ugd the pointer to the main data structure
249  */
250 int wfd_ug_get_connecting_peer(struct ug_data *ugd);
251
252 /**
253  *      This function let the ug get the connected peers
254  *      @return   If success, return 0, else return -1
255  *      @param[in] ugd the pointer to the main data structure
256  */
257 int wfd_ug_get_connected_peers(struct ug_data *ugd);
258
259 /**
260  *      This function let the ug get the device status
261  *      @return  If success, return 0-3(available: 0, connected: 1, busy: 2, connected failed: 3), else return -1
262  *      @param[in] ugd the pointer to the main data structure
263  *      @param[in] device the pointer to the number of connected failed devices
264  */
265 //int wfd_get_device_status(void *data, device_type_s *device);
266
267 /**
268  *      This function let the ug refresh current status of wi-fi direct
269  *      @return   If success, return 0, else return -1
270  *      @param[in] data the pointer to the main data structure
271  */
272 int wfd_refresh_wifi_direct_state(void *data);
273
274 /**
275  *      This function let the ug free the selected peers in multi connect view
276  *      @return   void
277  *      @param[in] data the pointer to the main data structure
278  */
279 void wfd_free_multi_selected_peers(void *data);
280
281 /**
282  *      This function let the ug stop to connect to selected peer
283  *      @return   If success, return 0, else return -1
284  *      @param[in] data the pointer to the main data structure
285  */
286 int wfd_stop_multi_connect(void *data);
287
288 /**
289  *      This function let the ug connect to the next selected peer automatically
290  *      @return   If stop the timer, return false, else return true
291  *      @param[in] data the pointer to the main data structure
292  */
293 gboolean wfd_multi_connect_next_cb(void *data);
294
295 /**
296  *      This function let the ug add a dialogue separator
297  *      @return   the separator item
298  *      @param[in] genlist the pointer to the genlist
299  *      @param[in] separator_style the style of separator
300  */
301 Elm_Object_Item *wfd_add_dialogue_separator(Evas_Object *genlist,
302                 const char *separator_style);
303
304 /**
305  *      This function let the ug free the multi connect devices
306  *      @return   0
307  *      @param[in] data the pointer to the main data structure
308  */
309 int wfd_free_multiconnect_device(struct ug_data *ugd);
310
311 /**
312  *      This function let the ug update the multi connect devices
313  *      @return   0
314  *      @param[in] ugd the pointer to the main data structure
315  *      @param[in] is_free_all_peers true to free all peers
316  */
317 int wfd_update_multiconnect_device(struct ug_data *ugd, bool is_free_all_peers);
318
319 /**
320  *      This function let the ug create the view for multi connection
321  *      @return   void
322  *      @param[in] ugd the pointer to the main data structure
323  */
324 void wfd_create_multiconnect_view(struct ug_data *ugd);
325
326 /**
327  *      This function let the ug delete search progressbar
328  *      @return   void
329  *      @param[in] user_data the pointer to the main data structure
330  */
331 int wfd_delete_progressbar_cb(void *user_data);
332
333 /**
334  *      This function let the ug insert peer item to genlist
335  *      @return   int
336  *      @param[in] genlist the pointer to genlist
337  *      @param[in] item the pointer to item to insert after
338  *      @param[in] itc Elm_Gen_Item_Class
339  *      @param[in] start_pos the pointer to the start position of peer array
340  *      @param[in] peer_for_insert the pointer to the peer to insert
341  *      @param[in] callback callback for peer select
342  */
343 int insert_gl_item(Evas_Object *genlist, Elm_Object_Item *item,
344                 Elm_Gen_Item_Class *itc, device_type_s **start_pos,
345                 device_type_s *peer_for_insert, void *callback);
346
347 /**
348  *      This function let the ug get the insert position for next item
349  *      @return  item the position to insert after
350  *      @param[in] peer the pointer to peer to search
351  *      @param[in] pre_item the title item of peer list
352  *      @param[in] peer_cnt the count of gl peers
353  */
354 Elm_Object_Item *get_insert_postion(device_type_s *peer,
355                 Elm_Object_Item *pre_item, int peer_cnt);
356
357 /**
358  *      This function let the ug find a peer in genlist
359  *      @return  peer the pointer of peer that found
360  *      @param[in] start_pos the start position of peers list
361  *      @param[in] mac_addr the mac_addr of peer for search
362  */
363 device_type_s *find_peer_in_glist(device_type_s *start_pos, const char *mac_addr);
364
365 /**
366  *      This function let the ug free gl peers
367  *      @return   void
368  *      @param[in] gl_peers_start the start pointer of peer list that for free
369  */
370 void wfd_ug_view_free_peer(device_type_s *gl_peers_start);
371
372 /**
373  *      This function let the ug exits automatically after successed connection
374  *      @return   void
375  *      @param[in] user_data the pointer to the main data structure
376  */
377 void _wfd_ug_auto_exit(void *user_data);
378
379 /**
380  *      This function let the ug update the buttons of toolbar
381  *      @return   void
382  *      @param[in] ugd the pointer to the main data structure
383  */
384 void wfd_ug_update_toolbar(struct ug_data *ugd);
385
386 /**
387  *      This function let the ug update the available and busy peers
388  *      @return   void
389  *      @param[in] data the pointer to the main data structure
390  */
391 void wfd_ug_update_available_peers(void *data);
392
393 /**
394  *      This function let the ug init the genlist
395  *      @return   void
396  *      @param[in] data the pointer to the main data structure
397  *      @param[in] is_free_all_peers true to free all peer items
398  */
399 void wfd_ug_view_init_genlist(void *data, bool is_free_all_peers);
400
401 /**
402  *      This function let the ug delete dead peers
403  *      @return   void
404  *      @param[in] ugd the pointer to the main data structure
405  *      @param[in] start_pos the pointer to start of peer list
406  *      @param[in] cnt the pointer to the number of peets in list
407  */
408 void delete_not_alive_peers(struct ug_data *ugd, device_type_s **start_pos,
409                 int *cnt);
410
411 /**
412  *      This function let the ug mark up the dead peers
413  *      @return   void
414  *      @param[in] ugd the pointer to the main data structure
415  *      @param[in] start_pos the pointer to start of peer list
416  */
417 void set_not_alive_peers(device_type_s *start_pos);
418
419 /**
420  *      This function let the ug update connected peers
421  *      @return   void
422  *      @param[in] data the pointer to the main data structure
423  */
424 void wfd_ug_update_connected_peers(void *data);
425
426 /**
427  *      This function let the ug update the multi-connect peers
428  *      @return   void
429  *      @param[in] data the pointer to the main data structure
430  */
431 void wfd_ug_view_update_multiconn_peers(void *data);
432
433 /**
434  *      This function let the ug update the failed peers
435  *      @return   void
436  *      @param[in] data the pointer to the main data structure
437  */
438 void wfd_ug_update_failed_peers(void *data);
439
440 /**
441  *      This function let the ug cancel progressbar stop timer
442  *      @return   void
443  *      @param[in] ugd the pointer to the main data structure
444  */
445 void wfd_cancel_progressbar_stop_timer(struct ug_data *ugd);
446
447 /**
448  *      This function let the ug cancel not-alive devices delete timer
449  *      @return   void
450  *      @param[in] ugd the pointer to the main data structure
451  */
452 void wfd_cancel_not_alive_delete_timer(struct ug_data *ugd);
453
454 /**
455  *      This function let the ug move ctxpopup to specified location
456  *      @return   void
457  */
458 void _ctxpopup_move();
459
460 int _create_available_dev_genlist(void *data);
461
462 Evas_Object *_create_no_device_genlist(void *data);
463
464 Evas_Object *_create_no_device_multiconnect_genlist(struct ug_data *ugd);
465
466 /**
467  *      This function let the ug create rename popup
468  *      @return   void
469  *      @param[in] data the pointer to the main data structure
470  */
471
472 void _gl_rename_device_sel(void *data, Evas_Object *obj, void *event_info);
473
474 #ifdef WFD_ON_OFF_GENLIST
475 /**
476  *      This function let the ug create on off check
477  *      @return   void
478  *      @param[in] parent the pointer to the naviframe
479  */
480 void wfd_ug_create_on_off_check(struct ug_data *ugd);
481 #endif
482 /**
483  *      This function is called after select all button is checked to select all available devices
484  *      @return   void
485  *      @param[in] data the pointer to the main data structure
486  */
487 void wfd_genlist_select_all_check_changed_cb(void *data, Evas_Object *obj,
488                 void *event_info);
489
490 #endif  /* __WFD_UG_VIEW_H__ */