summaryrefslogtreecommitdiff
path: root/ug-wifidirect/include/wfd_ug_view.h
blob: b88e653965b0572ee0fffa612c45042dd67e673b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
/*
*  WiFi-Direct UG
*
* Copyright 2012  Samsung Electronics Co., Ltd

* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

* http://www.tizenopensource.org/license

* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#ifndef __WFD_UG_VIEW_H__
#define __WFD_UG_VIEW_H__

#include <glib.h>

#define EDJDIR "/usr/apps/setting-wifidirect-efl/res/edje/ug-setting-wifidirect-efl"
#define WFD_UG_EDJ_PATH  EDJDIR"/wfd_ug.edj"
#define WFD_IMG_DIR "/usr/apps/setting-wifidirect-efl/res/images/ug-setting-wifidirect-efl"

/* Define icons */
#define WFD_ICON_DEVICE_COMPUTER			"A09_device_computer.png"
#define WFD_ICON_DEVICE_INPUT_DEVICE		"A09_device_input_device.png"
#define WFD_ICON_DEVICE_PRINTER				"A09_device_printer.png"
#define WFD_ICON_DEVICE_CAMERA				"A09_device_camera.png"
#define WFD_ICON_DEVICE_STORAGE				"A09_device_storage.png"
#define WFD_ICON_DEVICE_NETWORK_INFRA		"A09_device_network_infrastructure.png"
#define WFD_ICON_DEVICE_DISPLAY				"A09_device_display.png"
#define WFD_ICON_DEVICE_MULTIMEDIA			"A09_device_multimedia.png"
#define WFD_ICON_DEVICE_GAMING				"A09_device_gaming.png"
#define WFD_ICON_DEVICE_TELEPHONE			"A09_device_telephone.png"
#define WFD_ICON_DEVICE_HEADSET				"A09_device_headset.png"
#define WFD_ICON_DEVICE_UNKNOWN				"A09_device_unknown.png"
#define WFD_ICON_DEVICE_BD					"U04_device_BD.png"
#define WFD_ICON_DEVICE_DONGLE				"U04_device_Dongle.png"
#define WFD_ICON_DEVICE_HOME_THEATER		"U04_device_Home_Theater.png"
#define WFD_ICON_DEVICE_STB					"U04_device_STB.png"

/* Not support */
#define WFD_ICON_DEVICE_HEADPHONE			"A09_device_headphone.png"
#define WFD_ICON_DEVICE_MEDICAL				"A09_device_Medical.png"
#define WFD_ICON_DEVICE_MOUSE				"A09_device_mouse.png"

#define WFD_ICON_DEVICE_MORE_HELP				"A09_popup_help.png"

enum {
	HEAD_TEXT_TYPE_DIRECT,
	HEAD_TEXT_TYPE_DEACTIVATING,
	HEAD_TEXT_TYPE_ACTIVATING,
	HEAD_TEXT_TYPE_ACTIVATED,
};

enum {
	TITLE_CONTENT_TYPE_NONE,
	TITLE_CONTENT_TYPE_SCANNING,
	TITLE_CONTENT_TYPE_FOUND,
};


enum {
	/* User confirm */
#ifndef MODEL_BUILD_FEATURE_WLAN_CONCURRENT_MODE
	POPUP_TYPE_WIFI_OFF,
#endif
#ifdef WFD_HOSTAPD_ENABLER
	POPUP_TYPE_HOTSPOT_OFF = 1,
#endif
	/* Activation */
	POPUP_TYPE_ACTIVATE_FAIL,
	POPUP_TYPE_ACTIVATE_FAIL_POLICY_RESTRICTS,
	POPUP_TYPE_DEACTIVATE_FAIL,

	/* Connection */
	POPUP_TYPE_LINK_TIMEOUT,
	POPUP_TYPE_AUTH_FAIL,
	POPUP_TYPE_LINK_FAIL,
	POPUP_TYPE_UNKNOWN_ERROR,

	POPUP_TYPE_INFO,
	POPUP_TYPE_TERMINATE,
	POPUP_TYPE_TERMINATE_DEACTIVATE_FAIL,
	POPUP_TYPE_TERMINATE_NOT_SUPPORT,

	/* Disconnect */
	POP_TYPE_DISCONNECT,

	POP_TYPE_CANCEL_CONNECT,

	POP_TYPE_ACCEPT_CONNECTION,

	/* Scan again */
	POP_TYPE_SCAN_AGAIN,

	/* multi connect */
	POP_TYPE_MULTI_CONNECT_POPUP,

	/* Busy device */
	POP_TYPE_BUSY_DEVICE_POPUP,

	/* Automaticlly turn off */
	POP_TYPE_AUTOMATIC_TURN_OFF,
};

struct ug_data *wfd_get_ug_data();

/**
 *	This function let the ug create the main view
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */
void create_wfd_ug_view(void *data);

/**
 *	This function let the ug destroy the main view
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */
void destroy_wfd_ug_view(void *data);

