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 implements wifi direct system popup view functions.
23 * @file wfd-app-popup-view.c
24 * @author Sungsik Jang (sungsik.jang@samsung.com)
31 #include <Elementary.h>
33 #include <notification.h>
35 #include <efl_extension.h>
38 #include "wfd-app-strings.h"
39 #include "wfd-app-util.h"
40 #include "wfd-app-popup-view.h"
42 extern wfd_appdata_t *g_wfd_ad;
43 extern wfd_popup_t *g_wfd_pop;
44 extern unsigned char g_wfd_peer_mac[6];
45 extern unsigned char g_wfd_peer_name[32];
46 static Ecore_Timer *pb_timer = NULL;
47 static Ecore_Timer *keypad_popup_timer = NULL;
48 static int keypad_popup_timeout = 0;
50 void _replace_1PS_2PD(char *buf, int buf_len, char *format_str, char* SD_1, int PD_2);
52 static void mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
54 Evas_Event_Mouse_Up *ev = event_info;
59 /*static void keydown_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
61 Evas_Event_Key_Down *ev = event_info;
62 if (!strcmp(ev->keyname, KEY_BACK)) {
68 * This function let the ug make a callback for click the button in popup
70 * @param[in] data the pointer to the main data structure
71 * @param[in] obj the pointer to the evas object
72 * @param[in] event_info the pointer to the event information
74 static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
76 __WFD_APP_FUNC_ENTER__;
77 wfd_appdata_t *ad = wfd_get_appdata();
78 wfd_connection_info_s *connection = ad->connection;
80 unsigned long int resp = (unsigned long int) data;
81 char msg[WFD_POP_STR_MAX_LEN] = {0};
82 char *format_str = NULL;
84 WFD_APP_LOG(WFD_APP_LOG_HIGH, "popup resp : %d\n", resp);
87 case /* MT */ WFD_POP_RESP_APRV_CONNECT_PBC_YES:
89 WFD_APP_LOG(WFD_APP_LOG_HIGH,
90 "WFD_POP_RESP_APRV_CONNECT_PBC_YES\n");
93 result = wifi_direct_accept_connection(connection->peer_addr);
94 if (result != WIFI_DIRECT_ERROR_NONE) {
95 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to accept connection(%d)", result);
96 evas_object_hide(ad->win);
98 /* tickernoti popup */
99 format_str = D_("IDS_WIFI_POP_FAILED_TO_CONNECT_TO_PS");
100 snprintf(msg, WFD_POP_STR_MAX_LEN, format_str, connection->peer_name);
101 notification_status_message_post(msg);
103 WFD_APP_LOG(WFD_APP_LOG_LOW, "Succeeded to accept connection");
107 case /* MT */ WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK:
109 WFD_APP_LOG(WFD_APP_LOG_HIGH,
110 "WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK\n");
113 result = wifi_direct_accept_connection(connection->peer_addr);
114 if (result == WIFI_DIRECT_ERROR_NONE) {
115 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_PIN, NULL);
117 WFD_APP_LOG(WFD_APP_LOG_LOW,
118 "wifi_direct_accept_connection() failed. result=[%d]\n", result);
119 /* tickernoti popup */
120 notification_status_message_post(D_("IDS_WIFI_POP_FAILED_TO_CONNECT_TO_PS"));
125 case /* MO */ WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK:
128 WFD_APP_LOG(WFD_APP_LOG_HIGH,
129 "WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK\n");
133 int len = strlen(connection->wps_pin);
134 WFD_APP_LOGSECURE(WFD_APP_LOG_LOW, "PIN [%s]", connection->wps_pin);
136 if (len < 8 || len > 64) {
137 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Error, Incorrect PIN!!\n");
138 keypad_popup_timeout--;
139 /* tickernoti popup */
140 notification_status_message_post(D_("IDS_COM_BODY_PINS_DO_NOT_MATCH"));
142 /* redraw the popup */
143 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
146 keypad_popup_timeout = 0;
148 result = wifi_direct_set_wps_pin(connection->wps_pin);
149 if (result != WIFI_DIRECT_ERROR_NONE) {
150 /* tickernoti popup */
151 format_str = D_("IDS_WIFI_POP_FAILED_TO_CONNECT_TO_PS");
152 snprintf(msg, WFD_POP_STR_MAX_LEN, format_str, connection->peer_name);
153 notification_status_message_post(msg);
157 result = wifi_direct_accept_connection(connection->peer_addr);
158 if (result != WIFI_DIRECT_ERROR_NONE) {
159 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to accept connection(%d)", result);
160 evas_object_hide(ad->win);
162 /* tickernoti popup */
163 format_str = D_("IDS_WIFI_POP_FAILED_TO_CONNECT_TO_PS");
164 snprintf(msg, WFD_POP_STR_MAX_LEN, format_str, connection->peer_name);
165 notification_status_message_post(msg);
167 WFD_APP_LOG(WFD_APP_LOG_LOW, "Succeeded to connect with [%s]", connection->peer_addr);
171 case /* MT */ WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES:
173 WFD_APP_LOG(WFD_APP_LOG_HIGH,
174 "WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES\n");
177 ecore_timer_del(pb_timer);
181 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
185 case /* MT */ WFD_POP_RESP_APRV_CONNECT_NO:
187 WFD_APP_LOG(WFD_APP_LOG_HIGH,
188 "WFD_POP_RESP_APRV_CONNECT_NO: destroy_popup...\n");
190 if (connection->peer_addr[0] != '\0') {
191 result = wifi_direct_reject_connection(connection->peer_addr);
192 if (result != WIFI_DIRECT_ERROR_NONE)
193 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to reject connection(%d)", result);
195 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Peer's address is Zero MAC");
199 ecore_timer_del(pb_timer);
204 keypad_popup_timeout = 0;
210 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Unknown respone\n");
216 __WFD_APP_FUNC_EXIT__;
220 * This function let the app destroy the popup
224 void wfd_destroy_popup()
226 __WFD_APP_FUNC_ENTER__;
227 wfd_appdata_t *ad = wfd_get_appdata();
230 WFD_APP_LOG(WFD_APP_LOG_ERROR, "ad is NULL\n");
234 if (keypad_popup_timer) {
235 ecore_timer_del(keypad_popup_timer);
236 keypad_popup_timer = NULL;
240 evas_object_del(ad->popup);
244 if (ad->popup_timeout_handle > 0) {
245 g_source_remove(ad->popup_timeout_handle);
246 ad->popup_timeout_handle = 0;
250 evas_object_hide(ad->win);
253 ecore_timer_del(pb_timer);
256 __WFD_APP_FUNC_EXIT__;
261 * This function let the app create a popup which includes no button
263 * @param[in] win the window object
264 * @param[in] pop the pointer to the prepared popup
266 static Evas_Object *wfd_draw_pop_type_a(Evas_Object * win, wfd_popup_t * pop)
268 __WFD_APP_FUNC_ENTER__;
270 wfd_appdata_t *ad = wfd_get_appdata();
273 popup = elm_popup_add(win);
274 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
275 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __popup_resp_cb, NULL);
276 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
277 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
278 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
279 elm_object_domain_translatable_text_set(popup, PACKAGE, pop->text);
280 elm_popup_timeout_set(popup, pop->timeout);
282 evas_object_show(popup);
283 evas_object_show(win);
285 __WFD_APP_FUNC_EXIT__;
290 * This function let the app create a popup which includes one button
292 * @param[in] win the window object
293 * @param[in] pop the pointer to the prepared popup
295 static Evas_Object *wfd_draw_pop_type_b(Evas_Object * win, wfd_popup_t * pop)
297 __WFD_APP_FUNC_ENTER__;
298 Evas_Object *popup = NULL;
299 Evas_Object *btn = NULL;
300 wfd_appdata_t *ad = wfd_get_appdata();
302 popup = elm_popup_add(win);
303 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
304 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __popup_resp_cb, (void *) (intptr_t) pop->resp_data1);
305 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
306 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
307 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
308 elm_object_domain_translatable_text_set(popup, PACKAGE, pop->text);
310 btn = elm_button_add(popup);
311 elm_object_style_set(btn, "popup");
312 elm_object_domain_translatable_text_set(btn, PACKAGE, pop->label1);
313 elm_object_part_content_set(popup, "button1", btn);
314 evas_object_smart_callback_add(btn, "clicked", __popup_resp_cb, (void *) (intptr_t) pop->resp_data1);
316 evas_object_show(popup);
317 evas_object_show(win);
319 __WFD_APP_FUNC_EXIT__;
324 * This function let the app create a popup which includes two buttons
326 * @param[in] win the window object
327 * @param[in] pop the pointer to the prepared popup
329 static Evas_Object *wfd_draw_pop_type_c(Evas_Object * win, wfd_popup_t * pop)
331 __WFD_APP_FUNC_ENTER__;
332 Evas_Object *popup = NULL;
333 Evas_Object *btn1 = NULL, *btn2 = NULL;
334 wfd_appdata_t *ad = wfd_get_appdata();
336 popup = elm_popup_add(win);
337 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
338 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __popup_resp_cb, (void *) (intptr_t) pop->resp_data2);
339 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
340 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
341 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
342 elm_object_domain_translatable_part_text_set(popup, "title,text",
343 PACKAGE, D_("IDS_WIFI_HEADER_WI_FI_DIRECT_CONNECTION_ABB"));
344 elm_object_domain_translatable_text_set(popup, PACKAGE, pop->text);
346 btn1 = elm_button_add(popup);
347 elm_object_style_set(btn1, "popup");
348 elm_object_domain_translatable_text_set(btn1, PACKAGE, pop->label2);
349 elm_object_part_content_set(popup, "button1", btn1);
350 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
351 (void *) (intptr_t) pop->resp_data2);
353 btn2 = elm_button_add(popup);
354 elm_object_style_set(btn2, "popup");
355 elm_object_domain_translatable_text_set(btn2, PACKAGE, pop->label1);
356 elm_object_part_content_set(popup, "button2", btn2);
357 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
358 (void *) (intptr_t) pop->resp_data1);
360 evas_object_show(popup);
361 evas_object_show(win);
363 __WFD_APP_FUNC_EXIT__;
367 static void _wfd_ug_automatic_turn_off_popup_cb(void *data, Evas_Object *obj, void *event_info)
369 __WFD_APP_FUNC_ENTER__;
370 wfd_appdata_t *ad = wfd_get_appdata();
373 evas_object_del(ad->popup);
378 evas_object_hide(ad->win);
380 __WFD_APP_FUNC_EXIT__;
383 Evas_Object *wfd_draw_pop_type_auto_deactivation(Evas_Object *win, void *userdata)
385 __WFD_APP_FUNC_ENTER__;
387 Evas_Object *popup = NULL;
388 Evas_Object *btn = NULL;
389 char popup_text[MAX_POPUP_TEXT_SIZE] = {0};
390 char *format_str = NULL;
391 wfd_appdata_t *ad = wfd_get_appdata();
393 popup = elm_popup_add(win);
394 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
395 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _wfd_ug_automatic_turn_off_popup_cb, userdata);
396 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
397 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
398 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
399 elm_object_domain_translatable_part_text_set(popup, "title,text",
400 PACKAGE, "IDS_WIFI_BODY_WI_FI_DIRECT_ABB");
401 format_str = D_("IDS_WIFI_POP_THERE_HAS_BEEN_NO_ACTIVITY_FOR_PD_MINUTES_SINCE_WI_FI_DIRECT_WAS_ENABLED_MSG");
402 snprintf(popup_text, MAX_POPUP_TEXT_SIZE, format_str, 5);
403 elm_object_domain_translatable_text_set(popup, PACKAGE, popup_text);
405 btn = elm_button_add(popup);
406 elm_object_style_set(btn, "popup");
407 elm_object_domain_translatable_text_set(btn, PACKAGE, "IDS_BR_SK_OK");
408 elm_object_part_content_set(popup, "button1", btn);
409 evas_object_smart_callback_add(btn, "clicked", _wfd_ug_automatic_turn_off_popup_cb, userdata);
411 evas_object_show(popup);
412 evas_object_show(win);
414 __WFD_APP_FUNC_EXIT__;
419 * This function let the ug make a change callback for password input
421 * @param[in] data the pointer to the main data structure
422 * @param[in] obj the pointer to the evas object
423 * @param[in] event_info the pointer to the event information
425 static void _smart_ime_cb(void *data, Evas_Object * obj, void *event_info)
427 __WFD_APP_FUNC_ENTER__;
428 wfd_appdata_t *ad = wfd_get_appdata();
429 wfd_connection_info_s *connection = ad->connection;
431 Ecore_IMF_Context *imf_context = NULL;
432 imf_context = (Ecore_IMF_Context *) ad->pin_entry;
434 if (NULL == imf_context) {
435 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Error!!! Ecore_IMF_Context is NULL!!");
439 char *txt = elm_entry_markup_to_utf8(elm_entry_entry_get((const Evas_Object *) imf_context));
441 WFD_APP_LOG(WFD_APP_LOG_LOW, "* text [%s], len=[%d]", txt, strlen(txt));
442 strncpy(connection->wps_pin, txt, sizeof(connection->wps_pin) - 1);
443 WFD_IF_FREE_MEM(txt);
445 WFD_APP_LOG(WFD_APP_LOG_LOW, "Err!");
448 __WFD_APP_FUNC_EXIT__;
452 * This function let the app make a callback for progressbar timer
453 * @return if stop the timer, return ECORE_CALLBACK_CANCEL, else return ECORE_CALLBACK_RENEW
454 * @param[in] data the pointer to the wps structure
456 static Eina_Bool _fn_pb_timer(void *data)
460 char time_label[32] = {0};
461 wfd_wps_display_popup_t *wps_display_popup = (wfd_wps_display_popup_t *) data;
463 if (NULL == wps_display_popup) {
464 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Param is NULL.\n");
465 return ECORE_CALLBACK_CANCEL;
468 Evas_Object *progressbar = NULL;
469 Evas_Object *time = NULL;
471 progressbar = wps_display_popup->progressbar;
472 time = wps_display_popup->time;
473 value = elm_progressbar_value_get(progressbar);
475 wps_display_popup->step++;
476 step = wps_display_popup->step;
477 value = ((double)step) / WFD_POP_TIMER_120;
480 WFD_APP_LOG(WFD_APP_LOG_LOW, "Progress end.\n");
482 ecore_timer_del(pb_timer);
486 return ECORE_CALLBACK_CANCEL;
489 elm_progressbar_value_set(progressbar, value);
490 WFD_APP_LOG(WFD_APP_LOG_LOW, "step: %d, value: %f\n", wps_display_popup->step, value);
492 /* show the time label */
495 snprintf(time_label, 32, "00:0%d", step);
497 snprintf(time_label, 32, "00:%d", step);
500 snprintf(time_label, 32, "0%d:0%d", step/60, step%60);
502 snprintf(time_label, 32, "0%d:%d", step/60, step%60);
505 char *remaining_time_str = g_strdup_printf(
506 "<font_size=40><align=center>%s</align></font_size>", time_label);
507 elm_object_text_set(time, remaining_time_str);
508 g_free(remaining_time_str);
510 return ECORE_CALLBACK_RENEW;
513 static Eina_Bool _keypad_popup_timer_cb(void *data)
515 __WFD_APP_FUNC_ENTER__;
517 char msg1[WFD_POP_STR_MAX_LEN] = {0};
518 char msg2[WFD_POP_STR_MAX_LEN] = {0};
519 char label_str[WFD_POP_STR_MAX_LEN] = {0, };
520 char * format_str = NULL;
522 Evas_Object *label = (Evas_Object*) data;
523 wfd_appdata_t *ad = wfd_get_appdata();
524 wfd_connection_info_s *connection = NULL;
526 WFD_RETV_IF(NULL == ad, FALSE, "NULL parameters(ad)\n");
527 WFD_RETV_IF(NULL == label, FALSE, "NULL parameters(label)\n");
528 if (NULL == ad->popup) {
529 keypad_popup_timeout = 0;
530 return ECORE_CALLBACK_CANCEL;
533 connection = ad->connection;
535 keypad_popup_timeout--;
537 if (keypad_popup_timeout > 0) {
538 _replace_1PS_2PD((char *)msg1, sizeof(msg1),
539 D_("IDS_ST_BODY_CONNECT_WITH_PS_IN_PD_SECS_ABB"),
540 connection->peer_name, keypad_popup_timeout);
542 format_str = D_("IDS_WIFI_POP_ENTER_PIN_TO_CONNECT_TO_PS");
543 snprintf(msg2, sizeof(msg2), format_str, connection->peer_name);
544 snprintf(label_str, sizeof(label_str), "%s %s", msg1, msg2);
545 elm_object_domain_translatable_text_set(label, PACKAGE, label_str);
549 if (keypad_popup_timeout <= 0) {
551 keypad_popup_timeout = 0;
552 __WFD_APP_FUNC_EXIT__;
553 return ECORE_CALLBACK_CANCEL;
556 __WFD_APP_FUNC_EXIT__;
557 return ECORE_CALLBACK_RENEW;
560 /* This callback is for showing(hiding) X marked button. */
561 /*static void _changed_cb(void *data, Evas_Object *obj, void *event_info)
563 if (elm_object_focus_get(obj)) {
564 if (elm_entry_is_empty(obj))
565 elm_object_signal_emit(data, "elm,state,eraser,hide", "");
567 elm_object_signal_emit(data, "elm,state,eraser,show", "");
571 /* Focused callback will show X marked button and hide guidetext. */
572 /*static void _focused_cb(void *data, Evas_Object *obj, void *event_info)
574 if (!elm_entry_is_empty(obj))
575 elm_object_signal_emit(data, "elm,state,eraser,show", "");
576 elm_object_signal_emit(data, "elm,state,rename,hide", "");
579 /* Unfocused callback will show guidetext and hide X marked button. */
580 /*static void _unfocused_cb(void *data, Evas_Object *obj, void *event_info)
582 elm_object_signal_emit(data, "elm,state,eraser,hide", "");
583 elm_object_signal_emit(data, "elm,state,rename,show", "");
586 /* When X marked button clicked, make string as empty. */
587 /*static void _eraser_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
589 elm_object_focus_set(data, EINA_TRUE);
590 elm_entry_entry_set(data, "");
594 * This function let the app create a edit filed
596 * @param[in] parent the parent object
597 * @param[in] title the pointer to the title of edit field
598 * @param[in] guide the pointer to the text of guide
599 * @param[in] single_line whether it can support single line
600 * @param[in] is_editable whether it is available to edit
602 /*static Evas_Object *_add_edit_field(Evas_Object *parent, const char *title, const char *guide, Eina_Bool single_line, Eina_Bool is_editable)
604 assertm_if(NULL == parent, "parent is NULL!!");
606 Evas_Object *layout = elm_layout_add(parent);
607 assertm_if(NULL == layout, "layout is NULL!!");
609 if (title && title[0] != '\0') {
610 elm_layout_theme_set(layout, "layout", "dialogue/editfield/title", "default");
611 elm_object_part_text_set(layout, "elm.text", title);
613 elm_layout_theme_set(layout, "layout", "dialogue/editfield", "default");
616 Evas_Object *entry = elm_entry_add(layout);
617 assertm_if(NULL == entry, "entry is NULL!!");
619 if (guide && guide[0] != '\0') {
620 elm_object_part_text_set(layout, "elm.guidetext", guide);
623 evas_object_smart_callback_add(entry, "changed", _changed_cb, layout);
624 evas_object_smart_callback_add(entry, "focused", _focused_cb, layout);
625 evas_object_smart_callback_add(entry, "unfocused", _unfocused_cb, layout);
627 elm_object_part_content_set(layout, "elm.icon.entry", entry);
628 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
629 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
631 elm_entry_single_line_set(entry, single_line);
632 elm_entry_scrollable_set(entry, single_line);
634 Evas_Object *button = elm_button_add(parent);
635 elm_object_style_set(button, "editfield_clear");
636 elm_object_part_content_set(layout, "elm.icon.eraser", button);
637 evas_object_smart_callback_add(button, "clicked", _eraser_btn_clicked_cb, entry);
642 * This function let the app create a display popup
643 * @return display popup
644 * @param[in] win the window object
645 * @param[in] pop the pointer to the prepared popup
647 Evas_Object *wfd_draw_pop_type_display(Evas_Object * win, wfd_popup_t * pop)
649 __WFD_APP_FUNC_ENTER__;
650 WFD_APP_LOG(WFD_APP_LOG_LOW, "wfd_draw_pop_type_display\n");
652 Evas_Object *popup = NULL;
653 Evas_Object *progressbar = NULL;
654 Evas_Object *time = NULL;
656 static wfd_wps_display_popup_t wps_display_popup;
657 wfd_appdata_t *ad = wfd_get_appdata();
659 popup = elm_popup_add(win);
660 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
661 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
662 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
663 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, 0.0);
664 elm_object_domain_translatable_part_text_set(popup, "title,text",
665 PACKAGE, D_("IDS_WIFI_HEADER_WI_FI_DIRECT_CONNECTION_ABB"));
667 layout = elm_layout_add(popup);
668 if (layout == NULL) {
669 WFD_APP_LOG(WFD_APP_LOG_LOW, "Layout failed so returning !!");
673 elm_layout_file_set(layout, WFD_EDJ_POPUP_PATH, "popup_wps_pin_layout");
674 elm_object_domain_translatable_part_text_set(layout, "elm.text.description",
676 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
678 /* add progressbar */
679 progressbar = elm_progressbar_add(layout);
680 elm_object_style_set(progressbar, "list_progress");
681 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
682 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
683 evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
684 elm_progressbar_value_set(progressbar, 0.0);
685 evas_object_show(progressbar);
688 time = elm_label_add(layout);
689 elm_label_line_wrap_set(time, ELM_WRAP_MIXED);
690 elm_object_text_set(time, D_("<font_size=40><align=center>00:00</align></font_size>"));
691 evas_object_size_hint_weight_set(time, EVAS_HINT_EXPAND, 0.0);
692 evas_object_size_hint_align_set(time, EVAS_HINT_FILL, EVAS_HINT_FILL);
693 evas_object_show(time);
695 elm_object_part_content_set(layout, "slider", progressbar);
696 elm_object_part_content_set(layout, "timer_label", time);
699 /* start progressbar timer */
700 wps_display_popup.step = 0;
701 wps_display_popup.progressbar = progressbar;
702 wps_display_popup.time = time;
703 pb_timer = ecore_timer_add(1, _fn_pb_timer, &wps_display_popup);
706 if (pop->resp_data2 == WFD_POP_RESP_APRV_CONNECT_NO) {
707 Evas_Object *btn2 = NULL;
708 btn2 = elm_button_add(popup);
709 elm_object_style_set(btn2, "popup");
710 elm_object_domain_translatable_text_set(btn2, PACKAGE, pop->label2);
711 elm_object_part_content_set(popup, "button1", btn2);
712 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
713 (void *) (intptr_t) pop->resp_data2);
714 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __popup_resp_cb,
715 (void *) (intptr_t) pop->resp_data2);
718 if (pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES || pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_PBC_YES) {
719 Evas_Object *btn1 = NULL;
720 btn1 = elm_button_add(popup);
721 elm_object_style_set(btn1, "popup");
722 elm_object_domain_translatable_text_set(btn1, PACKAGE, pop->label1);
723 elm_object_part_content_set(popup, "button2", btn1);
724 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
725 (void *) (intptr_t) pop->resp_data1);
726 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __popup_resp_cb,
727 (void *) (intptr_t) pop->resp_data1);
730 elm_object_content_set(popup, layout);
731 evas_object_show(popup);
732 evas_object_show(win);
734 __WFD_APP_FUNC_EXIT__;
738 static void __popup_eraser_clicked_cb(void *data, Evas_Object *obj, void *event_info)
740 __WFD_APP_FUNC_ENTER__;
741 elm_entry_entry_set(data, "");
742 __WFD_APP_FUNC_EXIT__;
745 static void _entry_changed_cb(void *data, Evas_Object *obj, void *event_info)
747 __WFD_APP_FUNC_ENTER__;
748 if (elm_object_part_content_get(obj, "elm.swallow.clear")) {
749 if (elm_object_focus_get(obj)) {
750 if (elm_entry_is_empty(obj))
751 elm_object_signal_emit(obj, "elm,state,clear,hidden", "");
753 elm_object_signal_emit(obj, "elm,state,clear,visible", "");
756 __WFD_APP_FUNC_EXIT__;
759 static void _entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
761 __WFD_APP_FUNC_ENTER__;
763 if (elm_object_part_content_get(obj, "elm.swallow.clear")) {
764 if (!elm_entry_is_empty(obj))
765 elm_object_signal_emit(obj, "elm,state,clear,visible", "");
767 elm_object_signal_emit(obj, "elm,state,clear,hidden", "");
769 elm_object_signal_emit(obj, "elm,state,focus,on", "");
770 __WFD_APP_FUNC_EXIT__;
773 static void _entry_keydown_cb(void *data, Evas *e, Evas_Object *obj,
776 __WFD_APP_FUNC_ENTER__;
778 Evas_Event_Key_Down *ev;
779 Evas_Object *entry = obj;
781 WFD_RET_IF(data == NULL, "Incorrect parameter data(NULL)\n");
782 WFD_RET_IF(event_info == NULL, "Incorrect parameter event_info(NULL)\n");
783 WFD_RET_IF(entry == NULL, "Incorrect parameter entry(NULL)\n");
785 ev = (Evas_Event_Key_Down *)event_info;
787 if (g_strcmp0(ev->key, "KP_Enter") == 0 || g_strcmp0(ev->key, "Return") == 0) {
788 Ecore_IMF_Context *imf_context;
790 imf_context = (Ecore_IMF_Context*)elm_entry_imf_context_get(entry);
792 ecore_imf_context_input_panel_hide(imf_context);
794 elm_object_focus_set(entry, EINA_FALSE);
798 static char *__wfd_main_desc_label_get(void *data, Evas_Object *obj,
801 __WFD_APP_FUNC_ENTER__;
802 if (obj == NULL || part == NULL)
805 WFD_APP_LOG(WFD_APP_LOG_LOW, "wfd_rename desc\n");
806 char buf[WFD_POP_STR_MAX_LEN] = {0, };
807 char msg1[WFD_POP_STR_MAX_LEN] = {0, };
808 char msg2[WFD_POP_STR_MAX_LEN] = {0, };
809 char *format_str = NULL;
810 wfd_appdata_t *ad = wfd_get_appdata();
811 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
812 wfd_connection_info_s *connection = ad->connection;
813 WFD_RETV_IF(connection == NULL, NULL, "Incorrect parameter(NULL)\n");
815 if (!strcmp("elm.text.multiline", part)) {
816 if (keypad_popup_timeout > 0)
817 ad->timeout = keypad_popup_timeout;
819 _replace_1PS_2PD((char *)msg1, WFD_POP_STR_MAX_LEN,
820 D_("IDS_ST_BODY_CONNECT_WITH_PS_IN_PD_SECS_ABB"),
821 connection->peer_name, ad->timeout);
823 format_str = D_("IDS_WIFI_POP_ENTER_PIN_TO_CONNECT_TO_PS");
824 snprintf(msg2, WFD_POP_STR_MAX_LEN, format_str, connection->peer_name);
826 WFD_APP_LOG(WFD_APP_LOG_LOW, "string %s %s", msg1, msg2);
827 snprintf(buf, WFD_POP_STR_MAX_LEN,
828 "<font_size=30>%s %s</font_size>",
830 __WFD_APP_FUNC_EXIT__;
831 return g_strdup(buf);
833 __WFD_APP_FUNC_EXIT__;
837 static Evas_Object *__wfd_pin_entry_icon_get(void *data, Evas_Object *obj,
840 __WFD_APP_FUNC_ENTER__;
841 if (obj == NULL || part == NULL)
844 wfd_appdata_t *ad = wfd_get_appdata();
845 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
846 Evas_Object *entry = NULL;
847 Evas_Object *button = NULL;
848 Ecore_IMF_Context *imf_context;
849 if (g_strcmp0(part, "elm.icon.entry")) {
850 __WFD_APP_FUNC_EXIT__;
853 static Elm_Entry_Filter_Accept_Set accept_set = {"0123456789", NULL};
854 entry = elm_entry_add(obj);
855 elm_entry_single_line_set(entry, EINA_TRUE);
856 elm_object_style_set(entry, "editfield");
857 elm_entry_scrollable_set(entry, EINA_TRUE);
859 eext_entry_selection_back_event_allow_set(entry, EINA_TRUE);
860 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
861 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
862 elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
863 elm_entry_password_set(entry, EINA_TRUE);
864 elm_entry_prediction_allow_set(entry, EINA_FALSE);
866 elm_entry_markup_filter_append(entry,
867 elm_entry_filter_accept_set, &accept_set);
868 elm_entry_input_panel_layout_set(entry,
869 ELM_INPUT_PANEL_LAYOUT_DATETIME);
870 elm_object_signal_emit(entry, "elm,action,hide,search_icon", "");
871 elm_object_domain_translatable_part_text_set(entry, "elm.guide",
872 PACKAGE, D_("IDS_WIFI_POP_PIN"));
873 elm_entry_input_panel_return_key_autoenabled_set(entry, EINA_TRUE);
874 elm_entry_input_panel_return_key_type_set(entry,
875 ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
877 ad->pin_entry = entry;
878 imf_context = (Ecore_IMF_Context*)elm_entry_imf_context_get(entry);
880 ecore_imf_context_input_panel_return_key_type_set(imf_context,
881 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
884 button = elm_button_add(obj);
885 elm_object_style_set(button, "search_clear");
886 elm_object_focus_allow_set(button, EINA_FALSE);
887 elm_object_part_content_set(entry, "elm.swallow.clear", button);
888 evas_object_smart_callback_add(button, "clicked",
889 __popup_eraser_clicked_cb, entry);
891 elm_object_signal_emit(entry, "elm,action,hide,search_icon", "");
892 evas_object_smart_callback_add(entry, "changed",
893 _entry_changed_cb, NULL);
894 evas_object_smart_callback_add(entry, "preedit,changed",
895 _entry_changed_cb, NULL);
896 evas_object_smart_callback_add(entry, "focused",
897 _entry_focused_cb, NULL);
898 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN,
899 _entry_keydown_cb, ad);
901 elm_object_content_set(obj, entry);
902 evas_object_show(entry);
903 evas_object_smart_callback_add(entry, "changed", _smart_ime_cb, NULL);
904 elm_object_focus_set(entry, EINA_TRUE);
905 __WFD_APP_FUNC_EXIT__;
909 static void _chk_changed_cb(void *data, Evas_Object *obj, void *ei)
911 __WFD_APP_FUNC_ENTER__;
912 if (obj == NULL || data == NULL)
915 Eina_Bool state = elm_check_state_get(obj);
917 elm_entry_password_set((Evas_Object *)data, EINA_FALSE);
919 elm_entry_password_set((Evas_Object *)data, EINA_TRUE);
921 __WFD_APP_FUNC_EXIT__;
924 static void _gl_pswd_check_box_sel(void *data, Evas_Object *obj, void *ei)
926 __WFD_APP_FUNC_ENTER__;
927 Elm_Object_Item *item = NULL;
928 item = (Elm_Object_Item *)ei;
932 wfd_appdata_t *ad = wfd_get_appdata();
934 WFD_APP_LOG(WFD_APP_LOG_LOW, "Incorrect parameter(NULL)\n");
937 Evas_Object *ck = elm_object_item_part_content_get(ei, "elm.icon.left");
938 elm_genlist_item_selected_set(item, EINA_FALSE);
939 Eina_Bool state = elm_check_state_get(ck);
940 elm_check_state_set(ck, !state);
942 _chk_changed_cb(ad->pin_entry, ck, NULL);
944 __WFD_APP_FUNC_EXIT__;
947 static char *__wfd_password_label(void *data, Evas_Object *obj, const char *part)
949 __WFD_APP_FUNC_ENTER__;
951 if (data == NULL || part == NULL)
954 WFD_APP_LOG(WFD_APP_LOG_LOW, "Part %s", part);
956 if (!strcmp("elm.text", part)) {
957 __WFD_APP_FUNC_EXIT__;
958 return g_strdup(" Show password");
960 __WFD_APP_FUNC_EXIT__;
964 static Evas_Object *__wfd_password_check(void *data, Evas_Object *obj,
967 __WFD_APP_FUNC_ENTER__;
968 if (obj == NULL || part == NULL)
971 wfd_appdata_t *ad = wfd_get_appdata();
972 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
973 Evas_Object *check = NULL;
975 WFD_APP_LOG(WFD_APP_LOG_LOW, "Part %s", part);
977 if (!strcmp("elm.swallow.icon", part)) {
978 check = elm_check_add(obj);
979 evas_object_propagate_events_set(check, EINA_FALSE);
980 evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
981 evas_object_size_hint_weight_set(check,
982 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
983 evas_object_smart_callback_add(check, "changed",
984 _chk_changed_cb, ad->pin_entry);
985 elm_object_focus_allow_set(check, EINA_FALSE);
986 __WFD_APP_FUNC_EXIT__;
989 __WFD_APP_FUNC_EXIT__;
995 * This function let the app create a keypad popup
996 * @return keypad popup
997 * @param[in] win the window object
998 * @param[in] pop the pointer to the prepared popup
1000 Evas_Object *wfd_draw_pop_type_keypad(Evas_Object * win, wfd_popup_t * pop)
1002 __WFD_APP_FUNC_ENTER__;
1003 wfd_appdata_t *ad = wfd_get_appdata();
1004 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
1005 wfd_connection_info_s *connection = ad->connection;
1006 WFD_RETV_IF(connection == NULL, NULL, "Incorrect parameter(NULL)\n");
1008 Evas_Object *pinpopup = NULL;
1009 Evas_Object *btn1 = NULL, *btn2 = NULL;
1010 Evas_Object *genlist = NULL;
1011 Elm_Object_Item *git = NULL;
1013 ad->timeout = pop->timeout;
1015 pinpopup = elm_popup_add(ad->layout);
1016 elm_popup_align_set(pinpopup, ELM_NOTIFY_ALIGN_FILL, 1.0);
1017 eext_object_event_callback_add(pinpopup, EEXT_CALLBACK_BACK, eext_popup_back_cb,
1019 evas_object_size_hint_weight_set(pinpopup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1020 elm_object_domain_translatable_part_text_set(pinpopup, "title,text",
1021 PACKAGE, D_("IDS_WIFI_HEADER_WI_FI_DIRECT_CONNECTION_ABB"));
1023 genlist = elm_genlist_add(pinpopup);
1024 elm_genlist_homogeneous_set(genlist, EINA_TRUE);
1025 evas_object_size_hint_weight_set(genlist,
1026 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1027 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
1028 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1029 elm_scroller_content_min_limit(genlist, EINA_FALSE, EINA_TRUE);
1031 /* Entry genlist item */
1032 ad->pin_desc_itc = elm_genlist_item_class_new();
1033 if (ad->pin_desc_itc != NULL) {
1034 ad->pin_desc_itc->item_style = WFD_GENLIST_MULTILINE_TEXT_STYLE;
1035 ad->pin_desc_itc->func.text_get = __wfd_main_desc_label_get;
1036 ad->pin_desc_itc->func.content_get = NULL;
1037 ad->pin_desc_itc->func.state_get = NULL;
1038 ad->pin_desc_itc->func.del = NULL;
1040 git = elm_genlist_item_append(genlist, ad->pin_desc_itc, ad, NULL,
1041 ELM_GENLIST_ITEM_NONE, NULL, NULL);
1043 elm_genlist_item_select_mode_set(git,
1044 ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1046 keypad_popup_timeout = pop->timeout;
1047 keypad_popup_timer = ecore_timer_add(1, _keypad_popup_timer_cb,
1051 ad->pin_entry_itc = elm_genlist_item_class_new();
1052 if (ad->pin_entry_itc != NULL) {
1053 ad->pin_entry_itc->item_style = "entry";
1054 ad->pin_entry_itc->func.text_get = NULL;
1055 ad->pin_entry_itc->func.content_get = __wfd_pin_entry_icon_get;
1056 ad->pin_entry_itc->func.state_get = NULL;
1057 ad->pin_entry_itc->func.del = NULL;
1059 elm_genlist_item_append(genlist, ad->pin_entry_itc, pinpopup,
1060 NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1063 ad->paswd_itc = elm_genlist_item_class_new();
1064 if (ad->paswd_itc != NULL) {
1065 ad->paswd_itc->item_style = WFD_GENLIST_1LINE_TEXT_ICON_STYLE;
1066 ad->paswd_itc->func.text_get = __wfd_password_label;
1067 ad->paswd_itc->func.content_get = __wfd_password_check;
1068 ad->paswd_itc->func.state_get = NULL;
1069 ad->paswd_itc->func.del = NULL;
1071 elm_genlist_item_append(genlist, ad->paswd_itc, pinpopup,
1072 NULL, ELM_GENLIST_ITEM_NONE, _gl_pswd_check_box_sel, (void *)ad);
1075 btn1 = elm_button_add(pinpopup);
1076 elm_object_style_set(btn1, "popup");
1077 elm_object_domain_translatable_text_set(btn1, PACKAGE, pop->label2);
1078 elm_object_part_content_set(pinpopup, "button1", btn1);
1079 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
1080 (void *) (intptr_t) pop->resp_data2);
1082 btn2 = elm_button_add(pinpopup);
1083 elm_object_style_set(btn2, "popup");
1084 elm_object_domain_translatable_text_set(btn2, PACKAGE, pop->label1);
1085 elm_object_part_content_set(pinpopup, "button2", btn2);
1086 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
1087 (void *) (intptr_t) pop->resp_data1);
1088 #if defined(GENLIST_REALIZATION_MOTE_SET)
1089 elm_genlist_realization_mode_set(genlist, EINA_TRUE);
1091 evas_object_show(genlist);
1092 elm_object_content_set(pinpopup, genlist);
1094 evas_object_show(pinpopup);
1095 evas_object_show(win);
1096 elm_object_focus_set(ad->pin_entry, EINA_TRUE);
1098 __WFD_APP_FUNC_EXIT__;
1103 void _replace_int(char *haystack, int size, char *niddle, int value)
1105 __WFD_APP_FUNC_ENTER__;
1110 if (haystack == NULL || niddle == NULL || size <= 1)
1113 buf = g_strdup(haystack);
1114 p = strstr(buf, niddle);
1119 q = p + strlen(niddle);
1122 snprintf(haystack, size-1, "%s%d%s", buf, value, q);
1124 __WFD_APP_FUNC_EXIT__;
1127 void _replace_1PS_2PD(char *buf, int buf_len, char *format_str, char* SD_1, int PD_2)
1129 __WFD_APP_FUNC_ENTER__;
1130 char text[WFD_POP_STR_MAX_LEN] = {0, };
1132 strncpy(text, format_str, WFD_POP_STR_MAX_LEN-1);
1133 _replace_int(text, WFD_POP_STR_MAX_LEN, "%d", PD_2);
1134 _replace_int(text, WFD_POP_STR_MAX_LEN, "%2$d", PD_2);
1135 snprintf(buf, buf_len-1, text, SD_1);
1136 __WFD_APP_FUNC_EXIT__;
1141 * This function let the app create a popup
1143 * @param[in] type the type of popup
1144 * @param[in] userdata the pointer to the data which will be used
1146 void wfd_prepare_popup(int type, void *user_data)
1148 __WFD_APP_FUNC_ENTER__;
1149 wfd_appdata_t *ad = wfd_get_appdata();
1150 wfd_popup_t *pop = ad->popup_data;
1151 wfd_connection_info_s *connection = ad->connection;
1152 char text[WFD_POP_STR_MAX_LEN+1] = {0, };
1153 char text1[WFD_POP_STR_MAX_LEN+1] = {0, };
1154 wfd_destroy_popup();
1156 char *format_str = NULL;
1158 peer_name = elm_entry_utf8_to_markup(connection->peer_name);
1160 memset(pop, 0, sizeof(wfd_popup_t));
1164 switch (pop->type) {
1165 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ:
1167 _replace_1PS_2PD((char *)pop->text, sizeof(pop->text),
1168 D_("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1169 peer_name, WFD_POP_TIMER_120);
1171 snprintf(pop->label1, sizeof(pop->label1), "%s", D_("IDS_WIFI_SK2_OK"));
1172 snprintf(pop->label2, sizeof(pop->label2), "%s", D_("IDS_WIFI_SK_CANCEL"));
1173 pop->timeout = WFD_POP_TIMER_120;
1174 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_PBC_YES;
1175 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1177 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
1180 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ:
1181 format_str = D_("IDS_WIFI_BODY_PS_IS_REQUESTING_A_WI_FI_DIRECT_CONNECTION_ALLOW_Q");
1182 snprintf(pop->text, sizeof(pop->text), format_str, peer_name);
1183 snprintf(pop->label1, sizeof(pop->label1), "%s", D_("IDS_WIFI_BUTTON_ALLOW"));
1184 snprintf(pop->label2, sizeof(pop->label2), "%s", D_("IDS_BR_SK_CANCEL"));
1185 pop->timeout = WFD_POP_TIMER_120;
1186 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK;
1187 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1189 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
1192 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ:
1193 _replace_1PS_2PD((char *)pop->text, sizeof(pop->text),
1194 D_("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1195 peer_name, WFD_POP_TIMER_120);
1196 snprintf(pop->label1, sizeof(pop->label1), "%s", D_("IDS_BR_SK_OK"));
1197 snprintf(pop->label2, sizeof(pop->label2), "%s", D_("IDS_BR_SK_CANCEL"));
1198 pop->timeout = WFD_POP_TIMER_120;
1199 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES;
1200 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1202 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
1205 case /* MT */ WFD_POP_PROG_CONNECT:
1206 snprintf(pop->text, sizeof(pop->text), "%s", D_("IDS_WIFI_BODY_CONNECTING_ING"));
1207 snprintf(pop->label1, sizeof(pop->label1), "%s", D_("IDS_BR_SK_CANCEL"));
1208 pop->timeout = WFD_POP_TIMER_120;
1209 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
1211 ad->popup = wfd_draw_pop_type_b(ad->win, pop);
1214 case /* MO */ WFD_POP_PROG_CONNECT_WITH_KEYPAD:
1215 _replace_1PS_2PD((char *)text, sizeof(text),
1216 D_("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1217 peer_name, WFD_POP_TIMER_120);
1219 snprintf(text1, WFD_POP_STR_MAX_LEN, "%s %s",
1220 text, D_("IDS_WIFI_POP_ENTER_PIN_TO_CONNECT_TO_PS"));
1222 snprintf(pop->text, sizeof(pop->text), text1, connection->peer_name);
1224 snprintf(pop->label1, sizeof(pop->label1), "%s", D_("IDS_WIFI_SK_CONNECT"));
1225 snprintf(pop->label2, sizeof(pop->label2), "%s", D_("IDS_BR_SK_CANCEL"));
1226 pop->timeout = WFD_POP_TIMER_120;
1227 pop->resp_data1 = WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK;
1228 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1230 ad->popup = wfd_draw_pop_type_keypad(ad->win, pop);
1233 case /* MO/MT */ WFD_POP_PROG_CONNECT_WITH_PIN:
1234 _replace_1PS_2PD((char *)text, sizeof(text),
1235 D_("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1236 peer_name, WFD_POP_TIMER_120);
1238 snprintf(text1, WFD_POP_STR_MAX_LEN, "%s %s %s",
1241 D_("IDS_WIFI_POP_PIN_CODE_PS"));
1242 snprintf(pop->text, sizeof(pop->text), text1, connection->wps_pin);
1244 snprintf(pop->label2, sizeof(pop->label2), "%s", D_("IDS_BR_SK_CANCEL"));
1245 pop->timeout = WFD_POP_TIMER_120;
1246 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1248 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
1251 case WFD_POP_PROG_CONNECT_CANCEL:
1252 snprintf(pop->text, sizeof(pop->text), "%s", D_("IDS_BR_SK_CANCEL"));
1253 pop->timeout = WFD_POP_TIMER_120;
1254 ad->popup = wfd_draw_pop_type_a(ad->win, pop);
1263 ret = feedback_play(FEEDBACK_PATTERN_GENERAL);
1264 if (ret != FEEDBACK_ERROR_NONE)
1265 WFD_APP_LOG(WFD_APP_LOG_ERROR, "feedback_play error : %d\n", ret);
1267 WFD_IF_FREE_MEM(peer_name);
1268 __WFD_APP_FUNC_EXIT__;