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 WFD_POP_RESP_APRV_CONNECT_INVITATION_YES:
89 "WFD_POP_RESP_APRV_CONNECT_INVITATION_YES [" MACSTR "]\n", MAC2STR(ad->peer_mac));
92 result = wifi_direct_connect(ad->peer_mac);
94 "wifi_direct_connect() result=[%d]\n",
96 if (result == WIFI_DIRECT_ERROR_NONE) {
97 /* tickernoti popup */
98 wfd_tickernoti_popup(_("IDS_WFD_POP_CONNECTING"));
101 "wifi_direct_connect() FAILED!!\n");
102 evas_object_hide(ad->win);
104 /* tickernoti popup */
105 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
106 wfd_tickernoti_popup(msg);
111 case /* MT */ WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK:
116 "WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK\n");
119 if (wifi_direct_generate_wps_pin() != WIFI_DIRECT_ERROR_NONE) {
120 WDPOP_LOGD( "wifi_direct_generate_wps_pin() is failed\n");
124 if (wifi_direct_get_wps_pin(&pin) != WIFI_DIRECT_ERROR_NONE) {
125 WDPOP_LOGD( "wifi_direct_generate_wps_pin() is failed\n");
129 strncpy(ad->pin_number, pin, 64);
132 WDPOP_LOGD( "button ok: pin [%s]", ad->pin_number);
134 result = wifi_direct_accept_connection(ad->peer_mac);
135 if (result == WIFI_DIRECT_ERROR_NONE) {
136 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_PIN, NULL);
139 "wifi_direct_accept_connection() failed. result=[%d]\n", result);
140 /* tickernoti popup */
141 wfd_tickernoti_popup(IDS_WFD_POP_CONNECT_FAILED);
146 case /* MO */ WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK:
149 "WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK\n");
153 int len = strlen(ad->pin_number);
154 WDPOP_LOGD( "button ok: pin [%s]", ad->pin_number);
158 wfd_tickernoti_popup(_("IDS_CST_BODY_PASSWORD_TOO_LONG"));
160 wfd_tickernoti_popup(_("IDS_ST_BODY_PASSWORD_TOO_SHORT"));
161 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
166 WDPOP_LOGD( "pin=[%s]\n", ad->pin_number);
168 result = wifi_direct_set_wps_pin(ad->pin_number);
169 if (result != WIFI_DIRECT_ERROR_NONE) {
170 /* tickernoti popup */
171 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
172 wfd_tickernoti_popup(msg);
176 //result = wifi_direct_activate_pushbutton();
177 result = wifi_direct_accept_connection(ad->peer_mac);
179 "wifi_direct_accept_connection(%s) result=[%d]\n",
180 ad->peer_mac, result);
181 if (result != WIFI_DIRECT_ERROR_NONE) {
183 "wifi_direct_accept_connection() FAILED!!\n");
184 evas_object_hide(ad->win);
186 /* tickernoti popup */
187 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
188 wfd_tickernoti_popup(msg);
193 case /* MT */ WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES:
196 "WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES\n");
199 ecore_timer_del(pb_timer);
203 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
207 case /* MT */ WFD_POP_RESP_APRV_CONNECT_NO:
210 "WFD_POP_RESP_APRV_CONNECT_NO: destroy_popup...\n");
214 ecore_timer_del(pb_timer);
218 result = wifi_direct_disconnect(ad->peer_mac);
220 "wifi_direct_disconnect[%s] result=[%d]\n",
221 ad->peer_mac, result);
227 WDPOP_LOGE( "Unknown respone\n");
228 evas_object_hide(ad->win);
233 __WDPOP_LOG_FUNC_EXIT__;
237 * This function let the app destroy the popup
241 void wfd_destroy_popup()
243 __WDPOP_LOG_FUNC_ENTER__;
244 wfd_appdata_t *ad = wfd_get_appdata();
247 WDPOP_LOGE( "ad is NULL\n");
252 evas_object_del(ad->popup);
256 if (ad->popup_timeout_handle > 0) {
257 g_source_remove(ad->popup_timeout_handle);
258 ad->popup_timeout_handle = 0;
261 evas_object_hide(ad->win);
263 __WDPOP_LOG_FUNC_EXIT__;
268 * This function let the app create a popup which includes no button
270 * @param[in] win the window object
271 * @param[in] pop the pointer to the prepared popup
273 static Evas_Object *wfd_draw_pop_type_a(Evas_Object * win, wfd_popup_t * pop)
275 __WDPOP_LOG_FUNC_ENTER__;
278 popup = elm_popup_add(win);
279 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
280 elm_object_text_set(popup, pop->text);
281 elm_popup_timeout_set(popup, pop->timeout);
282 evas_object_show(popup);
283 evas_object_show(win);
285 __WDPOP_LOG_FUNC_EXIT__;
290 * This function let the app create a popup which includes one button
292 * @param[in] win the window object
293 * @param[in] pop the pointer to the prepared popup
295 static Evas_Object *wfd_draw_pop_type_b(Evas_Object * win, wfd_popup_t * pop)
297 __WDPOP_LOG_FUNC_ENTER__;
298 Evas_Object *popup = NULL;
299 Evas_Object *btn = NULL;
301 popup = elm_popup_add(win);
302 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
303 elm_object_text_set(popup, pop->text);
305 btn = elm_button_add(popup);
306 elm_object_style_set(btn, "popup_button/default");
307 elm_object_text_set(btn, pop->label1);
308 elm_object_part_content_set(popup, "button1", btn);
309 evas_object_smart_callback_add(btn, "clicked", __popup_resp_cb, (void *) pop->resp_data1);
311 evas_object_show(popup);
312 evas_object_show(win);
314 __WDPOP_LOG_FUNC_EXIT__;
319 * This function let the app create a popup which includes two buttons
321 * @param[in] win the window object
322 * @param[in] pop the pointer to the prepared popup
324 static Evas_Object *wfd_draw_pop_type_c(Evas_Object * win, wfd_popup_t * pop)
326 __WDPOP_LOG_FUNC_ENTER__;
327 Evas_Object *popup = NULL;
328 Evas_Object *btn1 = NULL, *btn2 = NULL;
330 popup = elm_popup_add(win);
331 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
332 elm_object_text_set(popup, pop->text);
334 btn1 = elm_button_add(popup);
335 elm_object_style_set(btn1, "popup_button/default");
336 elm_object_text_set(btn1, pop->label1);
337 elm_object_part_content_set(popup, "button1", btn1);
338 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
339 (void *) pop->resp_data1);
341 btn2 = elm_button_add(popup);
342 elm_object_style_set(btn2, "popup_button/default");
343 elm_object_text_set(btn2, pop->label2);
344 elm_object_part_content_set(popup, "button2", btn2);
345 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
346 (void *) pop->resp_data2);
348 evas_object_show(popup);
349 evas_object_show(win);
351 __WDPOP_LOG_FUNC_EXIT__;
356 * This function let the ug make a change callback for password input
358 * @param[in] data the pointer to the main data structure
359 * @param[in] obj the pointer to the evas object
360 * @param[in] event_info the pointer to the event information
362 static void _smart_ime_cb(void *data, Evas_Object * obj, void *event_info)
364 __WDPOP_LOG_FUNC_ENTER__;
365 wfd_appdata_t *ad = wfd_get_appdata();
367 Ecore_IMF_Context *imf_context = NULL;
368 imf_context = (Ecore_IMF_Context *) ad->pin_entry;
370 if (NULL == imf_context) {
371 WDPOP_LOGE( "Error!!! Ecore_IMF_Context is NULL!!");
375 const char *txt = elm_entry_markup_to_utf8(elm_entry_entry_get((const Evas_Object *) imf_context));
377 WDPOP_LOGD( "* text [%s], len=[%d]", txt, strlen(txt));
378 strncpy(ad->pin_number, txt, sizeof(ad->pin_number));
383 __WDPOP_LOG_FUNC_EXIT__;
387 * This function let the app make a change callback for password checkbox
389 * @param[in] data the pointer to the main data structure
390 * @param[in] obj the pointer to the evas object
391 * @param[in] event_info the pointer to the event information
393 static void _check_changed_cb(void *data, Evas_Object * obj, void *event_info)
395 wfd_appdata_t *ad = wfd_get_appdata();
401 Eina_Bool state = elm_check_state_get(obj);
402 elm_entry_password_set(ad->pin_entry, !state);
403 elm_entry_autocapital_type_set(ad->pin_entry, ELM_AUTOCAPITAL_TYPE_NONE);
407 * This function let the app make a callback for progressbar timer
408 * @return if stop the timer, return ECORE_CALLBACK_CANCEL, else return ECORE_CALLBACK_RENEW
409 * @param[in] data the pointer to the wps structure
411 static Eina_Bool _fn_pb_timer(void *data)
415 char time_label[32] = {0};
416 wfd_wps_display_popup_t *wps_display_popup = (wfd_wps_display_popup_t *) data;
418 if (NULL == wps_display_popup) {
419 WDPOP_LOGE( "Param is NULL.\n");
420 return ECORE_CALLBACK_CANCEL;
423 Evas_Object *progressbar = NULL;
424 Evas_Object *time = NULL;
426 progressbar = wps_display_popup->progressbar;
427 time = wps_display_popup->time;
428 value = elm_progressbar_value_get(progressbar);
431 WDPOP_LOGE( "Progress end.\n");
433 ecore_timer_del(pb_timer);
437 return ECORE_CALLBACK_CANCEL;
440 wps_display_popup->step++;
441 step = wps_display_popup->step;
442 value = ((double)step) / WFD_POP_TIMER_120;
443 elm_progressbar_value_set(progressbar, value);
444 WDPOP_LOGD( "step: %d, value: %f\n", wps_display_popup->step, value);
446 /* show the time label */
449 snprintf(time_label, 32, "00:0%d", step);
451 snprintf(time_label, 32, "00:%d", step);
455 snprintf(time_label, 32, "0%d:0%d", step/60, step%60);
457 snprintf(time_label, 32, "0%d:%d", step/60, step%60);
461 elm_object_text_set(time, time_label);
463 return ECORE_CALLBACK_RENEW;
467 * This function let the app create a edit filed
469 * @param[in] parent the parent object
470 * @param[in] title the pointer to the title of edit field
471 * @param[in] guide the pointer to the text of guide
472 * @param[in] single_line whether it can support single line
473 * @param[in] is_editable whether it is avaliable to edit
475 static Evas_Object *_add_edit_field(Evas_Object *parent, const char *title, const char *guide, Eina_Bool single_line, Eina_Bool is_editable)
477 assertm_if(NULL == parent, "parent is NULL!!");
479 Evas_Object *layout = elm_layout_add(parent);
480 assertm_if(NULL == layout, "layout is NULL!!");
482 if (title && title[0] != '\0') {
483 elm_layout_theme_set(layout, "layout", "editfield", "title");
484 elm_object_part_text_set(layout, "elm.text", title);
486 elm_layout_theme_set(layout, "layout", "editfield", "default");
489 Evas_Object *entry = elm_entry_add(parent);
490 assertm_if(NULL == entry, "entry is NULL!!");
492 elm_object_part_content_set(layout, "elm.swallow.content", entry);
493 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
495 if (guide && guide[0] != '\0') {
496 elm_object_part_text_set(layout, "elm.guidetext", guide);
499 elm_entry_single_line_set(entry, single_line);
500 elm_entry_scrollable_set(entry, single_line);
501 elm_entry_editable_set(entry, is_editable);
502 elm_object_signal_emit(layout, "elm,state,eraser,hide", "elm");
503 evas_object_show(layout);
509 * This function let the app create a display popup
510 * @return display popup
511 * @param[in] win the window object
512 * @param[in] pop the pointer to the prepared popup
514 Evas_Object *wfd_draw_pop_type_display(Evas_Object * win, wfd_popup_t * pop)
516 __WDPOP_LOG_FUNC_ENTER__;
518 Evas_Object *popup = NULL;
519 Evas_Object *label = NULL;
520 Evas_Object *progressbar = NULL;
521 Evas_Object *time = NULL;
522 static wfd_wps_display_popup_t wps_display_popup;
524 popup = elm_popup_add(win);
525 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, 0.0);
527 Evas_Object *box = elm_box_add(popup);
529 evas_object_del(popup);
534 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
535 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
536 elm_object_part_content_set(popup, NULL, box);
537 evas_object_show(box);
540 label = elm_label_add(box);
541 elm_object_style_set(label, "popup/default");
542 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
543 elm_object_text_set(label, pop->text);
544 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
545 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, 0.0);
546 elm_box_pack_end(box, label);
547 evas_object_show(label);
549 /* add progressbar */
550 progressbar = elm_progressbar_add(box);
551 elm_object_style_set(progressbar, "list_progress");
552 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
553 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.0);
554 evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, 0.0);
555 elm_progressbar_value_set(progressbar, 0.0);
556 elm_box_pack_end(box, progressbar);
557 evas_object_show(progressbar);
560 time = elm_label_add(box);
561 elm_object_style_set(time, "popup/default");
562 elm_object_text_set(time, "00:00");
563 evas_object_size_hint_weight_set(time, EVAS_HINT_EXPAND, 0.0);
564 evas_object_size_hint_align_set(time, EVAS_HINT_FILL, 0.0);
565 elm_box_pack_end(box, time);
566 evas_object_show(time);
568 /* start progressbar timer */
569 wps_display_popup.step = 0;
570 wps_display_popup.progressbar = progressbar;
571 wps_display_popup.time = time;
573 ecore_timer_del(pb_timer);
574 pb_timer = ecore_timer_add(1, _fn_pb_timer, &wps_display_popup);
577 if (pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES ||
578 pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_NO) {
579 Evas_Object *btn1 = NULL;
580 btn1 = elm_button_add(popup);
581 elm_object_style_set(btn1, "popup_button/default");
582 elm_object_text_set(btn1, pop->label1);
583 elm_object_part_content_set(popup, "button1", btn1);
584 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
585 (void *) pop->resp_data1);
588 if (pop->resp_data2 == WFD_POP_RESP_APRV_CONNECT_NO) {
589 Evas_Object *btn2 = NULL;
590 btn2 = elm_button_add(popup);
591 elm_object_style_set(btn2, "popup_button/default");
592 elm_object_text_set(btn2, pop->label2);
593 elm_object_part_content_set(popup, "button2", btn2);
594 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
595 (void *) pop->resp_data2);
598 elm_object_content_set(popup, box);
599 evas_object_show(popup);
600 evas_object_show(win);
602 __WDPOP_LOG_FUNC_EXIT__;
607 * This function let the app create a keypad popup
608 * @return keypad popup
609 * @param[in] win the window object
610 * @param[in] pop the pointer to the prepared popup
612 Evas_Object *wfd_draw_pop_type_keypad(Evas_Object * win, wfd_popup_t * pop)
614 __WDPOP_LOG_FUNC_ENTER__;
615 wfd_appdata_t *ad = wfd_get_appdata();
617 Evas_Object *conformant = NULL;
618 Evas_Object *layout = NULL;
619 Evas_Object *pinpopup = NULL;
620 Evas_Object *label = NULL;
621 Evas_Object *btn1 = NULL, *btn2 = NULL;
623 conformant = elm_conformant_add(win);
624 assertm_if(NULL == conformant, "conformant is NULL!!");
625 elm_win_conformant_set(win, EINA_TRUE);
626 elm_win_resize_object_add(win, conformant);
627 evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, 0.0);
628 evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, 0.0);
629 evas_object_show(conformant);
631 layout = elm_layout_add(conformant);
632 elm_object_content_set(conformant, layout);
634 pinpopup = elm_popup_add(layout);
635 assertm_if(NULL == pinpopup, "pinpopup is NULL!!");
636 evas_object_size_hint_weight_set(pinpopup, EVAS_HINT_EXPAND, 0.0);
637 elm_object_part_text_set(pinpopup, "title,text", _("IDS_WFD_POP_TITILE_CONNECTION"));
639 Evas_Object *box = elm_box_add(pinpopup);
641 evas_object_del(pinpopup);
646 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
647 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
648 elm_object_part_content_set(pinpopup, NULL, box);
649 evas_object_show(box);
652 label = elm_label_add(box);
653 elm_object_style_set(label, "popup/default");
654 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
655 elm_object_text_set(label, pop->text);
656 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
657 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
658 elm_box_pack_end(box, label);
659 evas_object_show(label);
662 Evas_Object *body = elm_layout_add(box);
664 evas_object_del(pinpopup);
669 elm_layout_theme_set(body, "layout", "dialogue", "1icon");
670 evas_object_size_hint_weight_set(body, EVAS_HINT_EXPAND, 0.0);
671 evas_object_size_hint_align_set(body, EVAS_HINT_FILL, 0.0);
673 Evas_Object *editfield_pin = _add_edit_field(body, NULL, NULL, EINA_TRUE, EINA_TRUE);
674 Evas_Object *entry_pin = elm_object_part_content_get(editfield_pin, "elm.swallow.content");
675 ad->pin_entry = entry_pin;
676 evas_object_smart_callback_add(ad->pin_entry, "changed", _smart_ime_cb, NULL);
677 elm_object_part_content_set(body, "elm.icon", editfield_pin);
678 elm_box_pack_end(box, body);
679 evas_object_show(body);
681 elm_entry_password_set(ad->pin_entry, TRUE);
683 Evas_Object *check = elm_check_add(box);
684 elm_object_text_set(check, _("Show password"));
685 elm_object_focus_allow_set(check, EINA_FALSE);
686 evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.0);
687 evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.0);
688 evas_object_smart_callback_add(check, "changed", _check_changed_cb, NULL);
689 evas_object_show(check);
690 elm_box_pack_end(box, check);
693 btn1 = elm_button_add(pinpopup);
694 elm_object_style_set(btn1, "popup_button/default");
695 elm_object_text_set(btn1, pop->label1);
696 elm_object_part_content_set(pinpopup, "button1", btn1);
697 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb, (void *)pop->resp_data1);
699 btn2 = elm_button_add(pinpopup);
700 elm_object_style_set(btn2, "popup_button/default");
701 elm_object_text_set(btn2, pop->label2);
702 elm_object_part_content_set(pinpopup, "button2", btn2);
703 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb, (void *)pop->resp_data2);
705 elm_object_content_set(pinpopup, box);
706 evas_object_show(pinpopup);
707 evas_object_show(win);
708 elm_object_focus_set(ad->pin_entry, EINA_TRUE);
710 __WDPOP_LOG_FUNC_EXIT__;
715 * This function let the app create a popup
717 * @param[in] type the type of popup
718 * @param[in] userdata the pointer to the data which will be used
720 void wfd_prepare_popup(int type, void *userdata)
722 __WDPOP_LOG_FUNC_ENTER__;
723 wfd_appdata_t *ad = wfd_get_appdata();
724 wfd_popup_t *pop = ad->popup_data;
728 memset(pop, 0, sizeof(wfd_popup_t));
733 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ:
734 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECT_Q,
736 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_YES"));
737 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_SK_NO"));
738 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_PBC_YES;
739 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
741 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
744 case WFD_POP_APRV_CONNECTION_INVITATION_REQ:
745 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECT_Q,
747 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_YES"));
748 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_SK_NO"));
749 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_INVITATION_YES;
750 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
752 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
755 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ:
756 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_ENTER_PIN_WITH_KEYPAD,
758 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
759 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
760 pop->timeout = WFD_POP_TIMER_120;
761 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK;
762 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
764 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
767 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ:
768 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_ENTER_PIN,
769 ad->peer_name, WFD_POP_TIMER_120);
770 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
771 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
772 pop->timeout = WFD_POP_TIMER_120;
773 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES;
774 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
776 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
779 case /* MT */ WFD_POP_PROG_CONNECT:
780 snprintf(pop->text, sizeof(pop->text), "%s", _("IDS_WFD_POP_CONNECTING"));
781 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
782 pop->timeout = WFD_POP_TIMER_120;
783 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
785 ad->popup = wfd_draw_pop_type_b(ad->win, pop);
788 case /* MO */ WFD_POP_PROG_CONNECT_WITH_KEYPAD:
789 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECTING_WITH_KEYPAD,
790 ad->peer_name, WFD_POP_TIMER_120, ad->peer_name);
791 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
792 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
793 pop->timeout = WFD_POP_TIMER_120;
794 pop->resp_data1 = WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK;
795 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
797 ad->popup = wfd_draw_pop_type_keypad(ad->win, pop);
800 case /* MO/MT */ WFD_POP_PROG_CONNECT_WITH_PIN:
801 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECTING_WITH_PIN,
802 ad->peer_name, WFD_POP_TIMER_120, ad->pin_number);
803 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
804 pop->timeout = WFD_POP_TIMER_120;
805 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
807 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
810 case WFD_POP_PROG_CONNECT_CANCEL:
811 snprintf(pop->text, sizeof(pop->text), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
812 pop->timeout = WFD_POP_TIMER_120;
813 ad->popup = wfd_draw_pop_type_a(ad->win, pop);
820 __WDPOP_LOG_FUNC_EXIT__;
825 * This function let the app create a tickernoti syspopup
827 * @param[in] msg the pointer to message of tickernoti
829 void wfd_tickernoti_popup(char *msg)
831 __WDPOP_LOG_FUNC_ENTER__;
838 WDPOP_LOGD( "FAIL: bundle_create()\n");
842 /* tickernoti style */
843 ret = bundle_add(b, "0", "info");
845 WDPOP_LOGD( "Fail to add tickernoti style\n");
851 ret = bundle_add(b, "1", msg);
853 WDPOP_LOGD( "Fail to add popup text\n");
858 /* orientation of tickernoti */
859 ret = bundle_add(b, "2", "0");
861 WDPOP_LOGD( "Fail to add orientation of tickernoti\n");
866 /* timeout(second) of tickernoti */
867 ret = bundle_add(b, "3", "3");
869 WDPOP_LOGD( "Fail to add timeout of tickernoti\n");
874 /* launch tickernoti */
875 ret = syspopup_launch(TICKERNOTI_SYSPOPUP, b);
877 WDPOP_LOGD( "Fail to launch syspopup\n");
881 __WDPOP_LOG_FUNC_EXIT__;