/**
 *	This function let the ug update the genlist item
 *	@return   void
 *	@param[in] gl_item the pointer to genlist item
 */
void wfd_ug_view_refresh_glitem(Elm_Object_Item *gl_item);

/**
 *	This function let the ug refresh the attributes of button
 *	@return   void
 *	@param[in] tb_item the pointer to the toolbar button
 *	@param[in] text the pointer to the text of button
 *	@param[in] enable whether the button is disabled
 */
void wfd_ug_view_refresh_button(Evas_Object *tb_item, const char *text,
		int enable);

/**
 *	This function let the ug update the peers
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */
void wfd_ug_view_update_peers(void *data);

/**
 *	This function let the ug free the peers
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */
void wfd_ug_view_free_peers(void *data);

/**
 *	This function let the ug create a action popup
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 *	@param[in] message the pointer to the text of popup
 *	@param[in] popup_type the message type
 */
void wfd_ug_act_popup(void *data, const char *message, int popup_type);

/**
 *	This function let the ug remove the action popup
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */
void wfg_ug_act_popup_remove(void *data);

/**
 *	This function let the ug create a warning popup
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 *	@param[in] message the pointer to the text of popup
 *	@param[in] popup_type the message type
 */
void wfd_ug_warn_popup(void *data, const char *message, int popup_type);

/**
 *	This function let the ug create the view for multi connection
 *	@return   void
 *	@param[in] ugd the pointer to the main data structure
 */
void _wifid_create_multiconnect_view(struct ug_data *ugd);

/**
 *	This function let the ug call it when click 'back' button
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] event_info the pointer to the event information
 */
Eina_Bool _back_btn_cb(void *data, Elm_Object_Item *it);

/**
 *	This function let the ug call it when click 'scan' button
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] event_info the pointer to the event information
 */
void _scan_btn_cb(void *data, Evas_Object * obj, void *event_info);

/**
 *	This function let the ug call it when click 'disconnect' button
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] event_info the pointer to the event information
 */
void _wfd_ug_disconnect_button_cb(void *data, Evas_Object *obj, void *event_info);

/**
 *	This function let the ug call it when click "Cancel Connection" button
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] event_info the pointer to the event information
 */
void _wfd_ug_cancel_connection_button_cb(void *data, Evas_Object *obj, void *event_info);

/**
 *	This function let the ug get the found peers
 *	@return   If success, return 0, else return -1
 *	@param[in] ugd the pointer to the main data structure
 */
int wfd_ug_get_discovered_peers(struct ug_data *ugd);

/**
 *	This function let the ug get the connecting peer mac
 *	@return   If success, return 0, else return -1
 *	@param[in] ugd the pointer to the main data structure
 */
int wfd_ug_get_connecting_peer(struct ug_data *ugd);

/**
 *	This function let the ug get the connected peers
 *	@return   If success, return 0, else return -1
 *	@param[in] ugd the pointer to the main data structure
 */
int wfd_ug_get_connected_peers(struct ug_data *ugd);

/**
 *	This function let the ug get the device status
 *	@return  If success, return 0-3(available: 0, connected: 1, busy: 2, connected failed: 3), else return -1
 *	@param[in] ugd the pointer to the main data structure
 *	@param[in] device the pointer to the number of connected failed devices
 */
//int wfd_get_device_status(void *data, device_type_s *device);

/**
 *	This function let the ug refresh current status of wi-fi direct
 *	@return   If success, return 0, else return -1
 *	@param[in] data the pointer to the main data structure
 */
int wfd_refresh_wifi_direct_state(void *data);

/**
 *	This function let the ug free the selected peers in multi connect view
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */
void wfd_free_multi_selected_peers(void *data);

/**
 *	This function let the ug stop to connect to selected peer
 *	@return   If success, return 0, else return -1
 *	@param[in] data the pointer to the main data structure
 */
int wfd_stop_multi_connect(void *data);

/**
 *	This function let the ug connect to the next selected peer automatically
 *	@return   If stop the timer, return false, else return true
 *	@param[in] data the pointer to the main data structure
 */
gboolean wfd_multi_connect_next_cb(void *data);

/**
 *	This function let the ug add a dialogue separator
 *	@return   the separator item
 *	@param[in] genlist the pointer to the genlist
 *	@param[in] separator_style the style of separator
 */
Elm_Object_Item *wfd_add_dialogue_separator(Evas_Object *genlist,
		const char *separator_style);

/**
 *	This function let the ug free the multi connect devices
 *	@return   0
 *	@param[in] data the pointer to the main data structure
 */
int wfd_free_multiconnect_device(struct ug_data *ugd);

/**
 *	This function let the ug update the multi connect devices
 *	@return   0
 *	@param[in] ugd the pointer to the main data structure
 *	@param[in] is_free_all_peers true to free all peers
 */
int wfd_update_multiconnect_device(struct ug_data *ugd, bool is_free_all_peers);

