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>
32 #include <efl-assist/efl_assist.h>
34 #include <notification.h>
36 #include <wifi-direct.h>
37 #include <efl_extension.h>
40 #include "wfd-app-strings.h"
41 #include "wfd-app-util.h"
42 #include "wfd-app-popup-view.h"
44 extern wfd_appdata_t *g_wfd_ad;
45 extern wfd_popup_t *g_wfd_pop;
46 extern unsigned char g_wfd_peer_mac[6];
47 extern unsigned char g_wfd_peer_name[32];
48 static Ecore_Timer *pb_timer = NULL;
49 static Ecore_Timer *keypad_popup_timer = NULL;
50 static int keypad_popup_timeout = 0;
52 void _replace_1PS_2PD(char *buf, int buf_len, char *format_str, char* SD_1, int PD_2);
54 static void mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
56 Evas_Event_Mouse_Up *ev = event_info;
57 if (ev->button == 3) {
62 /*static void keydown_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
64 Evas_Event_Key_Down *ev = event_info;
65 if (!strcmp(ev->keyname, KEY_BACK)) {
71 * This function let the ug make a callback for click the button in popup
73 * @param[in] data the pointer to the main data structure
74 * @param[in] obj the pointer to the evas object
75 * @param[in] event_info the pointer to the event information
77 static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
79 __WFD_APP_FUNC_ENTER__;
80 wfd_appdata_t *ad = wfd_get_appdata();
81 wfd_connection_info_s *connection = ad->connection;
83 int resp = (int) data;
84 char msg[WFD_POP_STR_MAX_LEN] = {0};
86 WFD_APP_LOG(WFD_APP_LOG_HIGH, "popup resp : %d\n", resp);
88 if (ad->rotate_event_handler) {
89 ecore_event_handler_del(ad->rotate_event_handler);
90 ad->rotate_event_handler = NULL;
94 case /* MT */ WFD_POP_RESP_APRV_CONNECT_PBC_YES:
96 WFD_APP_LOG(WFD_APP_LOG_HIGH,
97 "WFD_POP_RESP_APRV_CONNECT_PBC_YES\n");
100 result = wifi_direct_accept_connection(connection->peer_addr);
101 if (result != WIFI_DIRECT_ERROR_NONE) {
102 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to accept connection(%d)", result);
103 evas_object_hide(ad->win);
105 /* tickernoti popup */
106 snprintf(msg, WFD_POP_STR_MAX_LEN, _("IDS_WIFI_POP_FAILED_TO_CONNECT_TO_PS"),
107 connection->peer_name);
108 notification_status_message_post(msg);
110 WFD_APP_LOG(WFD_APP_LOG_LOW, "Succeeded to accept connection");
114 case /* MT */ WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK:
116 WFD_APP_LOG(WFD_APP_LOG_HIGH,
117 "WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK\n");
120 result = wifi_direct_accept_connection(connection->peer_addr);
121 if (result == WIFI_DIRECT_ERROR_NONE) {
122 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_PIN, NULL);
124 WFD_APP_LOG(WFD_APP_LOG_LOW,
125 "wifi_direct_accept_connection() failed. result=[%d]\n", result);
126 /* tickernoti popup */
127 notification_status_message_post(_("IDS_WIFI_POP_FAILED_TO_CONNECT_TO_PS"));
132 case /* MO */ WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK:
135 WFD_APP_LOG(WFD_APP_LOG_HIGH,
136 "WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK\n");
140 int len = strlen(connection->wps_pin);
141 WFD_APP_LOGSECURE(WFD_APP_LOG_LOW, "PIN [%s]", connection->wps_pin);
143 if (len < 8 || len > 64) {
144 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Error, Incorrect PIN!!\n");
145 keypad_popup_timeout--;
146 /* tickernoti popup */
147 notification_status_message_post(_("IDS_COM_BODY_PINS_DO_NOT_MATCH"));
149 /* redraw the popup */
150 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
153 keypad_popup_timeout = 0;
155 result = wifi_direct_set_wps_pin(connection->wps_pin);
156 if (result != WIFI_DIRECT_ERROR_NONE) {
157 /* tickernoti popup */
158 snprintf(msg, WFD_POP_STR_MAX_LEN, _("IDS_WIFI_POP_FAILED_TO_CONNECT_TO_PS"),
159 connection->peer_name);
160 notification_status_message_post(msg);
164 result = wifi_direct_accept_connection(connection->peer_addr);
165 if (result != WIFI_DIRECT_ERROR_NONE) {
166 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to accept connection(%d)", result);
167 evas_object_hide(ad->win);
169 /* tickernoti popup */
170 snprintf(msg, WFD_POP_STR_MAX_LEN, _("IDS_WIFI_POP_FAILED_TO_CONNECT_TO_PS"),
171 connection->peer_name);
172 notification_status_message_post(msg);
174 WFD_APP_LOG(WFD_APP_LOG_LOW, "Succeeded to connect with [%s]", connection->peer_addr);
178 case /* MT */ WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES:
180 WFD_APP_LOG(WFD_APP_LOG_HIGH,
181 "WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES\n");
184 ecore_timer_del(pb_timer);
188 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
192 case /* MT */ WFD_POP_RESP_APRV_CONNECT_NO:
194 WFD_APP_LOG(WFD_APP_LOG_HIGH,
195 "WFD_POP_RESP_APRV_CONNECT_NO: destroy_popup...\n");
197 if (connection->peer_addr[0] != '\0') {
198 result = wifi_direct_reject_connection(connection->peer_addr);
199 if (result != WIFI_DIRECT_ERROR_NONE)
200 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to reject connection(%d)", result);
202 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Peer's address is Zero MAC");
206 ecore_timer_del(pb_timer);
211 keypad_popup_timeout = 0;
217 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Unknown respone\n");
223 __WFD_APP_FUNC_EXIT__;
227 * This function let the app destroy the popup
231 void wfd_destroy_popup()
233 __WFD_APP_FUNC_ENTER__;
234 wfd_appdata_t *ad = wfd_get_appdata();
237 WFD_APP_LOG(WFD_APP_LOG_ERROR, "ad is NULL\n");
241 if (keypad_popup_timer) {
242 ecore_timer_del(keypad_popup_timer);
243 keypad_popup_timer = NULL;
247 evas_object_del(ad->popup);
251 if (ad->popup_timeout_handle > 0) {
252 g_source_remove(ad->popup_timeout_handle);
253 ad->popup_timeout_handle = 0;
257 evas_object_hide(ad->win);
261 ecore_timer_del(pb_timer);
264 __WFD_APP_FUNC_EXIT__;
268 void __set_parent_rotate_angle(wfd_appdata_t *ad)
270 __WFD_APP_FUNC_ENTER__;
274 if (ad == NULL || ad->win == NULL) {
275 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Parameter NULL");
279 elm_win_wm_rotation_available_rotations_set(ad->win, rots1, 1);
281 __WFD_APP_FUNC_EXIT__;
286 * This function let the app create a popup which includes no button
288 * @param[in] win the window object
289 * @param[in] pop the pointer to the prepared popup
291 static Evas_Object *wfd_draw_pop_type_a(Evas_Object * win, wfd_popup_t * pop)
293 __WFD_APP_FUNC_ENTER__;
295 wfd_appdata_t *ad = wfd_get_appdata();
298 popup = elm_popup_add(win);
299 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
300 eext_object_event_callback_add(popup, EA_CALLBACK_BACK, __popup_resp_cb, NULL);
301 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
302 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
303 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
304 elm_object_domain_translatable_text_set(popup, PACKAGE, pop->text);
305 elm_popup_timeout_set(popup, pop->timeout);
306 __set_parent_rotate_angle(ad);
307 evas_object_show(popup);
308 evas_object_show(win);
310 __WFD_APP_FUNC_EXIT__;
315 * This function let the app create a popup which includes one button
317 * @param[in] win the window object
318 * @param[in] pop the pointer to the prepared popup
320 static Evas_Object *wfd_draw_pop_type_b(Evas_Object * win, wfd_popup_t * pop)
322 __WFD_APP_FUNC_ENTER__;
323 Evas_Object *popup = NULL;
324 Evas_Object *btn = NULL;
325 wfd_appdata_t *ad = wfd_get_appdata();
327 popup = elm_popup_add(win);
328 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
329 eext_object_event_callback_add(popup, EA_CALLBACK_BACK, __popup_resp_cb, (void *) pop->resp_data1);
330 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
331 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
332 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
333 elm_object_domain_translatable_text_set(popup, PACKAGE, pop->text);
335 btn = elm_button_add(popup);
336 elm_object_style_set(btn, "popup");
337 elm_object_domain_translatable_text_set(btn, PACKAGE, pop->label1);
338 elm_object_part_content_set(popup, "button1", btn);
339 evas_object_smart_callback_add(btn, "clicked", __popup_resp_cb, (void *) pop->resp_data1);
341 __set_parent_rotate_angle(ad);
342 evas_object_show(popup);
343 evas_object_show(win);
345 __WFD_APP_FUNC_EXIT__;
350 * This function let the app create a popup which includes two buttons
352 * @param[in] win the window object
353 * @param[in] pop the pointer to the prepared popup
355 static Evas_Object *wfd_draw_pop_type_c(Evas_Object * win, wfd_popup_t * pop)
357 __WFD_APP_FUNC_ENTER__;
358 Evas_Object *popup = NULL;
359 Evas_Object *btn1 = NULL, *btn2 = NULL;
360 wfd_appdata_t *ad = wfd_get_appdata();
362 popup = elm_popup_add(win);
363 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
364 eext_object_event_callback_add(popup, EA_CALLBACK_BACK, __popup_resp_cb, (void *) pop->resp_data2);
365 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
366 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
367 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
368 elm_object_domain_translatable_part_text_set(popup, "title,text",
369 PACKAGE, _("IDS_WIFI_HEADER_WI_FI_DIRECT_CONNECTION_ABB"));
370 elm_object_domain_translatable_text_set(popup, PACKAGE, pop->text);
372 btn1 = elm_button_add(popup);
373 elm_object_style_set(btn1, "popup");
374 elm_object_domain_translatable_text_set(btn1, PACKAGE, pop->label2);
375 elm_object_part_content_set(popup, "button1", btn1);
376 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
377 (void *) pop->resp_data2);
379 btn2 = elm_button_add(popup);
380 elm_object_style_set(btn2, "popup");
381 elm_object_domain_translatable_text_set(btn2, PACKAGE, pop->label1);
382 elm_object_part_content_set(popup, "button2", btn2);
383 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
384 (void *) pop->resp_data1);
386 __set_parent_rotate_angle(ad);
387 evas_object_show(popup);
388 evas_object_show(win);
390 __WFD_APP_FUNC_EXIT__;
394 static void _wfd_ug_automatic_turn_off_popup_cb(void *data, Evas_Object *obj, void *event_info)
396 __WFD_APP_FUNC_ENTER__;
397 wfd_appdata_t *ad = wfd_get_appdata();
400 evas_object_del(ad->popup);
404 if (ad->rotate_event_handler) {
405 ecore_event_handler_del(ad->rotate_event_handler);
406 ad->rotate_event_handler = NULL;
410 evas_object_hide(ad->win);
413 __WFD_APP_FUNC_EXIT__;
416 Evas_Object *wfd_draw_pop_type_auto_deactivation(Evas_Object *win, void *userdata)
418 __WFD_APP_FUNC_ENTER__;
420 Evas_Object *popup = NULL;
421 Evas_Object *btn = NULL;
422 char popup_text[MAX_POPUP_TEXT_SIZE] = {0};
423 wfd_appdata_t *ad = wfd_get_appdata();
425 popup = elm_popup_add(win);
426 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
427 eext_object_event_callback_add(popup, EA_CALLBACK_BACK, _wfd_ug_automatic_turn_off_popup_cb, userdata);
428 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
429 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
430 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
431 elm_object_domain_translatable_part_text_set(popup, "title,text",
432 PACKAGE, "IDS_WIFI_BODY_WI_FI_DIRECT_ABB");
433 snprintf(popup_text, MAX_POPUP_TEXT_SIZE,
434 "IDS_WIFI_POP_THERE_HAS_BEEN_NO_ACTIVITY_FOR_PD_MINUTES_SINCE_WI_FI_DIRECT_WAS_ENABLED_MSG", 5);
435 elm_object_domain_translatable_text_set(popup, PACKAGE, popup_text);
437 btn = elm_button_add(popup);
438 elm_object_style_set(btn, "popup");
439 elm_object_domain_translatable_text_set(btn, PACKAGE, "IDS_BR_SK_OK");
440 elm_object_part_content_set(popup, "button1", btn);
441 evas_object_smart_callback_add(btn, "clicked", _wfd_ug_automatic_turn_off_popup_cb, userdata);
443 __set_parent_rotate_angle(ad);
444 evas_object_show(popup);
445 evas_object_show(win);
447 __WFD_APP_FUNC_EXIT__;
452 * This function let the ug make a change callback for password input
454 * @param[in] data the pointer to the main data structure
455 * @param[in] obj the pointer to the evas object
456 * @param[in] event_info the pointer to the event information
458 static void _smart_ime_cb(void *data, Evas_Object * obj, void *event_info)
460 __WFD_APP_FUNC_ENTER__;
461 wfd_appdata_t *ad = wfd_get_appdata();
462 wfd_connection_info_s *connection = ad->connection;
464 Ecore_IMF_Context *imf_context = NULL;
465 imf_context = (Ecore_IMF_Context *) ad->pin_entry;
467 if (NULL == imf_context) {
468 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Error!!! Ecore_IMF_Context is NULL!!");
472 char *txt = elm_entry_markup_to_utf8(elm_entry_entry_get((const Evas_Object *) imf_context));
474 WFD_APP_LOG(WFD_APP_LOG_LOW, "* text [%s], len=[%d]", txt, strlen(txt));
475 strncpy(connection->wps_pin, txt, sizeof(connection->wps_pin) - 1);
476 WFD_IF_FREE_MEM(txt);
478 WFD_APP_LOG(WFD_APP_LOG_LOW, "Err!");
481 __WFD_APP_FUNC_EXIT__;
485 * This function let the app make a callback for progressbar timer
486 * @return if stop the timer, return ECORE_CALLBACK_CANCEL, else return ECORE_CALLBACK_RENEW
487 * @param[in] data the pointer to the wps structure
489 static Eina_Bool _fn_pb_timer(void *data)
493 char time_label[32] = {0};
494 wfd_wps_display_popup_t *wps_display_popup = (wfd_wps_display_popup_t *) data;
496 if (NULL == wps_display_popup) {
497 WFD_APP_LOG(WFD_APP_LOG_ERROR, "Param is NULL.\n");
498 return ECORE_CALLBACK_CANCEL;
501 Evas_Object *progressbar = NULL;
502 Evas_Object *time = NULL;
504 progressbar = wps_display_popup->progressbar;
505 time = wps_display_popup->time;
506 value = elm_progressbar_value_get(progressbar);
508 wps_display_popup->step++;
509 step = wps_display_popup->step;
510 value = ((double)step) / WFD_POP_TIMER_120;
513 WFD_APP_LOG(WFD_APP_LOG_LOW, "Progress end.\n");
515 ecore_timer_del(pb_timer);
519 return ECORE_CALLBACK_CANCEL;
522 elm_progressbar_value_set(progressbar, value);
523 WFD_APP_LOG(WFD_APP_LOG_LOW, "step: %d, value: %f\n", wps_display_popup->step, value);
525 /* show the time label */
528 snprintf(time_label, 32, "00:0%d", step);
530 snprintf(time_label, 32, "00:%d", step);
534 snprintf(time_label, 32, "0%d:0%d", step/60, step%60);
536 snprintf(time_label, 32, "0%d:%d", step/60, step%60);
540 char *remaining_time_str = g_strdup_printf(
541 "<font_size=40><align=center>%s</align></font_size>", time_label);
542 elm_object_text_set(time, remaining_time_str);
543 g_free(remaining_time_str);
545 return ECORE_CALLBACK_RENEW;
548 static Eina_Bool _keypad_popup_timer_cb(void *data)
550 __WFD_APP_FUNC_ENTER__;
552 char msg1[WFD_POP_STR_MAX_LEN] = {0};
553 char msg2[WFD_POP_STR_MAX_LEN] = {0};
555 Evas_Object *label = (Evas_Object*) data;
556 wfd_appdata_t *ad = wfd_get_appdata();
557 wfd_connection_info_s *connection = ad->connection;
558 WFD_RETV_IF(NULL == ad, FALSE, "NULL parameters(ad)\n");
559 WFD_RETV_IF(NULL == label, FALSE, "NULL parameters(label)\n");
560 if (NULL == ad->popup) {
561 keypad_popup_timeout = 0;
562 return ECORE_CALLBACK_CANCEL;
565 keypad_popup_timeout --;
567 if (keypad_popup_timeout > 0) {
568 _replace_1PS_2PD((char *)msg1, sizeof(msg1),
569 _("IDS_ST_BODY_CONNECT_WITH_PS_IN_PD_SECS_ABB"),
570 connection->peer_name, keypad_popup_timeout);
573 snprintf(msg2, sizeof(msg2), _("IDS_WIFI_POP_ENTER_PIN_TO_CONNECT_TO_PS"),
574 connection->peer_name);
576 elm_object_domain_translatable_text_set(label, PACKAGE, msg1);
580 if (keypad_popup_timeout <= 0) {
582 keypad_popup_timeout = 0;
583 __WFD_APP_FUNC_EXIT__;
584 return ECORE_CALLBACK_CANCEL;
587 __WFD_APP_FUNC_EXIT__;
588 return ECORE_CALLBACK_RENEW;
591 /* This callback is for showing(hiding) X marked button. */
592 /*static void _changed_cb(void *data, Evas_Object *obj, void *event_info)
594 if (elm_object_focus_get(obj)) {
595 if (elm_entry_is_empty(obj))
596 elm_object_signal_emit(data, "elm,state,eraser,hide", "");
598 elm_object_signal_emit(data, "elm,state,eraser,show", "");
602 /* Focused callback will show X marked button and hide guidetext. */
603 /*static void _focused_cb(void *data, Evas_Object *obj, void *event_info)
605 if (!elm_entry_is_empty(obj))
606 elm_object_signal_emit(data, "elm,state,eraser,show", "");
607 elm_object_signal_emit(data, "elm,state,rename,hide", "");
610 /* Unfocused callback will show guidetext and hide X marked button. */
611 /*static void _unfocused_cb(void *data, Evas_Object *obj, void *event_info)
613 elm_object_signal_emit(data, "elm,state,eraser,hide", "");
614 elm_object_signal_emit(data, "elm,state,rename,show", "");
617 /* When X marked button clicked, make string as empty. */
618 /*static void _eraser_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
620 elm_object_focus_set(data, EINA_TRUE);
621 elm_entry_entry_set(data, "");
625 * This function let the app create a edit filed
627 * @param[in] parent the parent object
628 * @param[in] title the pointer to the title of edit field
629 * @param[in] guide the pointer to the text of guide
630 * @param[in] single_line whether it can support single line
631 * @param[in] is_editable whether it is avaliable to edit
633 /*static Evas_Object *_add_edit_field(Evas_Object *parent, const char *title, const char *guide, Eina_Bool single_line, Eina_Bool is_editable)
635 assertm_if(NULL == parent, "parent is NULL!!");
637 Evas_Object *layout = elm_layout_add(parent);
638 assertm_if(NULL == layout, "layout is NULL!!");
640 if (title && title[0] != '\0') {
641 elm_layout_theme_set(layout, "layout", "dialogue/editfield/title", "default");
642 elm_object_part_text_set(layout, "elm.text", title);
644 elm_layout_theme_set(layout, "layout", "dialogue/editfield", "default");
647 Evas_Object *entry = elm_entry_add(layout);
648 assertm_if(NULL == entry, "entry is NULL!!");
650 if (guide && guide[0] != '\0') {
651 elm_object_part_text_set(layout, "elm.guidetext", guide);
654 evas_object_smart_callback_add(entry, "changed", _changed_cb, layout);
655 evas_object_smart_callback_add(entry, "focused", _focused_cb, layout);
656 evas_object_smart_callback_add(entry, "unfocused", _unfocused_cb, layout);
658 elm_object_part_content_set(layout, "elm.icon.entry", entry);
659 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
660 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
662 elm_entry_single_line_set(entry, single_line);
663 elm_entry_scrollable_set(entry, single_line);
665 Evas_Object *button = elm_button_add(parent);
666 elm_object_style_set(button, "editfield_clear");
667 elm_object_part_content_set(layout, "elm.icon.eraser", button);
668 evas_object_smart_callback_add(button, "clicked", _eraser_btn_clicked_cb, entry);
673 * This function let the app create a display popup
674 * @return display popup
675 * @param[in] win the window object
676 * @param[in] pop the pointer to the prepared popup
678 Evas_Object *wfd_draw_pop_type_display(Evas_Object * win, wfd_popup_t * pop)
680 __WFD_APP_FUNC_ENTER__;
681 WFD_APP_LOG(WFD_APP_LOG_LOW, "wfd_draw_pop_type_display\n");
683 Evas_Object *popup = NULL;
684 Evas_Object *progressbar = NULL;
685 Evas_Object *time = NULL;
687 static wfd_wps_display_popup_t wps_display_popup;
688 wfd_appdata_t *ad = wfd_get_appdata();
690 popup = elm_popup_add(win);
691 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
692 evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, mouseup_cb, ad);
693 // evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, keydown_cb, ad);
694 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, 0.0);
695 elm_object_domain_translatable_part_text_set(popup, "title,text",
696 PACKAGE, _("IDS_WIFI_HEADER_WI_FI_DIRECT_CONNECTION_ABB"));
698 layout = elm_layout_add(popup);
699 if (layout == NULL) {
700 WFD_APP_LOG(WFD_APP_LOG_LOW, "Layout failed so returning !!");
704 elm_layout_file_set(layout, WFD_EDJ_POPUP_PATH, "popup_wps_pin_layout");
705 elm_object_domain_translatable_part_text_set(layout, "elm.text.description",
707 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
709 /* add progressbar */
710 progressbar = elm_progressbar_add(layout);
711 elm_object_style_set(progressbar, "list_progress");
712 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
713 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
714 evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
715 elm_progressbar_value_set(progressbar, 0.0);
716 evas_object_show(progressbar);
719 time = elm_label_add(layout);
720 elm_label_line_wrap_set(time, ELM_WRAP_MIXED);
721 elm_object_text_set(time, _("<font_size=40><align=center>00:00</align></font_size>"));
722 evas_object_size_hint_weight_set(time, EVAS_HINT_EXPAND, 0.0);
723 evas_object_size_hint_align_set(time, EVAS_HINT_FILL, EVAS_HINT_FILL);
724 evas_object_show(time);
726 elm_object_part_content_set(layout, "slider", progressbar);
727 elm_object_part_content_set(layout, "timer_label", time);
730 /* start progressbar timer */
731 wps_display_popup.step = 0;
732 wps_display_popup.progressbar = progressbar;
733 wps_display_popup.time = time;
734 pb_timer = ecore_timer_add(1, _fn_pb_timer, &wps_display_popup);
737 if (pop->resp_data2 == WFD_POP_RESP_APRV_CONNECT_NO) {
738 Evas_Object *btn2 = NULL;
739 btn2 = elm_button_add(popup);
740 elm_object_style_set(btn2, "popup");
741 elm_object_domain_translatable_text_set(btn2, PACKAGE, pop->label2);
742 elm_object_part_content_set(popup, "button1", btn2);
743 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
744 (void *) pop->resp_data2);
745 eext_object_event_callback_add(popup, EA_CALLBACK_BACK, __popup_resp_cb, (void *) pop->resp_data2);
748 if (pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES || pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_PBC_YES ) {
749 Evas_Object *btn1 = NULL;
750 btn1 = elm_button_add(popup);
751 elm_object_style_set(btn1, "popup");
752 elm_object_domain_translatable_text_set(btn1, PACKAGE, pop->label1);
753 elm_object_part_content_set(popup, "button2", btn1);
754 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
755 (void *) pop->resp_data1);
756 eext_object_event_callback_add(popup, EA_CALLBACK_BACK, __popup_resp_cb, (void *) pop->resp_data1);
759 elm_object_content_set(popup, layout);
760 __set_parent_rotate_angle(ad);
761 evas_object_show(popup);
762 evas_object_show(win);
764 __WFD_APP_FUNC_EXIT__;
768 static void __popup_eraser_clicked_cb(void *data, Evas_Object *obj, void *event_info)
770 __WFD_APP_FUNC_ENTER__;
771 elm_entry_entry_set(data, "");
772 __WFD_APP_FUNC_EXIT__;
775 static void _entry_changed_cb(void *data, Evas_Object *obj, void *event_info)
777 __WFD_APP_FUNC_ENTER__;
778 if (elm_object_part_content_get(obj, "elm.swallow.clear")) {
779 if (elm_object_focus_get(obj)) {
780 if (elm_entry_is_empty(obj))
781 elm_object_signal_emit(obj, "elm,state,clear,hidden", "");
783 elm_object_signal_emit(obj, "elm,state,clear,visible", "");
786 __WFD_APP_FUNC_EXIT__;
789 static void _entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
791 __WFD_APP_FUNC_ENTER__;
793 if (elm_object_part_content_get(obj, "elm.swallow.clear")) {
794 if (!elm_entry_is_empty(obj))
795 elm_object_signal_emit(obj, "elm,state,clear,visible", "");
797 elm_object_signal_emit(obj, "elm,state,clear,hidden", "");
799 elm_object_signal_emit(obj, "elm,state,focus,on", "");
800 __WFD_APP_FUNC_EXIT__;
803 static void _entry_keydown_cb(void *data, Evas *e, Evas_Object *obj,
806 __WFD_APP_FUNC_ENTER__;
808 Evas_Event_Key_Down *ev;
809 Evas_Object *entry = obj;
811 WFD_RET_IF(data == NULL, "Incorrect parameter data(NULL)\n");
812 WFD_RET_IF(event_info == NULL, "Incorrect parameter event_info(NULL)\n");
813 WFD_RET_IF(entry == NULL, "Incorrect parameter entry(NULL)\n");
815 ev = (Evas_Event_Key_Down *)event_info;
817 if (g_strcmp0(ev->key, "KP_Enter") == 0 || g_strcmp0(ev->key, "Return") == 0) {
818 Ecore_IMF_Context *imf_context;
820 imf_context = (Ecore_IMF_Context*)elm_entry_imf_context_get(entry);
822 ecore_imf_context_input_panel_hide(imf_context);
825 elm_object_focus_set(entry, EINA_FALSE);
829 static char *__wfd_main_desc_label_get(void *data, Evas_Object *obj,
832 __WFD_APP_FUNC_ENTER__;
833 if (obj == NULL || part == NULL) {
836 WFD_APP_LOG(WFD_APP_LOG_LOW, "wfd_rename desc\n");
837 char msg1[WFD_POP_STR_MAX_LEN] = {0, };
838 char msg2[WFD_POP_STR_MAX_LEN] = {0, };
839 wfd_appdata_t *ad = wfd_get_appdata();
840 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
841 wfd_connection_info_s *connection = ad->connection;
842 WFD_RETV_IF(connection == NULL, NULL, "Incorrect parameter(NULL)\n");
844 if (!g_strcmp0(part, "elm.text.multiline")) {
845 if (keypad_popup_timeout > 0) {
846 ad->timeout = keypad_popup_timeout;
848 _replace_1PS_2PD((char *)msg1, sizeof(msg1),
849 _("IDS_ST_BODY_CONNECT_WITH_PS_IN_PD_SECS_ABB"),
850 connection->peer_name, ad->timeout);
853 snprintf(msg2, sizeof(msg2),
854 _("IDS_WIFI_POP_ENTER_PIN_TO_CONNECT_TO_PS"),
855 connection->peer_name);
857 WFD_APP_LOG(WFD_APP_LOG_LOW, "string %s", msg1);
858 __WFD_APP_FUNC_EXIT__;
859 return g_strdup(msg1);
861 __WFD_APP_FUNC_EXIT__;
865 static Evas_Object *__wfd_pin_entry_icon_get(void *data, Evas_Object *obj,
868 __WFD_APP_FUNC_ENTER__;
869 if (obj == NULL || part == NULL) {
872 wfd_appdata_t *ad = wfd_get_appdata();
873 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
874 Evas_Object *entry = NULL;
875 Evas_Object *button = NULL;
876 Ecore_IMF_Context *imf_context;
877 if (g_strcmp0(part, "elm.icon.entry")) {
878 __WFD_APP_FUNC_EXIT__;
881 static Elm_Entry_Filter_Accept_Set accept_set = {"0123456789", NULL};
882 entry = elm_entry_add(obj);
883 elm_entry_single_line_set(entry, EINA_TRUE);
884 elm_object_style_set(entry, "editfield");
885 elm_entry_scrollable_set(entry, EINA_TRUE);
887 eext_entry_selection_back_event_allow_set(entry, EINA_TRUE);
888 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
889 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
890 elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
891 elm_entry_password_set(entry, EINA_TRUE);
892 elm_entry_prediction_allow_set(entry, EINA_FALSE);
894 elm_entry_markup_filter_append(entry,
895 elm_entry_filter_accept_set,&accept_set);
896 elm_entry_input_panel_layout_set(entry,
897 ELM_INPUT_PANEL_LAYOUT_DATETIME);
898 elm_object_signal_emit(entry, "elm,action,hide,search_icon", "");
899 elm_object_domain_translatable_part_text_set(entry, "elm.guide",
900 PACKAGE, _("IDS_WIFI_POP_PIN"));
901 elm_entry_input_panel_return_key_autoenabled_set(entry,EINA_TRUE);
902 elm_entry_input_panel_return_key_type_set(entry,
903 ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
905 ad->pin_entry = entry;
906 imf_context = (Ecore_IMF_Context*)elm_entry_imf_context_get(entry);
908 ecore_imf_context_input_panel_return_key_type_set(imf_context,
909 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
912 button = elm_button_add(obj);
913 elm_object_style_set(button, "search_clear");
914 elm_object_focus_allow_set(button, EINA_FALSE);
915 elm_object_part_content_set(entry, "elm.swallow.clear", button);
916 evas_object_smart_callback_add(button, "clicked",
917 __popup_eraser_clicked_cb, entry);
919 elm_object_signal_emit (entry, "elm,action,hide,search_icon", "");
920 evas_object_smart_callback_add(entry, "changed",
921 _entry_changed_cb, NULL);
922 evas_object_smart_callback_add(entry, "preedit,changed",
923 _entry_changed_cb, NULL);
924 evas_object_smart_callback_add(entry, "focused",
925 _entry_focused_cb, NULL);
926 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN,
927 _entry_keydown_cb, ad);
929 elm_object_content_set(obj,entry);
930 evas_object_show(entry);
931 evas_object_smart_callback_add(entry, "changed", _smart_ime_cb, NULL);
932 elm_object_focus_set(entry, EINA_TRUE);
933 __WFD_APP_FUNC_EXIT__;
937 static void _chk_changed_cb(void *data, Evas_Object *obj, void *ei)
939 __WFD_APP_FUNC_ENTER__;
940 if (obj == NULL || data == NULL) {
943 Eina_Bool state = elm_check_state_get(obj);
945 elm_entry_password_set((Evas_Object *)data, EINA_FALSE);
947 elm_entry_password_set((Evas_Object *)data, EINA_TRUE);
949 __WFD_APP_FUNC_EXIT__;
952 static void _gl_pswd_check_box_sel(void *data, Evas_Object *obj, void *ei)
954 __WFD_APP_FUNC_ENTER__;
955 Elm_Object_Item *item = NULL;
956 item = (Elm_Object_Item *)ei;
960 wfd_appdata_t *ad = wfd_get_appdata();
962 WFD_APP_LOG(WFD_APP_LOG_LOW, "Incorrect parameter(NULL)\n");
965 Evas_Object *ck = elm_object_item_part_content_get(ei, "elm.icon.left");
966 elm_genlist_item_selected_set(item, EINA_FALSE);
967 Eina_Bool state = elm_check_state_get(ck);
968 elm_check_state_set(ck, !state);
970 _chk_changed_cb(ad->pin_entry, ck, NULL);
972 __WFD_APP_FUNC_EXIT__;
975 static char *__wfd_password_label(void *data, Evas_Object *obj, const char *part)
977 __WFD_APP_FUNC_ENTER__;
979 if (data == NULL || part == NULL) {
982 WFD_APP_LOG(WFD_APP_LOG_LOW, "Part %s", part);
984 if (!g_strcmp0(part, "elm.text.main.right")) {
985 __WFD_APP_FUNC_EXIT__;
986 return g_strdup(" Show password");
988 __WFD_APP_FUNC_EXIT__;
992 static Evas_Object *__wfd_password_check(void *data, Evas_Object *obj,
995 __WFD_APP_FUNC_ENTER__;
996 if (obj == NULL || part == NULL) {
999 wfd_appdata_t *ad = wfd_get_appdata();
1000 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
1001 Evas_Object *check = NULL;
1003 WFD_APP_LOG(WFD_APP_LOG_LOW, "Part %s", part);
1005 if (!g_strcmp0(part, "elm.icon.left")) {
1006 check = elm_check_add(obj);
1007 evas_object_propagate_events_set(check, EINA_FALSE);
1008 evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
1009 evas_object_size_hint_weight_set(check,
1010 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1011 evas_object_smart_callback_add(check, "changed",
1012 _chk_changed_cb, ad->pin_entry);
1013 elm_object_focus_allow_set(check, EINA_FALSE);
1014 __WFD_APP_FUNC_EXIT__;
1017 __WFD_APP_FUNC_EXIT__;
1023 * This function let the app create a keypad popup
1024 * @return keypad popup
1025 * @param[in] win the window object
1026 * @param[in] pop the pointer to the prepared popup
1028 Evas_Object *wfd_draw_pop_type_keypad(Evas_Object * win, wfd_popup_t * pop)
1030 __WFD_APP_FUNC_ENTER__;
1031 wfd_appdata_t *ad = wfd_get_appdata();
1032 WFD_RETV_IF(ad == NULL, NULL, "Incorrect parameter(NULL)\n");
1033 wfd_connection_info_s *connection = ad->connection;
1034 WFD_RETV_IF(connection == NULL, NULL, "Incorrect parameter(NULL)\n");
1036 Evas_Object *pinpopup = NULL;
1037 Evas_Object *btn1 = NULL, *btn2 = NULL;
1038 Evas_Object *genlist = NULL;
1039 Elm_Object_Item *git = NULL;
1041 ad->timeout = pop->timeout;
1043 pinpopup = elm_popup_add(ad->layout);
1044 elm_popup_align_set(pinpopup, ELM_NOTIFY_ALIGN_FILL, 1.0);
1045 eext_object_event_callback_add(pinpopup, EA_CALLBACK_BACK, eext_popup_back_cb,
1047 evas_object_size_hint_weight_set(pinpopup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1048 elm_object_domain_translatable_part_text_set(pinpopup, "title,text",
1049 PACKAGE, _("IDS_WIFI_HEADER_WI_FI_DIRECT_CONNECTION_ABB"));
1051 genlist = elm_genlist_add(pinpopup);
1052 elm_genlist_homogeneous_set(genlist, EINA_TRUE);
1053 evas_object_size_hint_weight_set(genlist,
1054 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1055 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
1056 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1057 elm_scroller_content_min_limit(genlist, EINA_FALSE, EINA_TRUE);
1059 /* Entry genlist item */
1060 ad->pin_desc_itc = elm_genlist_item_class_new();
1061 if(ad->pin_desc_itc != NULL) {
1062 ad->pin_desc_itc->item_style = "multiline_main";
1063 ad->pin_desc_itc->func.text_get = __wfd_main_desc_label_get;
1064 ad->pin_desc_itc->func.content_get = NULL;
1065 ad->pin_desc_itc->func.state_get = NULL;
1066 ad->pin_desc_itc->func.del = NULL;
1068 git = elm_genlist_item_append(genlist, ad->pin_desc_itc, ad, NULL,
1069 ELM_GENLIST_ITEM_NONE, NULL, NULL);
1071 elm_genlist_item_select_mode_set(git,
1072 ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1074 keypad_popup_timeout = pop->timeout;
1075 keypad_popup_timer = ecore_timer_add(1, _keypad_popup_timer_cb,
1079 ad->pin_entry_itc = elm_genlist_item_class_new();
1080 if(ad->pin_entry_itc != NULL) {
1081 ad->pin_entry_itc->item_style = "entry";
1082 ad->pin_entry_itc->func.text_get = NULL;
1083 ad->pin_entry_itc->func.content_get = __wfd_pin_entry_icon_get;
1084 ad->pin_entry_itc->func.state_get = NULL;
1085 ad->pin_entry_itc->func.del = NULL;
1087 elm_genlist_item_append(genlist, ad->pin_entry_itc, pinpopup,
1088 NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1091 ad->paswd_itc = elm_genlist_item_class_new();
1092 if(ad->paswd_itc != NULL) {
1093 ad->paswd_itc->item_style = "1line";
1094 ad->paswd_itc->func.text_get = __wfd_password_label;
1095 ad->paswd_itc->func.content_get = __wfd_password_check;
1096 ad->paswd_itc->func.state_get = NULL;
1097 ad->paswd_itc->func.del = NULL;
1099 elm_genlist_item_append(genlist, ad->paswd_itc, pinpopup,
1100 NULL, ELM_GENLIST_ITEM_NONE, _gl_pswd_check_box_sel, (void *)ad );
1103 btn1 = elm_button_add(pinpopup);
1104 elm_object_style_set(btn1, "popup");
1105 elm_object_domain_translatable_text_set(btn1, PACKAGE, pop->label2);
1106 elm_object_part_content_set(pinpopup, "button1", btn1);
1107 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
1108 (void *)pop->resp_data2);
1110 btn2 = elm_button_add(pinpopup);
1111 elm_object_style_set(btn2, "popup");
1112 elm_object_domain_translatable_text_set(btn2, PACKAGE, pop->label1);
1113 elm_object_part_content_set(pinpopup, "button2", btn2);
1114 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
1115 (void *)pop->resp_data1);
1116 #if defined(GENLIST_REALIZATION_MOTE_SET)
1117 elm_genlist_realization_mode_set(genlist, EINA_TRUE);
1119 evas_object_show(genlist);
1120 elm_object_content_set(pinpopup, genlist);
1122 __set_parent_rotate_angle(ad);
1123 evas_object_show(pinpopup);
1124 evas_object_show(win);
1125 elm_object_focus_set(ad->pin_entry, EINA_TRUE);
1127 __WFD_APP_FUNC_EXIT__;
1132 void _replace_int(char *haystack, int size, char *niddle, int value)
1134 __WFD_APP_FUNC_ENTER__;
1139 if (haystack == NULL || niddle == NULL || size <= 1)
1142 buf = g_strdup(haystack);
1143 p = strstr(buf, niddle);
1148 q = p + strlen(niddle);
1151 snprintf(haystack, size-1, "%s%d%s", buf, value, q);
1153 __WFD_APP_FUNC_EXIT__;
1156 void _replace_1PS_2PD(char *buf, int buf_len, char *format_str, char* SD_1, int PD_2)
1158 __WFD_APP_FUNC_ENTER__;
1159 char text[WFD_POP_STR_MAX_LEN] = {0, };
1161 strncpy(text, format_str, WFD_POP_STR_MAX_LEN-1);
1162 _replace_int(text, WFD_POP_STR_MAX_LEN, "%d", PD_2);
1163 _replace_int(text, WFD_POP_STR_MAX_LEN, "%2$d", PD_2);
1164 snprintf(buf, buf_len-1, text, SD_1);
1165 __WFD_APP_FUNC_EXIT__;
1170 * This function let the app create a popup
1172 * @param[in] type the type of popup
1173 * @param[in] userdata the pointer to the data which will be used
1175 void wfd_prepare_popup(int type, void *user_data)
1177 __WFD_APP_FUNC_ENTER__;
1178 wfd_appdata_t *ad = wfd_get_appdata();
1179 wfd_popup_t *pop = ad->popup_data;
1180 wfd_connection_info_s *connection = ad->connection;
1181 char text[WFD_POP_STR_MAX_LEN+1] = {0, };
1182 char text1[WFD_POP_STR_MAX_LEN+1] = {0, };
1183 wfd_destroy_popup();
1185 peer_name = elm_entry_utf8_to_markup(connection->peer_name);
1187 memset(pop, 0, sizeof(wfd_popup_t));
1191 switch (pop->type) {
1192 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ:
1194 _replace_1PS_2PD((char *)pop->text, sizeof(pop->text),
1195 _("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1196 peer_name, WFD_POP_TIMER_120);
1198 snprintf(pop->label1, sizeof(pop->label1), "%s", _("IDS_WIFI_SK2_OK"));
1199 snprintf(pop->label2, sizeof(pop->label2), "%s", _("IDS_WIFI_SK_CANCEL"));
1200 pop->timeout = WFD_POP_TIMER_120;
1201 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_PBC_YES;
1202 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1204 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
1207 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ:
1208 snprintf(pop->text, sizeof(pop->text),
1209 _("IDS_WIFI_BODY_PS_IS_REQUESTING_A_WI_FI_DIRECT_CONNECTION_ALLOW_Q"),
1211 snprintf(pop->label1, sizeof(pop->label1), "%s", _("IDS_WIFI_BUTTON_ALLOW"));
1212 snprintf(pop->label2, sizeof(pop->label2), "%s", _("IDS_BR_SK_CANCEL"));
1213 pop->timeout = WFD_POP_TIMER_120;
1214 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK;
1215 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1217 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
1220 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ:
1221 _replace_1PS_2PD((char *)pop->text, sizeof(pop->text),
1222 _("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1223 peer_name, WFD_POP_TIMER_120);
1224 snprintf(pop->label1, sizeof(pop->label1), "%s", _("IDS_BR_SK_OK"));
1225 snprintf(pop->label2, sizeof(pop->label2), "%s", _("IDS_BR_SK_CANCEL"));
1226 pop->timeout = WFD_POP_TIMER_120;
1227 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES;
1228 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1230 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
1233 case /* MT */ WFD_POP_PROG_CONNECT:
1234 snprintf(pop->text, sizeof(pop->text), "%s", _("IDS_WIFI_BODY_CONNECTING_ING"));
1235 snprintf(pop->label1, sizeof(pop->label1), "%s", _("IDS_BR_SK_CANCEL"));
1236 pop->timeout = WFD_POP_TIMER_120;
1237 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
1239 ad->popup = wfd_draw_pop_type_b(ad->win, pop);
1242 case /* MO */ WFD_POP_PROG_CONNECT_WITH_KEYPAD:
1243 _replace_1PS_2PD((char *)text, sizeof(text),
1244 _("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1245 peer_name, WFD_POP_TIMER_120);
1247 snprintf(text1, WFD_POP_STR_MAX_LEN, "%s %s",
1248 text, _("IDS_WIFI_POP_ENTER_PIN_TO_CONNECT_TO_PS"));
1250 snprintf(pop->text, sizeof(pop->text), text1, connection->peer_name);
1252 snprintf(pop->label1, sizeof(pop->label1), "%s", _("IDS_WIFI_SK_CONNECT"));
1253 snprintf(pop->label2, sizeof(pop->label2), "%s", _("IDS_BR_SK_CANCEL"));
1254 pop->timeout = WFD_POP_TIMER_120;
1255 pop->resp_data1 = WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK;
1256 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1258 ad->popup = wfd_draw_pop_type_keypad(ad->win, pop);
1261 case /* MO/MT */ WFD_POP_PROG_CONNECT_WITH_PIN:
1262 _replace_1PS_2PD((char *)text, sizeof(text),
1263 _("IDS_WIFI_POP_CONNECT_TO_PS_IN_PD_SECONDS"),
1264 peer_name, WFD_POP_TIMER_120);
1266 snprintf(text1, WFD_POP_STR_MAX_LEN, "%s %s %s",
1269 _("IDS_WIFI_POP_PIN_CODE_PS"));
1270 snprintf(pop->text, sizeof(pop->text), text1, connection->wps_pin);
1272 snprintf(pop->label2, sizeof(pop->label2), "%s", _("IDS_BR_SK_CANCEL"));
1273 pop->timeout = WFD_POP_TIMER_120;
1274 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
1276 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
1279 case WFD_POP_PROG_CONNECT_CANCEL:
1280 snprintf(pop->text, sizeof(pop->text), "%s", _("IDS_BR_SK_CANCEL"));
1281 pop->timeout = WFD_POP_TIMER_120;
1282 ad->popup = wfd_draw_pop_type_a(ad->win, pop);
1291 ret = feedback_play(FEEDBACK_PATTERN_GENERAL);
1292 if (ret != FEEDBACK_ERROR_NONE) {
1293 WFD_APP_LOG(WFD_APP_LOG_ERROR,"feedback_play error : %d\n", ret);
1295 WFD_IF_FREE_MEM(peer_name);
1296 __WFD_APP_FUNC_EXIT__;