summaryrefslogtreecommitdiff
path: root/popup-wifidirect/include/wfd-app.h
blob: 160a2e4196db6811f42ac5cb34018f95a63a06dd (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
/*
*  WiFi-Direct UG
*
* Copyright 2012-2013 Samsung Electronics Co., Ltd

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

* http://floralicense.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.
*
*/

/**
 * This file declares wifi direct application functions.
 *
 * @file    wfd-app.h
 * @author  Sungsik Jang (sungsik.jang@samsung.com)
 * @version 0.1
 */


#ifndef __WFD_SYS_POPAPP_MAIN_H__
#define __WFD_SYS_POPAPP_MAIN_H__

#include <appcore-efl.h>
#include <Ecore_X.h>
#include <Elementary.h>
#include <appsvc.h>
#include <aul.h>
#include <notification.h>
#include <syspopup_caller.h>
#include "wifi-direct.h"

#define PACKAGE "org.tizen.wifi-direct-popup"
#define EDJ_NAME RESDIR"/edje/wifi-direct-popup.edj"
#define WFD_MAX_PEER_NUM	10
#define WFD_POP_STR_MAX_LEN	256
#define NO_ACTION_TIME_OUT	300            /*5min*/

#define NOTIFICATION_BUNDLE_PARAM "NotiType"
#define NOTIFICATION_BUNDLE_VALUE "WiFi-Direct"
#define TICKERNOTI_SYSPOPUP "tickernoti-syspopup"


#define LOCALE_FILE_NAME "wifi-direct-popup"
#define LOCALEDIR "/usr/apps/org.tizen.wifi-direct-popup/res/locale"

#define _(s)        dgettext(LOCALE_FILE_NAME, s)
#define N_(s)      dgettext_noop(s)
#define S_(s)      dgettext("sys_string", s)



enum {
	WFD_POP_TIMER_3 = 3,
	WFD_POP_TIMER_10 = 10,
	WFD_POP_TIMER_30 = 30,
	WFD_POP_TIMER_120 = 120,
};

enum {
	WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ,
	WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ,
	WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ,
	WFD_POP_APRV_CONNECTION_INVITATION_REQ,

	WFD_POP_PROG_CONNECT,
	WFD_POP_PROG_DISCONNECT,
	WFD_POP_PROG_CONNECT_CANCEL,
	WFD_POP_PROG_CONNECT_WITH_PIN,
	WFD_POP_PROG_CONNECT_WITH_KEYPAD,
	WFD_POP_NOTI_DISCONNECTED,

	WFD_POP_FAIL_INIT,
};

enum {
	WFD_POP_RESP_OK,
	WFD_POP_RESP_CANCEL,
	WFD_POP_RESP_APRV_CONNECT_PBC_YES = 1,
	WFD_POP_RESP_APRV_CONNECT_INVITATION_YES,
	WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK,
	WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES,
	WFD_POP_RESP_APRV_CONNECT_NO,
	WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK,
	WFD_POP_RESP_APRV_ENTER_PIN_YES,
	WFD_POP_RESP_APRV_ENTER_PIN_NO,
};

typedef struct {
	int type;
	char text[WFD_POP_STR_MAX_LEN];
	char label1[WFD_POP_STR_MAX_LEN];
	char label2[WFD_POP_STR_MAX_LEN];
	int timeout;
	int resp_data1;
	int resp_data2;
	int data;
} wfd_popup_t;

typedef struct {
	char ssid[32];
	char mac_address[18];
} wfd_device_info_t;

typedef struct {
	Evas_Object *win;
	Evas_Object *popup;
	Evas_Object *pin_entry;
	wfd_popup_t *popup_data;
	uint popup_timeout_handle;
	char pin_number[64];
	char peer_mac[18];
	char peer_name[32];
	wfd_device_info_t *discovered_peers;
	int discovered_peer_count;

	/* notification */
	notification_h noti;
	wfd_device_info_t raw_connected_peers[WFD_MAX_PEER_NUM];
	int raw_connected_peer_cnt;

	/* Transmit timer */
	wifi_direct_state_e wfd_status;
	int last_wfd_transmit_time;
	Ecore_Timer *transmit_timer;
} wfd_appdata_t;

typedef struct {
	int step;
	Evas_Object *progressbar;
	Evas_Object *time;
} wfd_wps_display_popup_t;

extern wfd_appdata_t *wfd_get_appdata();

/**
 *	This function let the app do initialization
 *	@return   If success, return TRUE, else return FALSE
 *	@param[in] ad the pointer to the main data structure
 */
int init_wfd_popup_client(wfd_appdata_t *ad);

/**
 *	This function let the app do de-initialization
 *	@return   If success, return TRUE, else return FALSE
 *	@param[in] ad the pointer to the main data structure
 */
int deinit_wfd_popup_client(wfd_appdata_t *ad);


/**
 *	This function let the app destroy the popup
 *	@return   void
 *	@param[in] null
 */
extern void wfd_destroy_popup();

/**
 *	This function let the app create a popup
 *	@return   void
 *	@param[in] type the type of popup
 *	@param[in] userdata the pointer to the data which will be used
 */
extern void wfd_prepare_popup(int type, void *userdata);

#endif                          /* __WFD_SYS_POPAPP_MAIN_H__ */