4 * Copyright 2012 Samsung Electronics Co., Ltd
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
10 * http://www.tizenopensource.org/license
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.
21 * This file declares wifi direct application functions.
24 * @author Sungsik Jang (sungsik.jang@samsung.com)
29 #ifndef __WFD_SYS_POPAPP_MAIN_H__
30 #define __WFD_SYS_POPAPP_MAIN_H__
32 #include <wifi-direct.h>
34 #define PACKAGE "org.tizen.wifi-direct-popup"
35 #define PACKAGE_ALLSHARE_CAST "org.tizen.allshare-cast-popup"
36 #define EDJ_NAME RESDIR"/edje/wifi-direct-popup.edj"
37 #define WFD_MAX_CONNECTED_PEER 7
38 #define WFD_POP_STR_MAX_LEN 256
39 #define NO_ACTION_TIME_OUT 300 /*5min*/
41 #define NOTIFICATION_BUNDLE_PARAM "NotiType"
42 #define NOTIFICATION_BUNDLE_VALUE "WiFi-Direct"
44 #define LOCALE_FILE_NAME "wifi-direct-popup"
45 #define LOCALEDIR "/usr/apps/org.tizen.wifi-direct-popup/res/locale"
46 #define WFD_NOTI_ICON_PATH "/usr/apps/org.tizen.quickpanel/shared/res/noti_icons/Wi-Fi/noti_wifi_direct_auto_off.png"
47 #define WFD_INDICATOR_ICON_PATH "/usr/apps/org.tizen.wifi-direct-popup/res/images/B03_wi-fi_direct_on_connected.png"
48 #define WFD_ACTIVATED_NOTI_ICON_PATH "/usr/apps/org.tizen.wifi-direct-popup/res/images/B03_wi-fi_direct_on_not_connected.png"
49 #define WFD_EDJ_POPUP_PATH "/usr/apps/org.tizen.wifi-direct-popup/res/edje/wfd_popup.edj"
50 #define SCREEN_MIRRIONG_INDICATOR_ICON_PATH "/usr/apps/org.tizen.wifi-direct-popup/res/images/B03_event_screen_mirroring.png"
51 #define SCREEN_MIRRIONG_INDICATOR_PLAY_ICON_PATH "/usr/apps/org.tizen.wifi-direct-popup/res/images/B03_event_screen_mirroring_play.png"
52 #define SCREEN_MIRRIONG_NOTI_ICON_PATH "/usr/apps/org.tizen.wifi-direct-popup/res/images/ug-setting-allshare-cast-efl.png"
54 #define _(s) dgettext(LOCALE_FILE_NAME, s)
55 #define N_(s) dgettext_noop(s)
56 #define S_(s) dgettext("sys_string", s)
58 #define MAX_NO_ACTION_TIME_OUT 300 /*5min*/
59 #define MAX_POPUP_TEXT_SIZE 256
60 #define DEV_NAME_LENGTH 32
61 #define MACSTR_LENGTH 17
73 WFD_POP_TIMER_10 = 10,
74 WFD_POP_TIMER_30 = 30,
75 WFD_POP_TIMER_120 = 120,
79 WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ,
80 WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ,
81 WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ,
84 WFD_POP_PROG_DISCONNECT,
85 WFD_POP_PROG_CONNECT_CANCEL,
86 WFD_POP_PROG_CONNECT_WITH_PIN,
87 WFD_POP_PROG_CONNECT_WITH_KEYPAD,
88 WFD_POP_NOTI_DISCONNECTED,
96 WFD_POP_RESP_APRV_CONNECT_PBC_YES = 1,
97 WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK,
98 WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES,
99 WFD_POP_RESP_APRV_CONNECT_NO,
100 WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK,
101 WFD_POP_RESP_APRV_ENTER_PIN_YES,
102 WFD_POP_RESP_APRV_ENTER_PIN_NO,
105 #ifdef WFD_SCREEN_MIRRORING_ENABLED
107 WFD_POP_SCREEN_MIRROR_NONE,
108 WFD_POP_SCREEN_MIRROR_DISCONNECT_BY_RECONNECT_WIFI_AP,
114 char text[WFD_POP_STR_MAX_LEN];
115 char label1[WFD_POP_STR_MAX_LEN];
116 char label2[WFD_POP_STR_MAX_LEN];
125 char mac_address[18];
126 unsigned int category;
127 bool is_miracast_device;
132 char peer_name[DEV_NAME_LENGTH+1];
133 char peer_addr[MACSTR_LENGTH+1];
134 unsigned int device_type;
136 wifi_direct_wps_type_e wps_type;
137 char wps_pin[PIN_LENGTH+1];
139 } wfd_connection_info_s;
144 Evas_Object *pin_entry;
145 Evas_Object *conformant;
147 Evas_Object *back_grnd;
148 wfd_popup_t *popup_data;
149 uint popup_timeout_handle;
151 wfd_connection_info_s *connection;
154 #ifdef NOT_CONNECTED_INDICATOR_ICON
155 notification_h noti_wifi_direct_on;
157 notification_h noti_wifi_direct_connected;
158 notification_h noti_screen_mirroring_on;
159 notification_h noti_screen_mirroring_play;
160 wfd_device_info_t raw_connected_peers[WFD_MAX_CONNECTED_PEER];
161 int raw_connected_peer_cnt;
164 wifi_direct_state_e wfd_status;
165 int last_wfd_transmit_time;
166 Ecore_Timer *transmit_timer;
168 /* auto deactivation after 5 mins if not connected*/
169 #ifdef WFD_FIVE_MIN_IDLE_DEACTIVATION
170 Ecore_Timer *monitor_timer;
172 wifi_direct_state_e last_wfd_status;
175 Ecore_Event_Handler *rotate_event_handler;
177 #ifdef WFD_SCREEN_MIRRORING_ENABLED
178 int screen_mirroring_state;
182 Elm_Genlist_Item_Class *pin_entry_itc;
183 Elm_Genlist_Item_Class *pin_desc_itc;
184 Elm_Genlist_Item_Class *paswd_itc;
186 /*Mac address for connecting device*/
187 char mac_addr_connecting[MACSTR_LENGTH];
189 /* Down Key Press Handler */
190 Ecore_Event_Handler *downkey_handler;
195 Evas_Object *progressbar;
197 } wfd_wps_display_popup_t;
199 extern wfd_appdata_t *wfd_get_appdata();
202 * This function let the app do initialization
203 * @return If success, return TRUE, else return FALSE
204 * @param[in] ad the pointer to the main data structure
206 bool init_wfd_client(wfd_appdata_t *ad);
209 * This function let the app do de-initialization
210 * @return If success, return TRUE, else return FALSE
211 * @param[in] ad the pointer to the main data structure
213 int deinit_wfd_client(wfd_appdata_t *ad);
215 void wfd_app_util_del_notification(wfd_appdata_t *ad);
216 Eina_Bool wfd_automatic_deactivated_for_connection_cb(void *user_data);
217 int wfd_app_util_deregister_hard_key_down_cb(void *data);
218 int wfd_app_get_connected_peers(void *user_data);
219 int wfd_app_client_switch_off(void *data);
222 * This function let the app destroy the popup
226 extern void wfd_destroy_popup();
229 * This function let the app create a popup
231 * @param[in] type the type of popup
232 * @param[in] userdata the pointer to the data which will be used
234 extern void wfd_prepare_popup(int type, void *userdata);
236 #endif /* __WFD_SYS_POPAPP_MAIN_H__ */