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);
133 WDPOP_LOGD( "pin=[%s]\n", ad->pin_number);
135 result = wifi_direct_set_wps_pin(ad->pin_number);
136 if (result != WIFI_DIRECT_ERROR_NONE) {
137 /* tickernoti popup */
138 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
139 wfd_tickernoti_popup(msg);
143 //result = wifi_direct_activate_pushbutton();
144 result = wifi_direct_accept_connection(ad->peer_mac);
146 "wifi_direct_accept_connection(%s) result=[%d]\n",
147 ad->peer_mac, result);
148 if (result != WIFI_DIRECT_ERROR_NONE) {
150 "wifi_direct_accept_connection() FAILED!!\n");
151 evas_object_hide(ad->win);
153 /* tickernoti popup */
154 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
155 wfd_tickernoti_popup(msg);
160 case /* MT */ WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES:
163 "WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES\n");
166 ecore_timer_del(pb_timer);
170 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
174 case /* MT */ WFD_POP_RESP_APRV_CONNECT_NO:
177 "WFD_POP_RESP_APRV_CONNECT_NO: destroy_popup...\n");
181 ecore_timer_del(pb_timer);
185 result = wifi_direct_disconnect(ad->peer_mac);
187 "wifi_direct_disconnect[%s] result=[%d]\n",
188 ad->peer_mac, result);
194 WDPOP_LOGE( "Unknown respone\n");
195 evas_object_hide(ad->win);
200 __WDPOP_LOG_FUNC_EXIT__;
204 * This function let the app destroy the popup
208 void wfd_destroy_popup()
210 __WDPOP_LOG_FUNC_ENTER__;
211 wfd_appdata_t *ad = wfd_get_appdata();
214 WDPOP_LOGE( "ad is NULL\n");
219 evas_object_del(ad->popup);
223 if (ad->popup_timeout_handle > 0) {
224 g_source_remove(ad->popup_timeout_handle);
225 ad->popup_timeout_handle = 0;
228 evas_object_hide(ad->win);
230 __WDPOP_LOG_FUNC_EXIT__;
235 * This function let the app create a popup which includes no button
237 * @param[in] win the window object
238 * @param[in] pop the pointer to the prepared popup
240 static Evas_Object *wfd_draw_pop_type_a(Evas_Object * win, wfd_popup_t * pop)
242 __WDPOP_LOG_FUNC_ENTER__;
245 popup = elm_popup_add(win);
246 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
247 elm_object_text_set(popup, pop->text);
248 elm_popup_timeout_set(popup, pop->timeout);
249 evas_object_show(popup);
250 evas_object_show(win);
252 __WDPOP_LOG_FUNC_EXIT__;
257 * This function let the app create a popup which includes one button
259 * @param[in] win the window object
260 * @param[in] pop the pointer to the prepared popup
262 static Evas_Object *wfd_draw_pop_type_b(Evas_Object * win, wfd_popup_t * pop)
264 __WDPOP_LOG_FUNC_ENTER__;
265 Evas_Object *popup = NULL;
266 Evas_Object *btn = NULL;
268 popup = elm_popup_add(win);
269 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
270 elm_object_text_set(popup, pop->text);
272 btn = elm_button_add(popup);
273 elm_object_style_set(btn, "popup_button/default");
274 elm_object_text_set(btn, pop->label1);
275 elm_object_part_content_set(popup, "button1", btn);
276 evas_object_smart_callback_add(btn, "clicked", __popup_resp_cb, (void *) pop->resp_data1);
278 evas_object_show(popup);
279 evas_object_show(win);
281 __WDPOP_LOG_FUNC_EXIT__;
286 * This function let the app create a popup which includes two buttons
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_c(Evas_Object * win, wfd_popup_t * pop)
293 __WDPOP_LOG_FUNC_ENTER__;
294 Evas_Object *popup = NULL;
295 Evas_Object *btn1 = NULL, *btn2 = NULL;
297 popup = elm_popup_add(win);
298 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
299 elm_object_text_set(popup, pop->text);
301 btn1 = elm_button_add(popup);
302 elm_object_style_set(btn1, "popup_button/default");
303 elm_object_text_set(btn1, pop->label1);
304 elm_object_part_content_set(popup, "button1", btn1);
305 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
306 (void *) pop->resp_data1);
308 btn2 = elm_button_add(popup);
309 elm_object_style_set(btn2, "popup_button/default");
310 elm_object_text_set(btn2, pop->label2);
311 elm_object_part_content_set(popup, "button2", btn2);
312 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
313 (void *) pop->resp_data2);
315 evas_object_show(popup);
316 evas_object_show(win);
318 __WDPOP_LOG_FUNC_EXIT__;
323 * This function let the ug make a change callback for password input
325 * @param[in] data the pointer to the main data structure
326 * @param[in] obj the pointer to the evas object
327 * @param[in] event_info the pointer to the event information
329 static void _smart_ime_cb(void *data, Evas_Object * obj, void *event_info)
331 __WDPOP_LOG_FUNC_ENTER__;
332 wfd_appdata_t *ad = wfd_get_appdata();
334 Ecore_IMF_Context *imf_context = NULL;
335 imf_context = (Ecore_IMF_Context *) ad->pin_entry;
337 if (NULL == imf_context) {
338 WDPOP_LOGE( "Error!!! Ecore_IMF_Context is NULL!!");
342 const char *txt = elm_entry_markup_to_utf8(elm_entry_entry_get((const Evas_Object *) imf_context));
344 WDPOP_LOGD( "* text [%s], len=[%d]", txt, strlen(txt));
345 strncpy(ad->pin_number, txt, sizeof(ad->pin_number));
350 __WDPOP_LOG_FUNC_EXIT__;
354 * This function let the app make a change callback for password checkbox
356 * @param[in] data the pointer to the main data structure
357 * @param[in] obj the pointer to the evas object
358 * @param[in] event_info the pointer to the event information
360 static void _check_changed_cb(void *data, Evas_Object * obj, void *event_info)
362 wfd_appdata_t *ad = wfd_get_appdata();
368 Eina_Bool state = elm_check_state_get(obj);
369 elm_entry_password_set(ad->pin_entry, !state);
373 * This function let the app make a callback for progressbar timer
374 * @return if stop the timer, return ECORE_CALLBACK_CANCEL, else return ECORE_CALLBACK_RENEW
375 * @param[in] data the pointer to the wps structure
377 static Eina_Bool _fn_pb_timer(void *data)
381 char time_label[32] = {0};
382 wfd_wps_display_popup_t *wps_display_popup = (wfd_wps_display_popup_t *) data;
384 if (NULL == wps_display_popup) {
385 WDPOP_LOGE( "Param is NULL.\n");
386 return ECORE_CALLBACK_CANCEL;
389 Evas_Object *progressbar = NULL;
390 Evas_Object *time = NULL;
392 progressbar = wps_display_popup->progressbar;
393 time = wps_display_popup->time;
394 value = elm_progressbar_value_get(progressbar);
397 WDPOP_LOGE( "Progress end.\n");
399 ecore_timer_del(pb_timer);
403 return ECORE_CALLBACK_CANCEL;
406 wps_display_popup->step++;
407 step = wps_display_popup->step;
408 value = ((double)step) / WFD_POP_TIMER_120;
409 elm_progressbar_value_set(progressbar, value);
410 WDPOP_LOGD( "step: %d, value: %f\n", wps_display_popup->step, value);
412 /* show the time label */
415 snprintf(time_label, 32, "00:0%d", step);
417 snprintf(time_label, 32, "00:%d", step);
421 snprintf(time_label, 32, "0%d:0%d", step/60, step%60);
423 snprintf(time_label, 32, "0%d:%d", step/60, step%60);
427 elm_object_text_set(time, time_label);
429 return ECORE_CALLBACK_RENEW;
433 * This function let the app create a edit filed
435 * @param[in] parent the parent object
436 * @param[in] title the pointer to the title of edit field
437 * @param[in] guide the pointer to the text of guide
438 * @param[in] single_line whether it can support single line
439 * @param[in] is_editable whether it is avaliable to edit
441 static Evas_Object *_add_edit_field(Evas_Object *parent, const char *title, const char *guide, Eina_Bool single_line, Eina_Bool is_editable)
443 assertm_if(NULL == parent, "parent is NULL!!");
445 Evas_Object *layout = elm_layout_add(parent);
446 assertm_if(NULL == layout, "layout is NULL!!");
448 if (title && title[0] != '\0') {
449 elm_layout_theme_set(layout, "layout", "editfield", "title");
450 elm_object_part_text_set(layout, "elm.text", title);
452 elm_layout_theme_set(layout, "layout", "editfield", "default");
455 Evas_Object *entry = elm_entry_add(parent);
456 assertm_if(NULL == entry, "entry is NULL!!");
458 elm_object_part_content_set(layout, "elm.swallow.content", entry);
459 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
461 if (guide && guide[0] != '\0') {
462 elm_object_part_text_set(layout, "elm.guidetext", guide);
465 elm_entry_single_line_set(entry, single_line);
466 elm_entry_scrollable_set(entry, single_line);
467 elm_entry_editable_set(entry, is_editable);
468 elm_object_signal_emit(layout, "elm,state,eraser,hide", "elm");
469 evas_object_show(layout);
475 * This function let the app create a display popup
476 * @return display popup
477 * @param[in] win the window object
478 * @param[in] pop the pointer to the prepared popup
480 Evas_Object *wfd_draw_pop_type_display(Evas_Object * win, wfd_popup_t * pop)
482 __WDPOP_LOG_FUNC_ENTER__;
484 Evas_Object *popup = NULL;
485 Evas_Object *label = NULL;
486 Evas_Object *progressbar = NULL;
487 Evas_Object *time = NULL;
488 static wfd_wps_display_popup_t wps_display_popup;
490 popup = elm_popup_add(win);
491 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, 0.0);
493 Evas_Object *box = elm_box_add(popup);
495 evas_object_del(popup);
500 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
501 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
502 elm_object_part_content_set(popup, NULL, box);
503 evas_object_show(box);
506 label = elm_label_add(box);
507 elm_object_style_set(label, "popup/default");
508 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
509 elm_object_text_set(label, pop->text);
510 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
511 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, 0.0);
512 elm_box_pack_end(box, label);
513 evas_object_show(label);
515 /* add progressbar */
516 progressbar = elm_progressbar_add(box);
517 elm_object_style_set(progressbar, "list_progress");
518 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
519 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.0);
520 evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, 0.0);
521 elm_progressbar_value_set(progressbar, 0.0);
522 elm_box_pack_end(box, progressbar);
523 evas_object_show(progressbar);
526 time = elm_label_add(box);
527 elm_object_style_set(time, "popup/default");
528 elm_object_text_set(time, "00:00");
529 evas_object_size_hint_weight_set(time, EVAS_HINT_EXPAND, 0.0);
530 evas_object_size_hint_align_set(time, EVAS_HINT_FILL, 0.0);
531 elm_box_pack_end(box, time);
532 evas_object_show(time);
534 /* start progressbar timer */
535 wps_display_popup.step = 0;
536 wps_display_popup.progressbar = progressbar;
537 wps_display_popup.time = time;
538 pb_timer = ecore_timer_add(1, _fn_pb_timer, &wps_display_popup);
541 if (pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES ||
542 pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_NO) {
543 Evas_Object *btn1 = NULL;
544 btn1 = elm_button_add(popup);
545 elm_object_style_set(btn1, "popup_button/default");
546 elm_object_text_set(btn1, pop->label1);
547 elm_object_part_content_set(popup, "button1", btn1);
548 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
549 (void *) pop->resp_data1);
552 if (pop->resp_data2 == WFD_POP_RESP_APRV_CONNECT_NO) {
553 Evas_Object *btn2 = NULL;
554 btn2 = elm_button_add(popup);
555 elm_object_style_set(btn2, "popup_button/default");
556 elm_object_text_set(btn2, pop->label2);
557 elm_object_part_content_set(popup, "button2", btn2);
558 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
559 (void *) pop->resp_data2);
562 elm_object_content_set(popup, box);
563 evas_object_show(popup);
564 evas_object_show(win);
566 __WDPOP_LOG_FUNC_EXIT__;
571 * This function let the app create a keypad popup
572 * @return keypad popup
573 * @param[in] win the window object
574 * @param[in] pop the pointer to the prepared popup
576 Evas_Object *wfd_draw_pop_type_keypad(Evas_Object * win, wfd_popup_t * pop)
578 __WDPOP_LOG_FUNC_ENTER__;
579 wfd_appdata_t *ad = wfd_get_appdata();
581 Evas_Object *conformant = NULL;
582 Evas_Object *layout = NULL;
583 Evas_Object *pinpopup = NULL;
584 Evas_Object *label = NULL;
585 Evas_Object *btn1 = NULL, *btn2 = NULL;
587 conformant = elm_conformant_add(win);
588 assertm_if(NULL == conformant, "conformant is NULL!!");
589 elm_win_conformant_set(win, EINA_TRUE);
590 elm_win_resize_object_add(win, conformant);
591 evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, 0.0);
592 evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, 0.0);
593 evas_object_show(conformant);
595 layout = elm_layout_add(conformant);
596 elm_object_content_set(conformant, layout);
598 pinpopup = elm_popup_add(layout);
599 assertm_if(NULL == pinpopup, "pinpopup is NULL!!");
600 evas_object_size_hint_weight_set(pinpopup, EVAS_HINT_EXPAND, 0.0);
601 elm_object_part_text_set(pinpopup, "title,text", _("IDS_WFD_POP_TITILE_CONNECTION"));
603 Evas_Object *box = elm_box_add(pinpopup);
605 evas_object_del(pinpopup);
610 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
611 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
612 elm_object_part_content_set(pinpopup, NULL, box);
613 evas_object_show(box);
616 label = elm_label_add(box);
617 elm_object_style_set(label, "popup/default");
618 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
619 elm_object_text_set(label, pop->text);
620 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
621 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
622 elm_box_pack_end(box, label);
623 evas_object_show(label);
626 Evas_Object *body = elm_layout_add(box);
628 evas_object_del(pinpopup);
633 elm_layout_theme_set(body, "layout", "dialogue", "1icon");
634 evas_object_size_hint_weight_set(body, EVAS_HINT_EXPAND, 0.0);
635 evas_object_size_hint_align_set(body, EVAS_HINT_FILL, 0.0);
637 Evas_Object *editfield_pin = _add_edit_field(body, NULL, NULL, EINA_TRUE, EINA_TRUE);
638 Evas_Object *entry_pin = elm_object_part_content_get(editfield_pin, "elm.swallow.content");
639 ad->pin_entry = entry_pin;
640 evas_object_smart_callback_add(ad->pin_entry, "changed", _smart_ime_cb, NULL);
641 elm_object_part_content_set(body, "elm.icon", editfield_pin);
642 elm_box_pack_end(box, body);
643 evas_object_show(body);
645 elm_entry_password_set(ad->pin_entry, TRUE);
647 Evas_Object *check = elm_check_add(box);
648 elm_object_text_set(check, _("Show password"));
649 elm_object_focus_allow_set(check, EINA_FALSE);
650 evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.0);
651 evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.0);
652 evas_object_smart_callback_add(check, "changed", _check_changed_cb, NULL);
653 evas_object_show(check);
654 elm_box_pack_end(box, check);
657 btn1 = elm_button_add(pinpopup);
658 elm_object_style_set(btn1, "popup_button/default");
659 elm_object_text_set(btn1, pop->label1);
660 elm_object_part_content_set(pinpopup, "button1", btn1);
661 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb, (void *)pop->resp_data1);
663 btn2 = elm_button_add(pinpopup);
664 elm_object_style_set(btn2, "popup_button/default");
665 elm_object_text_set(btn2, pop->label2);
666 elm_object_part_content_set(pinpopup, "button2", btn2);
667 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb, (void *)pop->resp_data2);
669 elm_object_content_set(pinpopup, box);
670 evas_object_show(pinpopup);
671 evas_object_show(win);
672 elm_object_focus_set(ad->pin_entry, EINA_TRUE);
674 __WDPOP_LOG_FUNC_EXIT__;
679 * This function let the app create a popup
681 * @param[in] type the type of popup
682 * @param[in] userdata the pointer to the data which will be used
684 void wfd_prepare_popup(int type, void *userdata)
686 __WDPOP_LOG_FUNC_ENTER__;
687 wfd_appdata_t *ad = wfd_get_appdata();
688 wfd_popup_t *pop = ad->popup_data;
692 memset(pop, 0, sizeof(wfd_popup_t));
697 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ:
698 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECT_Q,
700 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_YES"));
701 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_SK_NO"));
702 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_PBC_YES;
703 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
705 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
708 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ:
709 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_ENTER_PIN_WITH_KEYPAD,
711 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
712 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
713 pop->timeout = WFD_POP_TIMER_120;
714 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK;
715 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
717 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
720 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ:
721 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_ENTER_PIN,
722 ad->peer_name, WFD_POP_TIMER_120);
723 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
724 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
725 pop->timeout = WFD_POP_TIMER_120;
726 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES;
727 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
729 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
732 case /* MT */ WFD_POP_PROG_CONNECT:
733 snprintf(pop->text, sizeof(pop->text), "%s", _("IDS_WFD_POP_CONNECTING"));
734 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
735 pop->timeout = WFD_POP_TIMER_120;
736 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
738 ad->popup = wfd_draw_pop_type_b(ad->win, pop);
741 case /* MO */ WFD_POP_PROG_CONNECT_WITH_KEYPAD:
742 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECTING_WITH_KEYPAD,
743 ad->peer_name, WFD_POP_TIMER_120, ad->peer_name);
744 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
745 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
746 pop->timeout = WFD_POP_TIMER_120;
747 pop->resp_data1 = WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK;
748 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
750 ad->popup = wfd_draw_pop_type_keypad(ad->win, pop);
753 case /* MO/MT */ WFD_POP_PROG_CONNECT_WITH_PIN:
754 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECTING_WITH_PIN,
755 ad->peer_name, WFD_POP_TIMER_120, ad->pin_number);
756 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
757 pop->timeout = WFD_POP_TIMER_120;
758 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
760 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
763 case WFD_POP_PROG_CONNECT_CANCEL:
764 snprintf(pop->text, sizeof(pop->text), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
765 pop->timeout = WFD_POP_TIMER_120;
766 ad->popup = wfd_draw_pop_type_a(ad->win, pop);
773 __WDPOP_LOG_FUNC_EXIT__;
778 * This function let the app create a tickernoti syspopup
780 * @param[in] msg the pointer to message of tickernoti
782 void wfd_tickernoti_popup(char *msg)
784 __WDPOP_LOG_FUNC_ENTER__;
791 WDPOP_LOGD( "FAIL: bundle_create()\n");
795 /* tickernoti style */
796 ret = bundle_add(b, "0", "info");
798 WDPOP_LOGD( "Fail to add tickernoti style\n");
804 ret = bundle_add(b, "1", msg);
806 WDPOP_LOGD( "Fail to add popup text\n");
811 /* orientation of tickernoti */
812 ret = bundle_add(b, "2", "0");
814 WDPOP_LOGD( "Fail to add orientation of tickernoti\n");
819 /* timeout(second) of tickernoti */
820 ret = bundle_add(b, "3", "3");
822 WDPOP_LOGD( "Fail to add timeout of tickernoti\n");
827 /* launch tickernoti */
828 ret = syspopup_launch(TICKERNOTI_SYSPOPUP, b);
830 WDPOP_LOGD( "Fail to launch syspopup\n");
834 __WDPOP_LOG_FUNC_EXIT__;