tizen 2.0beta
[apps/native/ug-wifi-direct.git] / popup-wifidirect / include / wfd-app.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  * This file declares wifi direct application functions.
22  *
23  * @file    wfd-app.h
24  * @author  Sungsik Jang (sungsik.jang@samsung.com)
25  * @version 0.1
26  */
27
28
29 #ifndef __WFD_SYS_POPAPP_MAIN_H__
30 #define __WFD_SYS_POPAPP_MAIN_H__
31
32 #include <appcore-efl.h>
33 #include <Ecore_X.h>
34 #include <Elementary.h>
35 #include <appsvc.h>
36 #include <aul.h>
37 #include <notification.h>
38 #include <syspopup_caller.h>
39
40 #define PACKAGE "org.tizen.wifi-direct-popup"
41 #define EDJ_NAME RESDIR"/edje/wifi-direct-popup.edj"
42 #define WFD_MAX_PEER_NUM        10
43 #define WFD_POP_STR_MAX_LEN     256
44 #define NO_ACTION_TIME_OUT      300            /*5min*/
45
46 #define NOTIFICATION_BUNDLE_PARAM "NotiType"
47 #define NOTIFICATION_BUNDLE_VALUE "WiFi-Direct"
48 #define TICKERNOTI_SYSPOPUP "tickernoti-syspopup"
49
50
51 #define LOCALE_FILE_NAME "wifi-direct-popup"
52 #define LOCALEDIR "/opt/apps/org.tizen.wifi-direct-popup/res/locale"
53
54 #define _(s)        dgettext(LOCALE_FILE_NAME, s)
55 #define N_(s)      dgettext_noop(s)
56 #define S_(s)      dgettext("sys_string", s)
57
58
59
60 enum
61 {
62     WFD_POP_TIMER_3 = 3,
63     WFD_POP_TIMER_10 = 10,
64     WFD_POP_TIMER_30 = 30,
65     WFD_POP_TIMER_120 = 120,
66 };
67
68 enum
69 {
70     WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ,
71     WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ,
72     WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ,
73
74     WFD_POP_PROG_CONNECT,
75     WFD_POP_PROG_DISCONNECT,
76     WFD_POP_PROG_CONNECT_CANCEL,
77     WFD_POP_PROG_CONNECT_WITH_PIN,
78     WFD_POP_PROG_CONNECT_WITH_KEYPAD,
79     WFD_POP_NOTI_CONNECTED,
80     WFD_POP_NOTI_DISCONNECTED,
81
82     WFD_POP_FAIL_INIT,
83     WFD_POP_FAIL_CONNECT,
84     WFD_POP_INCORRECT_PIN,
85
86     //Automatic turn off wfd
87     WFD_POP_AUTOMATIC_TURN_OFF,
88
89 };
90
91 enum
92 {
93     WFD_POP_RESP_OK,
94     WFD_POP_RESP_CANCEL,
95     WFD_POP_RESP_APRV_CONNECT_PBC_YES = 1,
96     WFD_POP_RESP_APRV_CONNECT_DISPLAY_YES,
97     WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES,
98     WFD_POP_RESP_APRV_CONNECT_NO,
99     WFD_POP_RESP_PROG_CONNECT_CANCEL,
100     WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK,
101     WFD_POP_RESP_APRV_ENTER_PIN_YES,
102     WFD_POP_RESP_APRV_ENTER_PIN_NO,
103     WFD_POP_RESP_AUTOMATIC_TURNOFF_OK,
104 };
105
106 typedef struct
107 {
108     int type;
109     char text[WFD_POP_STR_MAX_LEN];
110     char label1[WFD_POP_STR_MAX_LEN];
111     char label2[WFD_POP_STR_MAX_LEN];
112     int timeout;
113     int resp_data1;
114     int resp_data2;
115     int data;
116 } wfd_popup_t;
117
118 typedef struct
119 {
120     char ssid[32];
121     char mac_address[18];
122 } wfd_device_info_t;
123
124 typedef struct
125 {
126     Evas_Object *win;
127     Evas_Object *popup;
128     Evas_Object *pin_entry;
129     wfd_popup_t *popup_data;
130     uint popup_timeout_handle;
131     char pin_number[32];
132     char peer_mac[18];
133     char peer_name[32];
134     wfd_device_info_t *discovered_peers;
135     int discovered_peer_count;
136
137     /* notification */
138     notification_h noti;
139     wfd_device_info_t raw_connected_peers[WFD_MAX_PEER_NUM];
140     int raw_connected_peer_cnt;
141
142     /* used for automatic turn off */
143     int wfd_status;
144     int last_wfd_status;
145     int last_wfd_time;
146     int last_wfd_transmit_time;
147     Ecore_Timer *monitor_timer;
148     Ecore_Timer *transmit_timer;
149 } wfd_appdata_t;
150
151 typedef struct
152 {
153     int step;
154     Evas_Object *progressbar;
155     Evas_Object *time;
156 } wfd_wps_display_popup_t;
157
158 extern wfd_appdata_t *wfd_get_appdata();
159 extern void wfd_destroy_popup();
160 extern void wfd_prepare_popup(int type, void *userdata);
161 extern void wfd_tickernoti_popup(char *msg);
162
163 #endif                          /* __WFD_SYS_POPAPP_MAIN_H__ */