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 "wifi-direct.h"
33 #include "wfd-app-strings.h"
34 #include "wfd-app-util.h"
36 extern wfd_appdata_t *g_wfd_ad;
37 extern wfd_popup_t *g_wfd_pop;
38 extern unsigned char g_wfd_peer_mac[6];
39 extern unsigned char g_wfd_peer_name[32];
40 static Ecore_Timer *pb_timer = NULL;
42 void wfd_tickernoti_popup(char *msg);
45 * This function let the ug make a callback for click the button in popup
47 * @param[in] data the pointer to the main data structure
48 * @param[in] obj the pointer to the evas object
49 * @param[in] event_info the pointer to the event information
51 static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
53 __WDPOP_LOG_FUNC_ENTER__;
54 wfd_appdata_t *ad = wfd_get_appdata();
56 int resp = (int) data;
57 char msg[WFD_POP_STR_MAX_LEN] = {0};
59 WDPOP_LOGI( "popup resp : %d\n", resp);
62 case /* MT */ WFD_POP_RESP_APRV_CONNECT_PBC_YES:
65 "WFD_POP_RESP_APRV_CONNECT_PBC_YES\n");
68 result = wifi_direct_accept_connection(ad->peer_mac);
70 "wifi_direct_accept_connection() result=[%d]\n",
72 if (result == WIFI_DIRECT_ERROR_NONE) {
73 /* tickernoti popup */
74 wfd_tickernoti_popup(_("IDS_WFD_POP_CONNECTING"));
77 "wifi_direct_accept_connection() FAILED!!\n");
78 evas_object_hide(ad->win);
80 /* tickernoti popup */
81 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
82 wfd_tickernoti_popup(msg);
87 case /* MT */ WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK:
92 "WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK\n");
95 if (wifi_direct_generate_wps_pin() != WIFI_DIRECT_ERROR_NONE) {
96 WDPOP_LOGD( "wifi_direct_generate_wps_pin() is failed\n");
100 if (wifi_direct_get_wps_pin(&pin) != WIFI_DIRECT_ERROR_NONE) {
101 WDPOP_LOGD( "wifi_direct_generate_wps_pin() is failed\n");
105 strncpy(ad->pin_number, pin, 64);
108 WDPOP_LOGD( "button ok: pin [%s]", ad->pin_number);
110 result = wifi_direct_accept_connection(ad->peer_mac);
111 if (result == WIFI_DIRECT_ERROR_NONE) {
112 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_PIN, NULL);
115 "wifi_direct_accept_connection() failed. result=[%d]\n", result);
116 /* tickernoti popup */
117 wfd_tickernoti_popup(IDS_WFD_POP_CONNECT_FAILED);
122 case /* MO */ WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK:
125 "WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK\n");
129 int len = strlen(ad->pin_number);
130 WDPOP_LOGD( "button ok: pin [%s]", ad->pin_number);
134 wfd_tickernoti_popup(_("IDS_CST_BODY_PASSWORD_TOO_LONG"));
136 wfd_tickernoti_popup(_("IDS_ST_BODY_PASSWORD_TOO_SHORT"));
137 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
142 WDPOP_LOGD( "pin=[%s]\n", ad->pin_number);
144 result = wifi_direct_set_wps_pin(ad->pin_number);
145 if (result != WIFI_DIRECT_ERROR_NONE) {
146 /* tickernoti popup */
147 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
148 wfd_tickernoti_popup(msg);
152 //result = wifi_direct_activate_pushbutton();
153 result = wifi_direct_accept_connection(ad->peer_mac);
155 "wifi_direct_accept_connection(%s) result=[%d]\n",
156 ad->peer_mac, result);
157 if (result != WIFI_DIRECT_ERROR_NONE) {
159 "wifi_direct_accept_connection() FAILED!!\n");
160 evas_object_hide(ad->win);
162 /* tickernoti popup */
163 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
164 wfd_tickernoti_popup(msg);
169 case /* MT */ WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES:
172 "WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES\n");
175 ecore_timer_del(pb_timer);
179 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
183 case /* MT */ WFD_POP_RESP_APRV_CONNECT_NO:
186 "WFD_POP_RESP_APRV_CONNECT_NO: destroy_popup...\n");
190 ecore_timer_del(pb_timer);
194 result = wifi_direct_disconnect(ad->peer_mac);
196 "wifi_direct_disconnect[%s] result=[%d]\n",
197 ad->peer_mac, result);
203 WDPOP_LOGE( "Unknown respone\n");
204 evas_object_hide(ad->win);
209 __WDPOP_LOG_FUNC_EXIT__;
213 * This function let the app destroy the popup
217 void wfd_destroy_popup()
219 __WDPOP_LOG_FUNC_ENTER__;
220 wfd_appdata_t *ad = wfd_get_appdata();
223 WDPOP_LOGE( "ad is NULL\n");
228 evas_object_del(ad->popup);
232 if (ad->popup_timeout_handle > 0) {
233 g_source_remove(ad->popup_timeout_handle);
234 ad->popup_timeout_handle = 0;
237 evas_object_hide(ad->win);
239 __WDPOP_LOG_FUNC_EXIT__;
244 * This function let the app create a popup which includes no button
246 * @param[in] win the window object
247 * @param[in] pop the pointer to the prepared popup
249 static Evas_Object *wfd_draw_pop_type_a(Evas_Object * win, wfd_popup_t * pop)
251 __WDPOP_LOG_FUNC_ENTER__;
254 popup = elm_popup_add(win);
255 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
256 elm_object_text_set(popup, pop->text);
257 elm_popup_timeout_set(popup, pop->timeout);
258 evas_object_show(popup);
259 evas_object_show(win);
261 __WDPOP_LOG_FUNC_EXIT__;
266 * This function let the app create a popup which includes one button
268 * @param[in] win the window object
269 * @param[in] pop the pointer to the prepared popup
271 static Evas_Object *wfd_draw_pop_type_b(Evas_Object * win, wfd_popup_t * pop)
273 __WDPOP_LOG_FUNC_ENTER__;
274 Evas_Object *popup = NULL;
275 Evas_Object *btn = NULL;
277 popup = elm_popup_add(win);
278 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
279 elm_object_text_set(popup, pop->text);
281 btn = elm_button_add(popup);
282 elm_object_style_set(btn, "popup_button/default");
283 elm_object_text_set(btn, pop->label1);
284 elm_object_part_content_set(popup, "button1", btn);
285 evas_object_smart_callback_add(btn, "clicked", __popup_resp_cb, (void *) pop->resp_data1);
287 evas_object_show(popup);
288 evas_object_show(win);
290 __WDPOP_LOG_FUNC_EXIT__;
295 * This function let the app create a popup which includes two buttons
297 * @param[in] win the window object
298 * @param[in] pop the pointer to the prepared popup
300 static Evas_Object *wfd_draw_pop_type_c(Evas_Object * win, wfd_popup_t * pop)
302 __WDPOP_LOG_FUNC_ENTER__;
303 Evas_Object *popup = NULL;
304 Evas_Object *btn1 = NULL, *btn2 = NULL;
306 popup = elm_popup_add(win);
307 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
308 elm_object_text_set(popup, pop->text);
310 btn1 = elm_button_add(popup);
311 elm_object_style_set(btn1, "popup_button/default");
312 elm_object_text_set(btn1, pop->label1);
313 elm_object_part_content_set(popup, "button1", btn1);
314 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
315 (void *) pop->resp_data1);
317 btn2 = elm_button_add(popup);
318 elm_object_style_set(btn2, "popup_button/default");
319 elm_object_text_set(btn2, pop->label2);
320 elm_object_part_content_set(popup, "button2", btn2);
321 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
322 (void *) pop->resp_data2);
324 evas_object_show(popup);
325 evas_object_show(win);
327 __WDPOP_LOG_FUNC_EXIT__;
332 * This function let the ug make a change callback for password input
334 * @param[in] data the pointer to the main data structure
335 * @param[in] obj the pointer to the evas object
336 * @param[in] event_info the pointer to the event information
338 static void _smart_ime_cb(void *data, Evas_Object * obj, void *event_info)
340 __WDPOP_LOG_FUNC_ENTER__;
341 wfd_appdata_t *ad = wfd_get_appdata();
343 Ecore_IMF_Context *imf_context = NULL;
344 imf_context = (Ecore_IMF_Context *) ad->pin_entry;
346 if (NULL == imf_context) {
347 WDPOP_LOGE( "Error!!! Ecore_IMF_Context is NULL!!");
351 const char *txt = elm_entry_markup_to_utf8(elm_entry_entry_get((const Evas_Object *) imf_context));
353 WDPOP_LOGD( "* text [%s], len=[%d]", txt, strlen(txt));
354 strncpy(ad->pin_number, txt, sizeof(ad->pin_number));
359 __WDPOP_LOG_FUNC_EXIT__;
363 * This function let the app make a change callback for password checkbox
365 * @param[in] data the pointer to the main data structure
366 * @param[in] obj the pointer to the evas object
367 * @param[in] event_info the pointer to the event information
369 static void _check_changed_cb(void *data, Evas_Object * obj, void *event_info)
371 wfd_appdata_t *ad = wfd_get_appdata();
377 Eina_Bool state = elm_check_state_get(obj);
378 elm_entry_password_set(ad->pin_entry, !state);
382 * This function let the app make a callback for progressbar timer
383 * @return if stop the timer, return ECORE_CALLBACK_CANCEL, else return ECORE_CALLBACK_RENEW
384 * @param[in] data the pointer to the wps structure
386 static Eina_Bool _fn_pb_timer(void *data)
390 char time_label[32] = {0};
391 wfd_wps_display_popup_t *wps_display_popup = (wfd_wps_display_popup_t *) data;
393 if (NULL == wps_display_popup) {
394 WDPOP_LOGE( "Param is NULL.\n");
395 return ECORE_CALLBACK_CANCEL;
398 Evas_Object *progressbar = NULL;
399 Evas_Object *time = NULL;
401 progressbar = wps_display_popup->progressbar;
402 time = wps_display_popup->time;
403 value = elm_progressbar_value_get(progressbar);
406 WDPOP_LOGE( "Progress end.\n");
408 ecore_timer_del(pb_timer);
412 return ECORE_CALLBACK_CANCEL;
415 wps_display_popup->step++;
416 step = wps_display_popup->step;
417 value = ((double)step) / WFD_POP_TIMER_120;
418 elm_progressbar_value_set(progressbar, value);
419 WDPOP_LOGD( "step: %d, value: %f\n", wps_display_popup->step, value);
421 /* show the time label */
424 snprintf(time_label, 32, "00:0%d", step);
426 snprintf(time_label, 32, "00:%d", step);
430 snprintf(time_label, 32, "0%d:0%d", step/60, step%60);
432 snprintf(time_label, 32, "0%d:%d", step/60, step%60);
436 elm_object_text_set(time, time_label);
438 return ECORE_CALLBACK_RENEW;
442 * This function let the app create a edit filed
444 * @param[in] parent the parent object
445 * @param[in] title the pointer to the title of edit field
446 * @param[in] guide the pointer to the text of guide
447 * @param[in] single_line whether it can support single line
448 * @param[in] is_editable whether it is avaliable to edit
450 static Evas_Object *_add_edit_field(Evas_Object *parent, const char *title, const char *guide, Eina_Bool single_line, Eina_Bool is_editable)
452 assertm_if(NULL == parent, "parent is NULL!!");
454 Evas_Object *layout = elm_layout_add(parent);
455 assertm_if(NULL == layout, "layout is NULL!!");
457 if (title && title[0] != '\0') {
458 elm_layout_theme_set(layout, "layout", "editfield", "title");
459 elm_object_part_text_set(layout, "elm.text", title);
461 elm_layout_theme_set(layout, "layout", "editfield", "default");
464 Evas_Object *entry = elm_entry_add(parent);
465 assertm_if(NULL == entry, "entry is NULL!!");
467 elm_object_part_content_set(layout, "elm.swallow.content", entry);
468 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
470 if (guide && guide[0] != '\0') {
471 elm_object_part_text_set(layout, "elm.guidetext", guide);
474 elm_entry_single_line_set(entry, single_line);
475 elm_entry_scrollable_set(entry, single_line);
476 elm_entry_editable_set(entry, is_editable);
477 elm_object_signal_emit(layout, "elm,state,eraser,hide", "elm");
478 evas_object_show(layout);
484 * This function let the app create a display popup
485 * @return display popup
486 * @param[in] win the window object
487 * @param[in] pop the pointer to the prepared popup
489 Evas_Object *wfd_draw_pop_type_display(Evas_Object * win, wfd_popup_t * pop)
491 __WDPOP_LOG_FUNC_ENTER__;
493 Evas_Object *popup = NULL;
494 Evas_Object *label = NULL;
495 Evas_Object *progressbar = NULL;
496 Evas_Object *time = NULL;
497 static wfd_wps_display_popup_t wps_display_popup;
499 popup = elm_popup_add(win);
500 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, 0.0);
502 Evas_Object *box = elm_box_add(popup);
504 evas_object_del(popup);
509 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
510 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
511 elm_object_part_content_set(popup, NULL, box);
512 evas_object_show(box);
515 label = elm_label_add(box);
516 elm_object_style_set(label, "popup/default");
517 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
518 elm_object_text_set(label, pop->text);
519 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
520 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, 0.0);
521 elm_box_pack_end(box, label);
522 evas_object_show(label);
524 /* add progressbar */
525 progressbar = elm_progressbar_add(box);
526 elm_object_style_set(progressbar, "list_progress");
527 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
528 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.0);
529 evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, 0.0);
530 elm_progressbar_value_set(progressbar, 0.0);
531 elm_box_pack_end(box, progressbar);
532 evas_object_show(progressbar);
535 time = elm_label_add(box);
536 elm_object_style_set(time, "popup/default");
537 elm_object_text_set(time, "00:00");
538 evas_object_size_hint_weight_set(time, EVAS_HINT_EXPAND, 0.0);
539 evas_object_size_hint_align_set(time, EVAS_HINT_FILL, 0.0);
540 elm_box_pack_end(box, time);
541 evas_object_show(time);
543 /* start progressbar timer */
544 wps_display_popup.step = 0;
545 wps_display_popup.progressbar = progressbar;
546 wps_display_popup.time = time;
547 pb_timer = ecore_timer_add(1, _fn_pb_timer, &wps_display_popup);
550 if (pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES ||
551 pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_NO) {
552 Evas_Object *btn1 = NULL;
553 btn1 = elm_button_add(popup);
554 elm_object_style_set(btn1, "popup_button/default");
555 elm_object_text_set(btn1, pop->label1);
556 elm_object_part_content_set(popup, "button1", btn1);
557 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
558 (void *) pop->resp_data1);
561 if (pop->resp_data2 == WFD_POP_RESP_APRV_CONNECT_NO) {
562 Evas_Object *btn2 = NULL;
563 btn2 = elm_button_add(popup);
564 elm_object_style_set(btn2, "popup_button/default");
565 elm_object_text_set(btn2, pop->label2);
566 elm_object_part_content_set(popup, "button2", btn2);
567 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
568 (void *) pop->resp_data2);
571 elm_object_content_set(popup, box);
572 evas_object_show(popup);
573 evas_object_show(win);
575 __WDPOP_LOG_FUNC_EXIT__;
580 * This function let the app create a keypad popup
581 * @return keypad popup
582 * @param[in] win the window object
583 * @param[in] pop the pointer to the prepared popup
585 Evas_Object *wfd_draw_pop_type_keypad(Evas_Object * win, wfd_popup_t * pop)
587 __WDPOP_LOG_FUNC_ENTER__;
588 wfd_appdata_t *ad = wfd_get_appdata();
590 Evas_Object *conformant = NULL;
591 Evas_Object *layout = NULL;
592 Evas_Object *pinpopup = NULL;
593 Evas_Object *label = NULL;
594 Evas_Object *btn1 = NULL, *btn2 = NULL;
596 conformant = elm_conformant_add(win);
597 assertm_if(NULL == conformant, "conformant is NULL!!");
598 elm_win_conformant_set(win, EINA_TRUE);
599 elm_win_resize_object_add(win, conformant);
600 evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, 0.0);
601 evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, 0.0);
602 evas_object_show(conformant);
604 layout = elm_layout_add(conformant);
605 elm_object_content_set(conformant, layout);
607 pinpopup = elm_popup_add(layout);
608 assertm_if(NULL == pinpopup, "pinpopup is NULL!!");
609 evas_object_size_hint_weight_set(pinpopup, EVAS_HINT_EXPAND, 0.0);
610 elm_object_part_text_set(pinpopup, "title,text", _("IDS_WFD_POP_TITILE_CONNECTION"));
612 Evas_Object *box = elm_box_add(pinpopup);
614 evas_object_del(pinpopup);
619 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
620 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
621 elm_object_part_content_set(pinpopup, NULL, box);
622 evas_object_show(box);
625 label = elm_label_add(box);
626 elm_object_style_set(label, "popup/default");
627 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
628 elm_object_text_set(label, pop->text);
629 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
630 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
631 elm_box_pack_end(box, label);
632 evas_object_show(label);
635 Evas_Object *body = elm_layout_add(box);
637 evas_object_del(pinpopup);
642 elm_layout_theme_set(body, "layout", "dialogue", "1icon");
643 evas_object_size_hint_weight_set(body, EVAS_HINT_EXPAND, 0.0);
644 evas_object_size_hint_align_set(body, EVAS_HINT_FILL, 0.0);
646 Evas_Object *editfield_pin = _add_edit_field(body, NULL, NULL, EINA_TRUE, EINA_TRUE);
647 Evas_Object *entry_pin = elm_object_part_content_get(editfield_pin, "elm.swallow.content");
648 ad->pin_entry = entry_pin;
649 evas_object_smart_callback_add(ad->pin_entry, "changed", _smart_ime_cb, NULL);
650 elm_object_part_content_set(body, "elm.icon", editfield_pin);
651 elm_box_pack_end(box, body);
652 evas_object_show(body);
654 elm_entry_password_set(ad->pin_entry, TRUE);
656 Evas_Object *check = elm_check_add(box);
657 elm_object_text_set(check, _("Show password"));
658 elm_object_focus_allow_set(check, EINA_FALSE);
659 evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.0);
660 evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.0);
661 evas_object_smart_callback_add(check, "changed", _check_changed_cb, NULL);
662 evas_object_show(check);
663 elm_box_pack_end(box, check);
666 btn1 = elm_button_add(pinpopup);
667 elm_object_style_set(btn1, "popup_button/default");
668 elm_object_text_set(btn1, pop->label1);
669 elm_object_part_content_set(pinpopup, "button1", btn1);
670 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb, (void *)pop->resp_data1);
672 btn2 = elm_button_add(pinpopup);
673 elm_object_style_set(btn2, "popup_button/default");
674 elm_object_text_set(btn2, pop->label2);
675 elm_object_part_content_set(pinpopup, "button2", btn2);
676 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb, (void *)pop->resp_data2);
678 elm_object_content_set(pinpopup, box);
679 evas_object_show(pinpopup);
680 evas_object_show(win);
681 elm_object_focus_set(ad->pin_entry, EINA_TRUE);
683 __WDPOP_LOG_FUNC_EXIT__;
688 * This function let the app create a popup
690 * @param[in] type the type of popup
691 * @param[in] userdata the pointer to the data which will be used
693 void wfd_prepare_popup(int type, void *userdata)
695 __WDPOP_LOG_FUNC_ENTER__;
696 wfd_appdata_t *ad = wfd_get_appdata();
697 wfd_popup_t *pop = ad->popup_data;
701 memset(pop, 0, sizeof(wfd_popup_t));
706 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ:
707 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECT_Q,
709 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_YES"));
710 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_SK_NO"));
711 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_PBC_YES;
712 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
714 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
717 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ:
718 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_ENTER_PIN_WITH_KEYPAD,
720 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
721 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
722 pop->timeout = WFD_POP_TIMER_120;
723 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK;
724 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
726 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
729 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ:
730 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_ENTER_PIN,
731 ad->peer_name, WFD_POP_TIMER_120);
732 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
733 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
734 pop->timeout = WFD_POP_TIMER_120;
735 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES;
736 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
738 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
741 case /* MT */ WFD_POP_PROG_CONNECT:
742 snprintf(pop->text, sizeof(pop->text), "%s", _("IDS_WFD_POP_CONNECTING"));
743 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
744 pop->timeout = WFD_POP_TIMER_120;
745 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
747 ad->popup = wfd_draw_pop_type_b(ad->win, pop);
750 case /* MO */ WFD_POP_PROG_CONNECT_WITH_KEYPAD:
751 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECTING_WITH_KEYPAD,
752 ad->peer_name, WFD_POP_TIMER_120, ad->peer_name);
753 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
754 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
755 pop->timeout = WFD_POP_TIMER_120;
756 pop->resp_data1 = WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK;
757 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
759 ad->popup = wfd_draw_pop_type_keypad(ad->win, pop);
762 case /* MO/MT */ WFD_POP_PROG_CONNECT_WITH_PIN:
763 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECTING_WITH_PIN,
764 ad->peer_name, WFD_POP_TIMER_120, ad->pin_number);
765 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
766 pop->timeout = WFD_POP_TIMER_120;
767 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
769 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
772 case WFD_POP_PROG_CONNECT_CANCEL:
773 snprintf(pop->text, sizeof(pop->text), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
774 pop->timeout = WFD_POP_TIMER_120;
775 ad->popup = wfd_draw_pop_type_a(ad->win, pop);
782 __WDPOP_LOG_FUNC_EXIT__;
787 * This function let the app create a tickernoti syspopup
789 * @param[in] msg the pointer to message of tickernoti
791 void wfd_tickernoti_popup(char *msg)
793 __WDPOP_LOG_FUNC_ENTER__;
800 WDPOP_LOGD( "FAIL: bundle_create()\n");
804 /* tickernoti style */
805 ret = bundle_add(b, "0", "info");
807 WDPOP_LOGD( "Fail to add tickernoti style\n");
813 ret = bundle_add(b, "1", msg);
815 WDPOP_LOGD( "Fail to add popup text\n");
820 /* orientation of tickernoti */
821 ret = bundle_add(b, "2", "0");
823 WDPOP_LOGD( "Fail to add orientation of tickernoti\n");
828 /* timeout(second) of tickernoti */
829 ret = bundle_add(b, "3", "3");
831 WDPOP_LOGD( "Fail to add timeout of tickernoti\n");
836 /* launch tickernoti */
837 ret = syspopup_launch(TICKERNOTI_SYSPOPUP, b);
839 WDPOP_LOGD( "Fail to launch syspopup\n");
843 __WDPOP_LOG_FUNC_EXIT__;