/**
 *	This function let the ug create the view for multi connection
 *	@return   void
 *	@param[in] ugd the pointer to the main data structure
 */
void wfd_create_multiconnect_view(struct ug_data *ugd);

/**
 *	This function let the ug delete search progressbar
 *	@return   void
 *	@param[in] user_data the pointer to the main data structure
 */
int wfd_delete_progressbar_cb(void *user_data);

/**
 *	This function let the ug insert peer item to genlist
 *	@return   int
 *	@param[in] genlist the pointer to genlist
 *	@param[in] item the pointer to item to insert after
 *      @param[in] itc Elm_Gen_Item_Class
 *	@param[in] start_pos the pointer to the start position of peer array
 *	@param[in] peer_for_insert the pointer to the peer to insert
 *	@param[in] callback callback for peer select
 */
int insert_gl_item(Evas_Object *genlist, Elm_Object_Item *item,
		Elm_Gen_Item_Class *itc, device_type_s **start_pos,
		device_type_s *peer_for_insert, void *callback);

/**
 *	This function let the ug get the insert position for next item
 *	@return  item the position to insert after
 *	@param[in] peer the pointer to peer to search
 *	@param[in] pre_item the title item of peer list
 *	@param[in] peer_cnt the count of gl peers
 */
Elm_Object_Item *get_insert_postion(device_type_s *peer,
		Elm_Object_Item *pre_item, int peer_cnt);

/**
 *	This function let the ug find a peer in genlist
 *	@return  peer the pointer of peer that found
 *	@param[in] start_pos the start position of peers list
 *	@param[in] mac_addr the mac_addr of peer for search
 */
device_type_s *find_peer_in_glist(device_type_s *start_pos, const char *mac_addr);

/**
 *	This function let the ug free gl peers
 *	@return   void
 *	@param[in] gl_peers_start the start pointer of peer list that for free
 */
void wfd_ug_view_free_peer(device_type_s *gl_peers_start);

/**
 *	This function let the ug exits automatically after successed connection
 *	@return   void
 *	@param[in] user_data the pointer to the main data structure
 */
void _wfd_ug_auto_exit(void *user_data);

/**
 *	This function let the ug update the buttons of toolbar
 *	@return   void
 *	@param[in] ugd the pointer to the main data structure
 */
void wfd_ug_update_toolbar(struct ug_data *ugd);

/**
 *	This function let the ug update the available and busy peers
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */
void wfd_ug_update_available_peers(void *data);

/**
 *	This function let the ug init the genlist
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 *	@param[in] is_free_all_peers true to free all peer items
 */
void wfd_ug_view_init_genlist(void *data, bool is_free_all_peers);

/**
 *	This function let the ug delete dead peers
 *	@return   void
 *	@param[in] ugd the pointer to the main data structure
 *	@param[in] start_pos the pointer to start of peer list
 *	@param[in] cnt the pointer to the number of peets in list
 */
void delete_not_alive_peers(struct ug_data *ugd, device_type_s **start_pos,
		int *cnt);

/**
 *	This function let the ug mark up the dead peers
 *	@return   void
 *	@param[in] ugd the pointer to the main data structure
 *	@param[in] start_pos the pointer to start of peer list
 */
void set_not_alive_peers(device_type_s *start_pos);

/**
 *	This function let the ug update connected peers
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */
void wfd_ug_update_connected_peers(void *data);

/**
 *	This function let the ug update the multi-connect peers
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */
void wfd_ug_view_update_multiconn_peers(void *data);

/**
 *	This function let the ug update the failed peers
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */
void wfd_ug_update_failed_peers(void *data);

/**
 *	This function let the ug cancel progressbar stop timer
 *	@return   void
 *	@param[in] ugd the pointer to the main data structure
 */
void wfd_cancel_progressbar_stop_timer(struct ug_data *ugd);

/**
 *	This function let the ug cancel not-alive devices delete timer
 *	@return   void
 *	@param[in] ugd the pointer to the main data structure
 */
void wfd_cancel_not_alive_delete_timer(struct ug_data *ugd);

/**
 *	This function let the ug move ctxpopup to specified location
 *	@return   void
 */
void _ctxpopup_move();

int _create_available_dev_genlist(void *data);

Evas_Object *_create_no_device_genlist(void *data);

Evas_Object *_create_no_device_multiconnect_genlist(struct ug_data *ugd);

/**
 *	This function let the ug create rename popup
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */

void _gl_rename_device_sel(void *data, Evas_Object *obj, void *event_info);

#ifdef WFD_ON_OFF_GENLIST
/**
 *	This function let the ug create on off check
 *	@return   void
 *	@param[in] parent the pointer to the naviframe
 */
void wfd_ug_create_on_off_check(struct ug_data *ugd);
#endif
/**
 *	This function is called after select all button is checked to select all available devices
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 */
void wfd_genlist_select_all_check_changed_cb(void *data, Evas_Object *obj,
		void *event_info);

#endif  /* __WFD_UG_VIEW_H__ */