Tizen 2.0 Release
[pkgs/o/oma-ds-service.git] / data / rsa / ug-wifi-direct / 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 #include "wifi-direct.h"
40
41 #define PACKAGE "org.tizen.wifi-direct-popup"
42 #define EDJ_NAME RESDIR"/edje/wifi-direct-popup.edj"
43 #define WFD_MAX_PEER_NUM        10
44 #define WFD_POP_STR_MAX_LEN     256
45 #define NO_ACTION_TIME_OUT      300            /*5min*/
46
47 #define NOTIFICATION_BUNDLE_PARAM "NotiType"
48 #define NOTIFICATION_BUNDLE_VALUE "WiFi-Direct"
49 #define TICKERNOTI_SYSPOPUP "tickernoti-syspopup"
50
51
52 #define LOCALE_FILE_NAME "wifi-direct-popup"
53 #define LOCALEDIR "/usr/apps/org.tizen.wifi-direct-popup/res/locale"
54
55 #define _(s)        dgettext(LOCALE_FILE_NAME, s)
56 #define N_(s)      dgettext_noop(s)
57 #define S_(s)      dgettext("sys_string", s)
58
59
60
61 enum {
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         WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ,
70         WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ,
71         WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ,
72
73         WFD_POP_PROG_CONNECT,
74         WFD_POP_PROG_DISCONNECT,
75         WFD_POP_PROG_CONNECT_CANCEL,
76         WFD_POP_PROG_CONNECT_WITH_PIN,
77         WFD_POP_PROG_CONNECT_WITH_KEYPAD,
78         WFD_POP_NOTI_DISCONNECTED,
79
80         WFD_POP_FAIL_INIT,
81 };
82
83 enum {
84         WFD_POP_RESP_OK,
85         WFD_POP_RESP_CANCEL,
86         WFD_POP_RESP_APRV_CONNECT_PBC_YES = 1,
87         WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK,
88         WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES,
89         WFD_POP_RESP_APRV_CONNECT_NO,
90         WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK,
91         WFD_POP_RESP_APRV_ENTER_PIN_YES,
92         WFD_POP_RESP_APRV_ENTER_PIN_NO,
93 };
94
95 typedef struct {
96         int type;
97         char text[WFD_POP_STR_MAX_LEN];
98         char label1[WFD_POP_STR_MAX_LEN];
99         char label2[WFD_POP_STR_MAX_LEN];
100         int timeout;
101         int resp_data1;
102         int resp_data2;
103         int data;
104 } wfd_popup_t;
105
106 typedef struct {
107         char ssid[32];
108         char mac_address[18];
109 } wfd_device_info_t;
110
111 typedef struct {
112         Evas_Object *win;
113         Evas_Object *popup;
114         Evas_Object *pin_entry;
115         wfd_popup_t *popup_data;
116         uint popup_timeout_handle;
117         char pin_number[64];
118         char peer_mac[18];
119         char peer_name[32];
120         wfd_device_info_t *discovered_peers;
121         int discovered_peer_count;
122
123         /* notification */
124         notification_h noti;
125         wfd_device_info_t raw_connected_peers[WFD_MAX_PEER_NUM];
126         int raw_connected_peer_cnt;
127
128         /* Transmit timer */
129         wifi_direct_state_e wfd_status;
130         int last_wfd_transmit_time;
131         Ecore_Timer *transmit_timer;
132 } wfd_appdata_t;
133
134 typedef struct {
135         int step;
136         Evas_Object *progressbar;
137         Evas_Object *time;
138 } wfd_wps_display_popup_t;
139
140 extern wfd_appdata_t *wfd_get_appdata();
141
142 /**
143  *      This function let the app do initialization
144  *      @return   If success, return TRUE, else return FALSE
145  *      @param[in] ad the pointer to the main data structure
146  */
147 int init_wfd_popup_client(wfd_appdata_t *ad);
148
149 /**
150  *      This function let the app do de-initialization
151  *      @return   If success, return TRUE, else return FALSE
152  *      @param[in] ad the pointer to the main data structure
153  */
154 int deinit_wfd_popup_client(wfd_appdata_t *ad);
155
156
157 /**
158  *      This function let the app destroy the popup
159  *      @return   void
160  *      @param[in] null
161  */
162 extern void wfd_destroy_popup();
163
164 /**
165  *      This function let the app create a popup
166  *      @return   void
167  *      @param[in] type the type of popup
168  *      @param[in] userdata the pointer to the data which will be used
169  */
170 extern void wfd_prepare_popup(int type, void *userdata);
171
172 /**
173  *      This function let the app create a tickernoti syspopup
174  *      @return   void
175  *      @param[in] msg the pointer to message of tickernoti
176  */
177 extern void wfd_tickernoti_popup(char *msg);
178
179 #endif                          /* __WFD_SYS_POPAPP_MAIN_H__ */