7a6359b75a9c296e829d6056d93c84897a121fe8
[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 #include <syspopup_caller.h>
25
26 #define EDJDIR "/usr/ug/res/edje/ug-setting-wifidirect-efl"
27 #define WFD_UG_EDJ_PATH  EDJDIR"/wfd_ug.edj"
28 #define WFD_IMG_DIR "/usr/ug/res/images/ug-setting-wifidirect-efl"
29 #define TICKERNOTI_SYSPOPUP "tickernoti-syspopup"
30
31
32 /* Define icons */
33
34 #define WFD_ICON_DEVICE_COMPUTER                        WFD_IMG_DIR"/A09_device_computer.png"
35 #define WFD_ICON_DEVICE_INPUT_DEVICE                    WFD_IMG_DIR"/A09_device_input_device.png"
36 #define WFD_ICON_DEVICE_PRINTER                         WFD_IMG_DIR"/A09_device_printer.png"
37 #define WFD_ICON_DEVICE_CAMERA                          WFD_IMG_DIR"/A09_device_camera.png"
38 #define WFD_ICON_DEVICE_STORAGE                         WFD_IMG_DIR"/A09_device_storage.png"
39 #define WFD_ICON_DEVICE_NETWORK_INFRA                   WFD_IMG_DIR"/A09_device_network_infrastructure.png"
40 #define WFD_ICON_DEVICE_DISPLAY                         WFD_IMG_DIR"/A09_device_display.png"
41 #define WFD_ICON_DEVICE_MULTIMEDIA_DEVICE               WFD_IMG_DIR"/A09_device_multimedia_devices.png"
42 #define WFD_ICON_DEVICE_GAMING_DEVICE                   WFD_IMG_DIR"/A09_device_gaming_devices.png"
43 #define WFD_ICON_DEVICE_TELEPHONE                       WFD_IMG_DIR"/A09_device_telephone.png"
44 #define WFD_ICON_DEVICE_AUDIO_DEVICE                    WFD_IMG_DIR"/A09_device_audio_devices.png"
45
46 #define WFD_ICON_DEVICE_COMPUTER_CONNECT                WFD_IMG_DIR"/A09_device_computer_connect.png"
47 #define WFD_ICON_DEVICE_INPUT_DEVICE_CONNECT            WFD_IMG_DIR"/A09_device_input_device_connect.png"
48 #define WFD_ICON_DEVICE_PRINTER_CONNECT                 WFD_IMG_DIR"/A09_device_printer_connect.png"
49 #define WFD_ICON_DEVICE_CAMERA_CONNECT                  WFD_IMG_DIR"/A09_device_camera_connect.png"
50 #define WFD_ICON_DEVICE_STORAGE_CONNECT                 WFD_IMG_DIR"/A09_device_storage_connect.png"
51 #define WFD_ICON_DEVICE_NETWORK_INFRA_CONNECT           WFD_IMG_DIR"/A09_device_network_infrastructure_connect.png"
52 #define WFD_ICON_DEVICE_DISPLAY_CONNECT                 WFD_IMG_DIR"/A09_device_display_connect.png"
53 #define WFD_ICON_DEVICE_MULTIMEDIA_DEVICE_CONNECT       WFD_IMG_DIR"/A09_device_multimedia_devices_connect.png"
54 #define WFD_ICON_DEVICE_GAMING_DEVICE_CONNECT           WFD_IMG_DIR"/A09_device_gaming_devices_connect.png"
55 #define WFD_ICON_DEVICE_TELEPHONE_CONNECT               WFD_IMG_DIR"/A09_device_telephone_connect.png"
56 #define WFD_ICON_DEVICE_AUDIO_DEVICE_CONNECT            WFD_IMG_DIR"/A09_device_audio_devices_connect.png"
57
58 #define WFD_ICON_CONNECTED                              WFD_IMG_DIR"/A09_Connect.png"
59
60
61 enum {
62         HEAD_TEXT_TYPE_DIRECT,
63         HEAD_TEXT_TYPE_DEACTIVATING,
64         HEAD_TEXT_TYPE_ACTIVATING,
65         HEAD_TEXT_TYPE_ACTIVATED,
66         HEAD_TEXT_TYPE_SCANING,
67 };
68
69 enum {
70         /* User confirm */
71         POPUP_TYPE_WIFI_OFF,
72         POPUP_TYPE_HOTSPOT_OFF,
73
74         /* Activation */
75         POPUP_TYPE_ACTIVATE_FAIL,
76         POPUP_TYPE_DEACTIVATE_FAIL,
77
78         /* Connection */
79         POPUP_TYPE_LINK_TIMEOUT,
80         POPUP_TYPE_AUTH_FAIL,
81         POPUP_TYPE_LINK_FAIL,
82         POPUP_TYPE_UNKNOWN_ERROR,
83
84         POPUP_TYPE_TERMINATE,
85
86         /* Disconnect */
87         POP_TYPE_DISCONNECT,
88
89         /* Disconnect All*/
90         POP_TYPE_DISCONNECT_ALL,
91
92         /* Scan again */
93         POP_TYPE_SCAN_AGAIN,
94
95         /* multi connect */
96         POP_TYPE_MULTI_CONNECT_POPUP,
97
98         /* Busy device */
99         POP_TYPE_BUSY_DEVICE_POPUP,
100
101         /* Automaticlly turn off */
102         POP_TYPE_AUTOMATIC_TURN_OFF,
103 };
104
105 struct ug_data *wfd_get_ug_data();
106
107 /**
108  *      This function let the ug create the main view
109  *      @return   void
110  *      @param[in] data the pointer to the main data structure
111  */
112 void create_wfd_ug_view(void *data);
113
114 /**
115  *      This function let the ug destroy the main view
116  *      @return   void
117  *      @param[in] data the pointer to the main data structure
118  */
119 void destroy_wfd_ug_view(void *data);
120
121 /**
122  *      This function let the ug update the genlist item
123  *      @return   void
124  *      @param[in] obj the pointer to genlist item
125  */
126 void wfd_ug_view_refresh_glitem(void *obj);
127
128 /**
129  *      This function let the ug refresh the attributes of button
130  *      @return   void
131  *      @param[in] obj the pointer to the button
132  *      @param[in] text the pointer to the text of button
133  *      @param[in] enable whether the button is disabled
134  */
135 void wfd_ug_view_refresh_button(void *obj, const char *text, int enable);
136
137 /**
138  *      This function let the ug update the peers
139  *      @return   void
140  *      @param[in] data the pointer to the main data structure
141  */
142 void wfd_ug_view_update_peers(void *data);
143
144 /**
145  *      This function let the ug free the peers
146  *      @return   void
147  *      @param[in] data the pointer to the main data structure
148  */
149 void wfd_ug_view_free_peers(void *data);
150
151 /**
152  *      This function let the ug create a action popup
153  *      @return   void
154  *      @param[in] data the pointer to the main data structure
155  *      @param[in] message the pointer to the text of popup
156  *      @param[in] popup_type the message type
157  */
158 void wfd_ug_act_popup(void *data, const char *message, int popup_type);
159
160 /**
161  *      This function let the ug remove the action popup
162  *      @return   void
163  *      @param[in] data the pointer to the main data structure
164  */
165 void wfg_ug_act_popup_remove(void *data);
166
167 /**
168  *      This function let the ug create a warning popup
169  *      @return   void
170  *      @param[in] data the pointer to the main data structure
171  *      @param[in] message the pointer to the text of popup
172  *      @param[in] popup_type the message type
173  */
174 void wfd_ug_warn_popup(void *data, const char *message, int popup_type);
175
176 /**
177  *      This function let the ug change the text of multi button
178  *      @return   If success, return 0, else return -1
179  *      @param[in] data the pointer to the main data structure
180  */
181 int _change_multi_button_title(void *data);
182
183 /**
184  *      This function let the ug create about view
185  *      @return   void
186  *      @param[in] ugd the pointer to the main data structure
187  */
188 void _wifid_create_about_view(struct ug_data *ugd);
189
190 /**
191  *      This function let the ug create the view for multi connection
192  *      @return   void
193  *      @param[in] ugd the pointer to the main data structure
194  */
195 void _wifid_create_multiconnect_view(struct ug_data *ugd);
196
197 /**
198  *      This function let the ug call it when click 'back' button
199  *      @return   void
200  *      @param[in] data the pointer to the main data structure
201  *      @param[in] obj the pointer to the evas object
202  *      @param[in] event_info the pointer to the event information
203  */
204 void _back_btn_cb(void *data, Evas_Object * obj, void *event_info);
205
206 /**
207  *      This function let the ug call it when click 'scan' button
208  *      @return   void
209  *      @param[in] data the pointer to the main data structure
210  *      @param[in] obj the pointer to the evas object
211  *      @param[in] event_info the pointer to the event information
212  */
213 void _scan_btn_cb(void *data, Evas_Object * obj, void *event_info);
214
215 /**
216  *      This function let the ug call it when click 'multi connect' button
217  *      @return   void
218  *      @param[in] data the pointer to the main data structure
219  *      @param[in] obj the pointer to the evas object
220  *      @param[in] event_info the pointer to the event information
221  */
222 void _wifid_create_multibutton_cb(void *data, Evas_Object *obj, void *event_info);
223
224 /**
225  *      This function let the ug get the found peers
226  *      @return   If success, return 0, else return -1
227  *      @param[in] ugd the pointer to the main data structure
228  */
229 int wfd_ug_get_discovered_peers(struct ug_data *ugd);
230
231 /**
232  *      This function let the ug get the connected peers
233  *      @return   If success, return 0, else return -1
234  *      @param[in] ugd the pointer to the main data structure
235  */
236 int wfd_ug_get_connected_peers(struct ug_data *ugd);
237
238 /**
239  *      This function let the ug get the device status
240  *      @return  If success, return 0-3(available: 0, connected: 1, busy: 2, connected failed: 3), else return -1
241  *      @param[in] ugd the pointer to the main data structure
242  *      @param[in] device the pointer to the number of connected failed devices
243  */
244 int wfd_get_device_status(void *data, device_type_s *device);
245
246 /**
247  *      This function let the ug refresh current status of wi-fi direct
248  *      @return   If success, return 0, else return -1
249  *      @param[in] data the pointer to the main data structure
250  */
251 int wfd_refresh_wifi_direct_state(void *data);
252
253 /**
254  *      This function let the ug free the selected peers in multi connect view
255  *      @return   void
256  *      @param[in] data the pointer to the main data structure
257  */
258 void wfd_free_multi_selected_peers(void *data);
259
260 /**
261  *      This function let the ug stop to connect to selected peer
262  *      @return   If success, return 0, else return -1
263  *      @param[in] data the pointer to the main data structure
264  */
265 int wfd_stop_multi_connect(void *data);
266
267 /**
268  *      This function let the ug connect to the next selected peer automatically
269  *      @return   If stop the timer, return false, else return true
270  *      @param[in] data the pointer to the main data structure
271  */
272 gboolean wfd_multi_connect_next_cb(void *data);
273
274 /**
275  *      This function let the ug add a dialogue separator
276  *      @return   the separator item
277  *      @param[in] genlist the pointer to the genlist
278  *      @param[in] separator_style the style of separator
279  */
280 Elm_Object_Item *wfd_add_dialogue_separator(Evas_Object *genlist, const char *separator_style);
281
282 /**
283  *      This function let the ug fee the multi connect devices
284  *      @return   0
285  *      @param[in] data the pointer to the main data structure
286  */
287 int wfd_free_multiconnect_device(struct ug_data *ugd);
288
289 /**
290  *      This function let the ug update the multi connect devices
291  *      @return   0
292  *      @param[in] data the pointer to the main data structure
293  */
294 int wfd_update_multiconnect_device(struct ug_data *ugd);
295
296 /**
297  *      This function let the ug create the view for multi connection
298  *      @return   void
299  *      @param[in] ugd the pointer to the main data structure
300  */
301 void wfd_create_multiconnect_view(struct ug_data *ugd);
302
303
304 #endif  /* __WFD_UG_VIEW_H__ */