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;
55 if (ev->button == 3) {
60 /*static void keydown_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
62 Evas_Event_Key_Down *ev = event_info;
63 if (!strcmp(ev->keyname, KEY_BACK)) {
69 * This function let the ug make a callback for click the button in popup
71 * @param[in] data the pointer to the main data structure
72 * @param[in] obj the pointer to the evas object
73 * @param[in] event_info the pointer to the event information
75 static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
77 __WFD_APP_FUNC_ENTER__;
78 wfd_appdata_t *ad = wfd_get_appdata();
79 wfd_connection_info_s *connection = ad->connection;
81 int resp = (int) data;
82 char msg[WFD_POP_STR_MAX_LEN] = {0};
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 snprintf(msg, WFD_POP_STR_MAX_LEN, D_("IDS_WIFI_POP_FAILED_TO_CONNECT_TO_PS"),
100 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 snprintf(msg, WFD_POP_STR_MAX_LEN, D_("IDS_WIFI_POP_FAILED_TO_CONNECT_TO_PS"),
152 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 snprintf(msg, WFD_POP_STR_MAX_LEN, D_("IDS_WIFI_POP_FAILED_TO_CONNECT_TO_PS"),
164 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);
254 ecore_timer_del(pb_timer);
257 __WFD_APP_FUNC_EXIT__;
262 * This function let the app create a popup which includes no button
264 * @param[in] win the window object
265 * @param[in] pop the pointer to the prepared popup
267 static Evas_Object *wfd_draw_pop_type_a(Evas_Object * win, wfd_popup_t * pop)
269 __WFD_APP_FUNC_ENTER__;
271 wfd_appdata_t *ad = wfd_get_appdata();
274 popup = elm_popup_add(win);
275 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
276 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __popup_resp_cb, NULL);
277 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
278 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
279 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
280 elm_object_domain_translatable_text_set(popup, PACKAGE, pop->text);
281 elm_popup_timeout_set(popup, pop->timeout);
283 evas_object_show(popup);
284 evas_object_show(win);
286 __WFD_APP_FUNC_EXIT__;
291 * This function let the app create a popup which includes one button
293 * @param[in] win the window object
294 * @param[in] pop the pointer to the prepared popup
296 static Evas_Object *wfd_draw_pop_type_b(Evas_Object * win, wfd_popup_t * pop)
298 __WFD_APP_FUNC_ENTER__;
299 Evas_Object *popup = NULL;
300 Evas_Object *btn = NULL;
301 wfd_appdata_t *ad = wfd_get_appdata();
303 popup = elm_popup_add(win);
304 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
305 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __popup_resp_cb, (void *) pop->resp_data1);
306 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
307 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
308 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
309 elm_object_domain_translatable_text_set(popup, PACKAGE, pop->text);
311 btn = elm_button_add(popup);
312 elm_object_style_set(btn, "popup");
313 elm_object_domain_translatable_text_set(btn, PACKAGE, pop->label1);
314 elm_object_part_content_set(popup, "button1", btn);
315 evas_object_smart_callback_add(btn, "clicked", __popup_resp_cb, (void *) pop->resp_data1);
317 evas_object_show(popup);
318 evas_object_show(win);
320 __WFD_APP_FUNC_EXIT__;
325 * This function let the app create a popup which includes two buttons
327 * @param[in] win the window object
328 * @param[in] pop the pointer to the prepared popup
330 static Evas_Object *wfd_draw_pop_type_c(Evas_Object * win, wfd_popup_t * pop)
332 __WFD_APP_FUNC_ENTER__;
333 Evas_Object *popup = NULL;
334 Evas_Object *btn1 = NULL, *btn2 = NULL;
335 wfd_appdata_t *ad = wfd_get_appdata();
337 popup = elm_popup_add(win);
338 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
339 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __popup_resp_cb, (void *) pop->resp_data2);
340 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
341 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
342 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
343 elm_object_domain_translatable_part_text_set(popup, "title,text",
344 PACKAGE, D_("IDS_WIFI_HEADER_WI_FI_DIRECT_CONNECTION_ABB"));
345 elm_object_domain_translatable_text_set(popup, PACKAGE, pop->text);
347 btn1 = elm_button_add(popup);
348 elm_object_style_set(btn1, "popup");
349 elm_object_domain_translatable_text_set(btn1, PACKAGE, pop->label2);
350 elm_object_part_content_set(popup, "button1", btn1);
351 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
352 (void *) pop->resp_data2);
354 btn2 = elm_button_add(popup);
355 elm_object_style_set(btn2, "popup");
356 elm_object_domain_translatable_text_set(btn2, PACKAGE, pop->label1);
357 elm_object_part_content_set(popup, "button2", btn2);
358 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
359 (void *) pop->resp_data1);
361 evas_object_show(popup);
362 evas_object_show(win);
364 __WFD_APP_FUNC_EXIT__;
368 static void _wfd_ug_automatic_turn_off_popup_cb(void *data, Evas_Object *obj, void *event_info)
370 __WFD_APP_FUNC_ENTER__;
371 wfd_appdata_t *ad = wfd_get_appdata();
374 evas_object_del(ad->popup);
379 evas_object_hide(ad->win);
382 __WFD_APP_FUNC_EXIT__;
385 Evas_Object *wfd_draw_pop_type_auto_deactivation(Evas_Object *win, void *userdata)
387 __WFD_APP_FUNC_ENTER__;
389 Evas_Object *popup = NULL;
390 Evas_Object *btn = NULL;
391 char popup_text[MAX_POPUP_TEXT_SIZE] = {0};
392 wfd_appdata_t *ad = wfd_get_appdata();
394 popup = elm_popup_add(win);
395 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
396 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _wfd_ug_automatic_turn_off_popup_cb, userdata);
397 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
398 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
399 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
400 elm_object_domain_translatable_part_text_set(popup, "title,text",
401 PACKAGE, "IDS_WIFI_BODY_WI_FI_DIRECT_ABB");
402 snprintf(popup_text, MAX_POPUP_TEXT_SIZE,
403 "IDS_WIFI_POP_THERE_HAS_BEEN_NO_ACTIVITY_FOR_PD_MINUTES_SINCE_WI_FI_DIRECT_WAS_ENABLED_MSG", 5);
404 elm_object_domain_translatable_text_set(popup, PACKAGE, popup_text);
406 btn = elm_button_add(popup);
407 elm_object_style_set(btn, "popup");
408 elm_object_domain_translatable_text_set(btn, PACKAGE, "IDS_BR_SK_OK");
409 elm_object_part_content_set(popup, "button1", btn);
410 evas_object_smart_callback_add(btn, "clicked", _wfd_ug_automatic_turn_off_popup_cb, userdata);
412 evas_object_show(popup);
413 evas_object_show(win);
415 __WFD_APP_FUNC_EXIT__;
420 * This function let the ug make a change callback for password input
422 * @param[in] data the pointer to the main data structure
423 * @param[in] obj the pointer to the evas object
424 * @param[in] event_info the pointer to the event information
426 static void _smart_ime_cb(void *data, Evas_Object * obj, void *event_info)
428 __WFD_APP_FUNC_ENTER__;
429 wfd_appdata_t *ad = wfd_get_appdata();
430 wfd_connection_info_s *connection = ad->connection;
432 Ecore_IMF_Context *imf_context = NULL;
433 imf_context = (Ecore_IMF_Context *) ad->pin_entry;
435 if (NULL == imf_context) {
436 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Error!!! Ecore_IMF_Context is NULL!!");
440 char *txt = elm_entry_markup_to_utf8(elm_entry_entry_get((const Evas_Object *) imf_context));
442 WFD_APP_LOG(WFD_APP_LOG_LOW, "* text [%s], len=[%d]", txt, strlen(txt));
443 strncpy(connection->wps_pin, txt, sizeof(connection->wps_pin) - 1);
444 WFD_IF_FREE_MEM(txt);
446 WFD_APP_LOG(WFD_APP_LOG_LOW, "Err!");
449 __WFD_APP_FUNC_EXIT__;
453 * This function let the app make a callback for progressbar timer
454 * @return if stop the timer, return ECORE_CALLBACK_CANCEL, else return ECORE_CALLBACK_RENEW
455 * @param[in] data the pointer to the wps structure
457 static Eina_Bool _fn_pb_timer(void *data)
461 char time_label[32] = {0};
462 wfd_wps_display_popup_t *wps_display_popup = (wfd_wps_display_popup_t *) data;
464 if (NULL == wps_display_popup) {
465 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Param is NULL.\n");
466 return ECORE_CALLBACK_CANCEL;
469 Evas_Object *progressbar = NULL;
470 Evas_Object *time = NULL;
472 progressbar = wps_display_popup->progressbar;
473 time = wps_display_popup->time;
474 value = elm_progressbar_value_get(progressbar);
476 wps_display_popup->step++;
477 step = wps_display_popup->step;
478 value = ((double)step) / WFD_POP_TIMER_120;
481 WFD_APP_LOG(WFD_APP_LOG_LOW, "Progress end.\n");
483 ecore_timer_del(pb_timer);
487 return ECORE_CALLBACK_CANCEL;
490 elm_progressbar_value_set(progressbar, value);
491 WFD_APP_LOG(WFD_APP_LOG_LOW, "step: %d, value: %f\n", wps_display_popup->step, value);
493 /* show the time label */
496 snprintf(time_label, 32, "00:0%d", step);
498 snprintf(time_label, 32, "00:%d", step);
502 snprintf(time_label, 32, "0%d:0%d", step/60, step%60);
504 snprintf(time_label, 32, "0%d:%d", step/60, step%60);
508 char *remaining_time_str = g_strdup_printf(
509 "<font_size=40><align=center>%s</align></font_size>", time_label);
510 elm_object_text_set(time, remaining_time_str);
511 g_free(remaining_time_str);
513 return ECORE_CALLBACK_RENEW;
516 static Eina_Bool _keypad_popup_timer_cb(void *data)
518 __WFD_APP_FUNC_ENTER__;
520 char msg1[WFD_POP_STR_MAX_LEN] = {0};
521 char msg2[WFD_POP_STR_MAX_LEN] = {0};
522 char label_str[WFD_POP_STR_MAX_LEN] = {0, };
524 Evas_Object *label = (Evas_Object*) data;
525 wfd_appdata_t *ad = wfd_get_appdata();
526 wfd_connection_info_s *connection = ad->connection;
527 WFD_RETV_IF(NULL == ad, FALSE, "NULL parameters(ad)\n");
528 WFD_RETV_IF(NULL == label, FALSE, "NULL parameters(label)\n");
529 if (NULL == ad->popup) {
530 keypad_popup_timeout = 0;
531 return ECORE_CALLBACK_CANCEL;
534 keypad_popup_timeout --;
536 if (keypad_popup_timeout > 0) {
537 _replace_1PS_2PD((char *)msg1, sizeof(msg1),
538 D_("IDS_ST_BODY_CONNECT_WITH_PS_IN_PD_SECS_ABB"),
539 connection->peer_name, keypad_popup_timeout);
541 snprintf(msg2, sizeof(msg2), D_("IDS_WIFI_POP_ENTER_PIN_TO_CONNECT_TO_PS"),
542 connection->peer_name);
543 snprintf(label_str, sizeof(label_str), "%s %s", msg1, msg2);
544 elm_object_domain_translatable_text_set(label, PACKAGE, label_str);
548 if (keypad_popup_timeout <= 0) {
550 keypad_popup_timeout = 0;
551 __WFD_APP_FUNC_EXIT__;
552 return ECORE_CALLBACK_CANCEL;
555 __WFD_APP_FUNC_EXIT__;
556 return ECORE_CALLBACK_RENEW;
559 /* This callback is for showing(hiding) X marked button. */
560 /*static void _changed_cb(void *data, Evas_Object *obj, void *event_info)
562 if (elm_object_focus_get(obj)) {
563 if (elm_entry_is_empty(obj))
564 elm_object_signal_emit(data, "elm,state,eraser,hide", "");
566 elm_object_signal_emit(data, "elm,state,eraser,show", "");
570 /* Focused callback will show X marked button and hide guidetext. */
571 /*static void _focused_cb(void *data, Evas_Object *obj, void *event_info)
573 if (!elm_entry_is_empty(obj))
574 elm_object_signal_emit(data, "elm,state,eraser,show", "");
575 elm_object_signal_emit(data, "elm,state,rename,hide", "");
578 /* Unfocused callback will show guidetext and hide X marked button. */
579 /*static void _unfocused_cb(void *data, Evas_Object *obj, void *event_info)
581 elm_object_signal_emit(data, "elm,state,eraser,hide", "");
582 elm_object_signal_emit(data, "elm,state,rename,show", "");
585 /* When X marked button clicked, make string as empty. */
586 /*static void _eraser_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
588 elm_object_focus_set(data, EINA_TRUE);
589 elm_entry_entry_set(data, "");
593 * This function let the app create a edit filed
595 * @param[in] parent the parent object
596 * @param[in] title the pointer to the title of edit field
597 * @param[in] guide the pointer to the text of guide
598 * @param[in] single_line whether it can support single line
599 * @param[in] is_editable whether it is avaliable to edit
601 /*static Evas_Object *_add_edit_field(Evas_Object *parent, const char *title, const char *guide, Eina_Bool single_line, Eina_Bool is_editable)
603 assertm_if(NULL == parent, "parent is NULL!!");
605 Evas_Object *layout = elm_layout_add(parent);
606 assertm_if(NULL == layout, "layout is NULL!!");
608 if (title && title[0] != '\0') {
609 elm_layout_theme_set(layout, "layout", "dialogue/editfield/title", "default");
610 elm_object_part_text_set(layout, "elm.text", title);
612 elm_layout_theme_set(layout, "layout", "dialogue/editfield", "default");
615 Evas_Object *entry = elm_entry_add(layout);
616 assertm_if(NULL == entry, "entry is NULL!!");
618 if (guide && guide[0] != '\0') {
619 elm_object_part_text_set(layout, "elm.guidetext", guide);
622 evas_object_smart_callback_add(entry, "changed", _changed_cb, layout);
623 evas_object_smart_callback_add(entry, "focused", _focused_cb, layout);
624 evas_object_smart_callback_add(entry, "unfocused", _unfocused_cb, layout);
626 elm_object_part_content_set(layout, "elm.icon.entry", entry);
627 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
628 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
630 elm_entry_single_line_set(entry, single_line);
631 elm_entry_scrollable_set(entry, single_line);
633 Evas_Object *button = elm_button_add(parent);
634 elm_object_style_set(button, "editfield_clear");
635 elm_object_part_content_set(layout, "elm.icon.eraser", button);
636 evas_object_smart_callback_add(button, "clicked", _eraser_btn_clicked_cb, entry);
641 * This function let the app create a display popup
642 * @return display popup
643 * @param[in] win the window object
644 * @param[in] pop the pointer to the prepared popup
646 Evas_Object *wfd_draw_pop_type_display(Evas_Object * win, wfd_popup_t * pop)
648 __WFD_APP_FUNC_ENTER__;
649 WFD_APP_LOG(WFD_APP_LOG_LOW, "wfd_draw_pop_type_display\n");
651 Evas_Object *popup = NULL;
652 Evas_Object *progressbar = NULL;
653 Evas_Object *time = NULL;
655 static wfd_wps_display_popup_t wps_display_popup;
656 wfd_appdata_t *ad = wfd_get_appdata();
658 popup = elm_popup_add(win);
659 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
660 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
661 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
662 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, 0.0);
663 elm_object_domain_translatable_part_text_set(popup, "title,text",
664 PACKAGE, D_("IDS_WIFI_HEADER_WI_FI_DIRECT_CONNECTION_ABB"));
666 layout = elm_layout_add(popup);
667 if (layout == NULL) {
668 WFD_APP_LOG(WFD_APP_LOG_LOW, "Layout failed so returning !!");
672 elm_layout_file_set(layout, WFD_EDJ_POPUP_PATH, "popup_wps_pin_layout");
673 elm_object_domain_translatable_part_text_set(layout, "elm.text.description",
675 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
677 /* add progressbar */
678 progressbar = elm_progressbar_add(layout);
679 elm_object_style_set(progressbar, "list_progress");
680 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
681 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
682 evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
683 elm_progressbar_value_set(progressbar, 0.0);
684 evas_object_show(progressbar);
687 time = elm_label_add(layout);
688 elm_label_line_wrap_set(time, ELM_WRAP_MIXED);
689 elm_object_text_set(time, D_("<font_size=40><align=center>00:00</align></font_size>"));
690 evas_object_size_hint_weight_set(time, EVAS_HINT_EXPAND, 0.0);
691 evas_object_size_hint_align_set(time, EVAS_HINT_FILL, EVAS_HINT_FILL);
692 evas_object_show(time);
694 elm_object_part_content_set(layout, "slider", progressbar);
695 elm_object_part_content_set(layout, "timer_label", time);
698 /* start progressbar timer */
699 wps_display_popup.step = 0;
700 wps_display_popup.progressbar = progressbar;
701 wps_display_popup.time = time;
702 pb_timer = ecore_timer_add(1, _fn_pb_timer, &wps_display_popup);
705 if (pop->resp_data2 == WFD_POP_RESP_APRV_CONNECT_NO) {
706 Evas_Object *btn2 = NULL;
707 btn2 = elm_button_add(popup);
708 elm_object_style_set(btn2, "popup");
709 elm_object_domain_translatable_text_set(btn2, PACKAGE, pop->label2);
710 elm_object_part_content_set(popup, "button1", btn2);
711 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
712 (void *) pop->resp_data2);
713 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __popup_resp_cb, (void *) pop->resp_data2);
716 if (pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES || pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_PBC_YES ) {
717 Evas_Object *btn1 = NULL;
718 btn1 = elm_button_add(popup);
719 elm_object_style_set(btn1, "popup");
720 elm_object_domain_translatable_text_set(btn1, PACKAGE, pop->label1);
721 elm_object_part_content_set(popup, "button2", btn1);
722 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
723 (void *) pop->resp_data1);
724 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __popup_resp_cb, (void *) pop->resp_data1);
727 elm_object_content_set(popup, layout);
728 evas_object_show(popup);
729 evas_object_show(win);
731 __WFD_APP_FUNC_EXIT__;
735 static void __popup_eraser_clicked_cb(void *data, Evas_Object *obj, void *event_info)
737 __WFD_APP_FUNC_ENTER__;
738 elm_entry_entry_set(data, "");
739 __WFD_APP_FUNC_EXIT__;
742 static void _entry_changed_cb(void *data, Evas_Object *obj, void *event_info)
744 __WFD_APP_FUNC_ENTER__;
745 if (elm_object_part_content_get(obj, "elm.swallow.clear")) {
746 if (elm_object_focus_get(obj)) {
747 if (elm_entry_is_empty(obj))
748 elm_object_signal_emit(obj, "elm,state,clear,hidden", "");
750 elm_object_signal_emit(obj, "elm,state,clear,visible", "");
753 __WFD_APP_FUNC_EXIT__;
756 static void _entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
758 __WFD_APP_FUNC_ENTER__;
760 if (elm_object_part_content_get(obj, "elm.swallow.clear")) {
761 if (!elm_entry_is_empty(obj))
762 elm_object_signal_emit(obj, "elm,state,clear,visible", "");
764 elm_object_signal_emit(obj, "elm,state,clear,hidden", "");
766 elm_object_signal_emit(obj, "elm,state,focus,on", "");
767 __WFD_APP_FUNC_EXIT__;
770 static void _entry_keydown_cb(void *data, Evas *e, Evas_Object *obj,
773 __WFD_APP_FUNC_ENTER__;
775 Evas_Event_Key_Down *ev;
776 Evas_Object *entry = obj;
778 WFD_RET_IF(data == NULL, "Incorrect parameter data(NULL)\n");
779 WFD_RET_IF(event_info == NULL, "Incorrect parameter event_info(NULL)\n");
780 WFD_RET_IF(entry == NULL, "Incorrect parameter entry(NULL)\n");
782 ev = (Evas_Event_Key_Down *)event_info;
784 if (g_strcmp0(ev->key, "KP_Enter") == 0 || g_strcmp0(ev->key, "Return") == 0) {
785 Ecore_IMF_Context *imf_context;
787 imf_context = (Ecore_IMF_Context*)elm_entry_imf_context_get(entry);
789 ecore_imf_context_input_panel_hide(imf_context);
792 elm_object_focus_set(entry, EINA_FALSE);
796 static char *__wfd_main_desc_label_get(void *data, Evas_Object *obj,
799 __WFD_APP_FUNC_ENTER__;
800 if (obj == NULL || part == NULL) {
803 WFD_APP_LOG(WFD_APP_LOG_LOW, "wfd_rename desc\n");
804 char buf[WFD_POP_STR_MAX_LEN] = {0, };
805 char msg1[WFD_POP_STR_MAX_LEN] = {0, };
806 char msg2[WFD_POP_STR_MAX_LEN] = {0, };
807 wfd_appdata_t *ad = wfd_get_appdata();
808 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
809 wfd_connection_info_s *connection = ad->connection;
810 WFD_RETV_IF(connection == NULL, NULL, "Incorrect parameter(NULL)\n");
812 if (!strcmp("elm.text.multiline", part)) {
813 if (keypad_popup_timeout > 0) {
814 ad->timeout = keypad_popup_timeout;
816 _replace_1PS_2PD((char *)msg1, WFD_POP_STR_MAX_LEN,
817 D_("IDS_ST_BODY_CONNECT_WITH_PS_IN_PD_SECS_ABB"),
818 connection->peer_name, ad->timeout);
820 snprintf(msg2, WFD_POP_STR_MAX_LEN,
821 D_("IDS_WIFI_POP_ENTER_PIN_TO_CONNECT_TO_PS"),
822 connection->peer_name);
824 WFD_APP_LOG(WFD_APP_LOG_LOW, "string %s %s", msg1, msg2);
825 snprintf(buf, WFD_POP_STR_MAX_LEN,
826 "<font_size=30>%s %s</font_size>",
828 __WFD_APP_FUNC_EXIT__;
829 return g_strdup(buf);
831 __WFD_APP_FUNC_EXIT__;
835 static Evas_Object *__wfd_pin_entry_icon_get(void *data, Evas_Object *obj,
838 __WFD_APP_FUNC_ENTER__;
839 if (obj == NULL || part == NULL) {
842 wfd_appdata_t *ad = wfd_get_appdata();
843 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
844 Evas_Object *entry = NULL;
845 Evas_Object *button = NULL;
846 Ecore_IMF_Context *imf_context;
847 if (g_strcmp0(part, "elm.icon.entry")) {
848 __WFD_APP_FUNC_EXIT__;
851 static Elm_Entry_Filter_Accept_Set accept_set = {"0123456789", NULL};
852 entry = elm_entry_add(obj);
853 elm_entry_single_line_set(entry, EINA_TRUE);
854 elm_object_style_set(entry, "editfield");
855 elm_entry_scrollable_set(entry, EINA_TRUE);
857 eext_entry_selection_back_event_allow_set(entry, EINA_TRUE);
858 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
859 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
860 elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
861 elm_entry_password_set(entry, EINA_TRUE);
862 elm_entry_prediction_allow_set(entry, EINA_FALSE);
864 elm_entry_markup_filter_append(entry,
865 elm_entry_filter_accept_set,&accept_set);
866 elm_entry_input_panel_layout_set(entry,
867 ELM_INPUT_PANEL_LAYOUT_DATETIME);
868 elm_object_signal_emit(entry, "elm,action,hide,search_icon", "");
869 elm_object_domain_translatable_part_text_set(entry, "elm.guide",
870 PACKAGE, D_("IDS_WIFI_POP_PIN"));
871 elm_entry_input_panel_return_key_autoenabled_set(entry,EINA_TRUE);
872 elm_entry_input_panel_return_key_type_set(entry,
873 ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
875 ad->pin_entry = entry;
876 imf_context = (Ecore_IMF_Context*)elm_entry_imf_context_get(entry);
878 ecore_imf_context_input_panel_return_key_type_set(imf_context,
879 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
882 button = elm_button_add(obj);
883 elm_object_style_set(button, "search_clear");
884 elm_object_focus_allow_set(button, EINA_FALSE);
885 elm_object_part_content_set(entry, "elm.swallow.clear", button);
886 evas_object_smart_callback_add(button, "clicked",
887 __popup_eraser_clicked_cb, entry);
889 elm_object_signal_emit (entry, "elm,action,hide,search_icon", "");
890 evas_object_smart_callback_add(entry, "changed",
891 _entry_changed_cb, NULL);
892 evas_object_smart_callback_add(entry, "preedit,changed",
893 _entry_changed_cb, NULL);
894 evas_object_smart_callback_add(entry, "focused",
895 _entry_focused_cb, NULL);
896 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN,
897 _entry_keydown_cb, ad);
899 elm_object_content_set(obj,entry);
900 evas_object_show(entry);
901 evas_object_smart_callback_add(entry, "changed", _smart_ime_cb, NULL);
902 elm_object_focus_set(entry, EINA_TRUE);
903 __WFD_APP_FUNC_EXIT__;
907 static void _chk_changed_cb(void *data, Evas_Object *obj, void *ei)
909 __WFD_APP_FUNC_ENTER__;
910 if (obj == NULL || data == NULL) {
913 Eina_Bool state = elm_check_state_get(obj);
915 elm_entry_password_set((Evas_Object *)data, EINA_FALSE);
917 elm_entry_password_set((Evas_Object *)data, EINA_TRUE);
919 __WFD_APP_FUNC_EXIT__;
922 static void _gl_pswd_check_box_sel(void *data, Evas_Object *obj, void *ei)
924 __WFD_APP_FUNC_ENTER__;
925 Elm_Object_Item *item = NULL;
926 item = (Elm_Object_Item *)ei;
930 wfd_appdata_t *ad = wfd_get_appdata();
932 WFD_APP_LOG(WFD_APP_LOG_LOW, "Incorrect parameter(NULL)\n");
935 Evas_Object *ck = elm_object_item_part_content_get(ei, "elm.icon.left");
936 elm_genlist_item_selected_set(item, EINA_FALSE);
937 Eina_Bool state = elm_check_state_get(ck);
938 elm_check_state_set(ck, !state);
940 _chk_changed_cb(ad->pin_entry, ck, NULL);
942 __WFD_APP_FUNC_EXIT__;
945 static char *__wfd_password_label(void *data, Evas_Object *obj, const char *part)
947 __WFD_APP_FUNC_ENTER__;
949 if (data == NULL || part == NULL) {
952 WFD_APP_LOG(WFD_APP_LOG_LOW, "Part %s", part);
954 if (!strcmp("elm.text", part)) {
955 __WFD_APP_FUNC_EXIT__;
956 return g_strdup(" Show password");
958 __WFD_APP_FUNC_EXIT__;
962 static Evas_Object *__wfd_password_check(void *data, Evas_Object *obj,
965 __WFD_APP_FUNC_ENTER__;
966 if (obj == NULL || part == NULL) {
969 wfd_appdata_t *ad = wfd_get_appdata();
970 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
971 Evas_Object *check = NULL;
973 WFD_APP_LOG(WFD_APP_LOG_LOW, "Part %s", part);
975 if (!strcmp("elm.swallow.icon", part)) {
976 check = elm_check_add(obj);
977 evas_object_propagate_events_set(check, EINA_FALSE);
978 evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
979 evas_object_size_hint_weight_set(check,
980 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
981 evas_object_smart_callback_add(check, "changed",
982 _chk_changed_cb, ad->pin_entry);
983 elm_object_focus_allow_set(check, EINA_FALSE);
984 __WFD_APP_FUNC_EXIT__;
987 __WFD_APP_FUNC_EXIT__;
993 * This function let the app create a keypad popup
994 * @return keypad popup
995 * @param[in] win the window object
996 * @param[in] pop the pointer to the prepared popup
998 Evas_Object *wfd_draw_pop_type_keypad(Evas_Object * win, wfd_popup_t * pop)
1000 __WFD_APP_FUNC_ENTER__;
1001 wfd_appdata_t *ad = wfd_get_appdata();
1002 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
1003 wfd_connection_info_s *connection = ad->connection;
1004 WFD_RETV_IF(connection == NULL, NULL, "Incorrect parameter(NULL)\n");
1006 Evas_Object *pinpopup = NULL;
1007 Evas_Object *btn1 = NULL, *btn2 = NULL;
1008 Evas_Object *genlist = NULL;
1009 Elm_Object_Item *git = NULL;
1011 ad->timeout = pop->timeout;
1013 pinpopup = elm_popup_add(ad->layout);
1014 elm_popup_align_set(pinpopup, ELM_NOTIFY_ALIGN_FILL, 1.0);
1015 eext_object_event_callback_add(pinpopup, EEXT_CALLBACK_BACK, eext_popup_back_cb,
1017 evas_object_size_hint_weight_set(pinpopup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1018 elm_object_domain_translatable_part_text_set(pinpopup, "title,text",
1019 PACKAGE, D_("IDS_WIFI_HEADER_WI_FI_DIRECT_CONNECTION_ABB"));
1021 genlist = elm_genlist_add(pinpopup);
1022 elm_genlist_homogeneous_set(genlist, EINA_TRUE);
1023 evas_object_size_hint_weight_set(genlist,
1024 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1025 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
1026 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1027 elm_scroller_content_min_limit(genlist, EINA_FALSE, EINA_TRUE);
1029 /* Entry genlist item */
1030 ad->pin_desc_itc = elm_genlist_item_class_new();
1031 if(ad->pin_desc_itc != NULL) {
1032 ad->pin_desc_itc->item_style = WFD_GENLIST_MULTILINE_TEXT_STYLE;
1033 ad->pin_desc_itc->func.text_get = __wfd_main_desc_label_get;
1034 ad->pin_desc_itc->func.content_get = NULL;
1035 ad->pin_desc_itc->func.state_get = NULL;
1036 ad->pin_desc_itc->func.del = NULL;
1038 git = elm_genlist_item_append(genlist, ad->pin_desc_itc, ad, NULL,
1039 ELM_GENLIST_ITEM_NONE, NULL, NULL);
1041 elm_genlist_item_select_mode_set(git,
1042 ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1044 keypad_popup_timeout = pop->timeout;
1045 keypad_popup_timer = ecore_timer_add(1, _keypad_popup_timer_cb,
1049 ad->pin_entry_itc = elm_genlist_item_class_new();
1050 if(ad->pin_entry_itc != NULL) {
1051 ad->pin_entry_itc->item_style = "entry";
1052 ad->pin_entry_itc->func.text_get = NULL;
1053 ad->pin_entry_itc->func.content_get = __wfd_pin_entry_icon_get;
1054 ad->pin_entry_itc->func.state_get = NULL;
1055 ad->pin_entry_itc->func.del = NULL;
1057 elm_genlist_item_append(genlist, ad->pin_entry_itc, pinpopup,
1058 NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1061 ad->paswd_itc = elm_genlist_item_class_new();
1062 if(ad->paswd_itc != NULL) {
1063 ad->paswd_itc->item_style = WFD_GENLIST_1LINE_TEXT_ICON_STYLE;
1064 ad->paswd_itc->func.text_get = __wfd_password_label;
1065 ad->paswd_itc->func.content_get = __wfd_password_check;
1066 ad->paswd_itc->func.state_get = NULL;
1067 ad->paswd_itc->func.del = NULL;
1069 elm_genlist_item_append(genlist, ad->paswd_itc, pinpopup,
1070 NULL, ELM_GENLIST_ITEM_NONE, _gl_pswd_check_box_sel, (void *)ad );
1073 btn1 = elm_button_add(pinpopup);
1074 elm_object_style_set(btn1, "popup");
1075 elm_object_domain_translatable_text_set(btn1, PACKAGE, pop->label2);
1076 elm_object_part_content_set(pinpopup, "button1", btn1);
1077 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
1078 (void *)pop->resp_data2);
1080 btn2 = elm_button_add(pinpopup);
1081 elm_object_style_set(btn2, "popup");
1082 elm_object_domain_translatable_text_set(btn2, PACKAGE, pop->label1);
1083 elm_object_part_content_set(pinpopup, "button2", btn2);
1084 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
1085 (void *)pop->resp_data1);
1086 #if defined(GENLIST_REALIZATION_MOTE_SET)
1087 elm_genlist_realization_mode_set(genlist, EINA_TRUE);
1089 evas_object_show(genlist);
1090 elm_object_content_set(pinpopup, genlist);
1092 evas_object_show(pinpopup);
1093 evas_object_show(win);
1094 elm_object_focus_set(ad->pin_entry, EINA_TRUE);
1096 __WFD_APP_FUNC_EXIT__;
1101 void _replace_int(char *haystack, int size, char *niddle, int value)
1103 __WFD_APP_FUNC_ENTER__;
1108 if (haystack == NULL || niddle == NULL || size <= 1)
1111 buf = g_strdup(haystack);
1112 p = strstr(buf, niddle);
1117 q = p + strlen(niddle);
1120 snprintf(haystack, size-1, "%s%d%s", buf, value, q);
1122 __WFD_APP_FUNC_EXIT__;
1125 void _replace_1PS_2PD(char *buf, int buf_len, char *format_str, char* SD_1, int PD_2)
1127 __WFD_APP_FUNC_ENTER__;
1128 char text[WFD_POP_STR_MAX_LEN] = {0, };
1130 strncpy(text, format_str, WFD_POP_STR_MAX_LEN-1);
1131 _replace_int(text, WFD_POP_STR_MAX_LEN, "%d", PD_2);
1132 _replace_int(text, WFD_POP_STR_MAX_LEN, "%2$d", PD_2);
1133 snprintf(buf, buf_len-1, text, SD_1);
1134 __WFD_APP_FUNC_EXIT__;
1139 * This function let the app create a popup
1141 * @param[in] type the type of popup
1142 * @param[in] userdata the pointer to the data which will be used
1144 void wfd_prepare_popup(int type, void *user_data)
1146 __WFD_APP_FUNC_ENTER__;
1147 wfd_appdata_t *ad = wfd_get_appdata();
1148 wfd_popup_t *pop = ad->popup_data;
1149 wfd_connection_info_s *connection = ad->connection;
1150 char text[WFD_POP_STR_MAX_LEN+1] = {0, };
1151 char text1[WFD_POP_STR_MAX_LEN+1] = {0, };
1152 wfd_destroy_popup();
1154 peer_name = elm_entry_utf8_to_markup(connection->peer_name);
1156 memset(pop, 0, sizeof(wfd_popup_t));
1160 switch (pop->type) {
1161 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ:
1163 _replace_1PS_2PD((char *)pop->text, sizeof(pop->text),
1164 D_("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1165 peer_name, WFD_POP_TIMER_120);
1167 snprintf(pop->label1, sizeof(pop->label1), "%s", D_("IDS_WIFI_SK2_OK"));
1168 snprintf(pop->label2, sizeof(pop->label2), "%s", D_("IDS_WIFI_SK_CANCEL"));
1169 pop->timeout = WFD_POP_TIMER_120;
1170 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_PBC_YES;
1171 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1173 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
1176 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ:
1177 snprintf(pop->text, sizeof(pop->text),
1178 D_("IDS_WIFI_BODY_PS_IS_REQUESTING_A_WI_FI_DIRECT_CONNECTION_ALLOW_Q"),
1180 snprintf(pop->label1, sizeof(pop->label1), "%s", D_("IDS_WIFI_BUTTON_ALLOW"));
1181 snprintf(pop->label2, sizeof(pop->label2), "%s", D_("IDS_BR_SK_CANCEL"));
1182 pop->timeout = WFD_POP_TIMER_120;
1183 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK;
1184 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1186 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
1189 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ:
1190 _replace_1PS_2PD((char *)pop->text, sizeof(pop->text),
1191 D_("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1192 peer_name, WFD_POP_TIMER_120);
1193 snprintf(pop->label1, sizeof(pop->label1), "%s", D_("IDS_BR_SK_OK"));
1194 snprintf(pop->label2, sizeof(pop->label2), "%s", D_("IDS_BR_SK_CANCEL"));
1195 pop->timeout = WFD_POP_TIMER_120;
1196 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES;
1197 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1199 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
1202 case /* MT */ WFD_POP_PROG_CONNECT:
1203 snprintf(pop->text, sizeof(pop->text), "%s", D_("IDS_WIFI_BODY_CONNECTING_ING"));
1204 snprintf(pop->label1, sizeof(pop->label1), "%s", D_("IDS_BR_SK_CANCEL"));
1205 pop->timeout = WFD_POP_TIMER_120;
1206 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
1208 ad->popup = wfd_draw_pop_type_b(ad->win, pop);
1211 case /* MO */ WFD_POP_PROG_CONNECT_WITH_KEYPAD:
1212 _replace_1PS_2PD((char *)text, sizeof(text),
1213 D_("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1214 peer_name, WFD_POP_TIMER_120);
1216 snprintf(text1, WFD_POP_STR_MAX_LEN, "%s %s",
1217 text, D_("IDS_WIFI_POP_ENTER_PIN_TO_CONNECT_TO_PS"));
1219 snprintf(pop->text, sizeof(pop->text), text1, connection->peer_name);
1221 snprintf(pop->label1, sizeof(pop->label1), "%s", D_("IDS_WIFI_SK_CONNECT"));
1222 snprintf(pop->label2, sizeof(pop->label2), "%s", D_("IDS_BR_SK_CANCEL"));
1223 pop->timeout = WFD_POP_TIMER_120;
1224 pop->resp_data1 = WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK;
1225 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1227 ad->popup = wfd_draw_pop_type_keypad(ad->win, pop);
1230 case /* MO/MT */ WFD_POP_PROG_CONNECT_WITH_PIN:
1231 _replace_1PS_2PD((char *)text, sizeof(text),
1232 D_("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1233 peer_name, WFD_POP_TIMER_120);
1235 snprintf(text1, WFD_POP_STR_MAX_LEN, "%s %s %s",
1238 D_("IDS_WIFI_POP_PIN_CODE_PS"));
1239 snprintf(pop->text, sizeof(pop->text), text1, connection->wps_pin);
1241 snprintf(pop->label2, sizeof(pop->label2), "%s", D_("IDS_BR_SK_CANCEL"));
1242 pop->timeout = WFD_POP_TIMER_120;
1243 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1245 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
1248 case WFD_POP_PROG_CONNECT_CANCEL:
1249 snprintf(pop->text, sizeof(pop->text), "%s", D_("IDS_BR_SK_CANCEL"));
1250 pop->timeout = WFD_POP_TIMER_120;
1251 ad->popup = wfd_draw_pop_type_a(ad->win, pop);
1260 ret = feedback_play(FEEDBACK_PATTERN_GENERAL);
1261 if (ret != FEEDBACK_ERROR_NONE) {
1262 WFD_APP_LOG(WFD_APP_LOG_ERROR,"feedback_play error : %d\n", ret);
1264 WFD_IF_FREE_MEM(peer_name);
1265 __WFD_APP_FUNC_EXIT__;