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);
132 if (len > 7 && len < 64) {
134 WDPOP_LOGD( "pin=[%s]\n", ad->pin_number);
136 result = wifi_direct_set_wps_pin(ad->pin_number);
137 if (result != WIFI_DIRECT_ERROR_NONE) {
138 /* tickernoti popup */
139 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
140 wfd_tickernoti_popup(msg);
144 //result = wifi_direct_activate_pushbutton();
145 result = wifi_direct_accept_connection(ad->peer_mac);
147 "wifi_direct_accept_connection(%s) result=[%d]\n",
148 ad->peer_mac, result);
149 if (result != WIFI_DIRECT_ERROR_NONE) {
151 "wifi_direct_accept_connection() FAILED!!\n");
152 evas_object_hide(ad->win);
154 /* tickernoti popup */
155 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
156 wfd_tickernoti_popup(msg);
159 WDPOP_LOGE( "Error, Incorrect PIN!!\n");
161 /* tickernoti popup */
162 wfd_tickernoti_popup(_("IDS_WFD_POP_PIN_INVALID"));
164 /* redraw the popup */
165 if (WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK == resp) {
166 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
168 wfd_prepare_popup(WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ, (void *) NULL);
176 case /* MT */ WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES:
179 "WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES\n");
182 ecore_timer_del(pb_timer);
186 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
190 case /* MT */ WFD_POP_RESP_APRV_CONNECT_NO:
193 "WFD_POP_RESP_APRV_CONNECT_NO: destroy_popup...\n");
197 ecore_timer_del(pb_timer);
201 result = wifi_direct_disconnect(ad->peer_mac);
203 "wifi_direct_disconnect[%s] result=[%d]\n",
204 ad->peer_mac, result);
210 WDPOP_LOGE( "Unknown respone\n");
211 evas_object_hide(ad->win);
216 __WDPOP_LOG_FUNC_EXIT__;
220 * This function let the app destroy the popup
224 void wfd_destroy_popup()
226 __WDPOP_LOG_FUNC_ENTER__;
227 wfd_appdata_t *ad = wfd_get_appdata();
230 WDPOP_LOGE( "ad is NULL\n");
235 evas_object_del(ad->popup);
239 if (ad->popup_timeout_handle > 0) {
240 g_source_remove(ad->popup_timeout_handle);
241 ad->popup_timeout_handle = 0;
244 evas_object_hide(ad->win);
246 __WDPOP_LOG_FUNC_EXIT__;
251 * This function let the app create a popup which includes no button
253 * @param[in] win the window object
254 * @param[in] pop the pointer to the prepared popup
256 static Evas_Object *wfd_draw_pop_type_a(Evas_Object * win, wfd_popup_t * pop)
258 __WDPOP_LOG_FUNC_ENTER__;
261 popup = elm_popup_add(win);
262 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
263 elm_object_text_set(popup, pop->text);
264 elm_popup_timeout_set(popup, pop->timeout);
265 evas_object_show(popup);
266 evas_object_show(win);
268 __WDPOP_LOG_FUNC_EXIT__;
273 * This function let the app create a popup which includes one button
275 * @param[in] win the window object
276 * @param[in] pop the pointer to the prepared popup
278 static Evas_Object *wfd_draw_pop_type_b(Evas_Object * win, wfd_popup_t * pop)
280 __WDPOP_LOG_FUNC_ENTER__;
281 Evas_Object *popup = NULL;
282 Evas_Object *btn = NULL;
284 popup = elm_popup_add(win);
285 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
286 elm_object_text_set(popup, pop->text);
288 btn = elm_button_add(popup);
289 elm_object_style_set(btn, "popup_button/default");
290 elm_object_text_set(btn, pop->label1);
291 elm_object_part_content_set(popup, "button1", btn);
292 evas_object_smart_callback_add(btn, "clicked", __popup_resp_cb, (void *) pop->resp_data1);
294 evas_object_show(popup);
295 evas_object_show(win);
297 __WDPOP_LOG_FUNC_EXIT__;
302 * This function let the app create a popup which includes two buttons
304 * @param[in] win the window object
305 * @param[in] pop the pointer to the prepared popup
307 static Evas_Object *wfd_draw_pop_type_c(Evas_Object * win, wfd_popup_t * pop)
309 __WDPOP_LOG_FUNC_ENTER__;
310 Evas_Object *popup = NULL;
311 Evas_Object *btn1 = NULL, *btn2 = NULL;
313 popup = elm_popup_add(win);
314 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
315 elm_object_text_set(popup, pop->text);
317 btn1 = elm_button_add(popup);
318 elm_object_style_set(btn1, "popup_button/default");
319 elm_object_text_set(btn1, pop->label1);
320 elm_object_part_content_set(popup, "button1", btn1);
321 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
322 (void *) pop->resp_data1);
324 btn2 = elm_button_add(popup);
325 elm_object_style_set(btn2, "popup_button/default");
326 elm_object_text_set(btn2, pop->label2);
327 elm_object_part_content_set(popup, "button2", btn2);
328 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
329 (void *) pop->resp_data2);
331 evas_object_show(popup);
332 evas_object_show(win);
334 __WDPOP_LOG_FUNC_EXIT__;
339 * This function let the ug make a change callback for password input
341 * @param[in] data the pointer to the main data structure
342 * @param[in] obj the pointer to the evas object
343 * @param[in] event_info the pointer to the event information
345 static void _smart_ime_cb(void *data, Evas_Object * obj, void *event_info)
347 __WDPOP_LOG_FUNC_ENTER__;
348 wfd_appdata_t *ad = wfd_get_appdata();
350 Ecore_IMF_Context *imf_context = NULL;
351 imf_context = (Ecore_IMF_Context *) ad->pin_entry;
353 if (NULL == imf_context) {
354 WDPOP_LOGE( "Error!!! Ecore_IMF_Context is NULL!!");
358 const char *txt = elm_entry_markup_to_utf8(elm_entry_entry_get((const Evas_Object *) imf_context));
360 WDPOP_LOGD( "* text [%s], len=[%d]", txt, strlen(txt));
361 strncpy(ad->pin_number, txt, sizeof(ad->pin_number));
366 __WDPOP_LOG_FUNC_EXIT__;
370 * This function let the app make a change callback for password checkbox
372 * @param[in] data the pointer to the main data structure
373 * @param[in] obj the pointer to the evas object
374 * @param[in] event_info the pointer to the event information
376 static void _check_changed_cb(void *data, Evas_Object * obj, void *event_info)
378 wfd_appdata_t *ad = wfd_get_appdata();
384 Eina_Bool state = elm_check_state_get(obj);
385 elm_entry_password_set(ad->pin_entry, !state);
389 * This function let the app make a callback for progressbar timer
390 * @return if stop the timer, return ECORE_CALLBACK_CANCEL, else return ECORE_CALLBACK_RENEW
391 * @param[in] data the pointer to the wps structure
393 static Eina_Bool _fn_pb_timer(void *data)
397 char time_label[32] = {0};
398 wfd_wps_display_popup_t *wps_display_popup = (wfd_wps_display_popup_t *) data;
400 if (NULL == wps_display_popup) {
401 WDPOP_LOGE( "Param is NULL.\n");
402 return ECORE_CALLBACK_CANCEL;
405 Evas_Object *progressbar = NULL;
406 Evas_Object *time = NULL;
408 progressbar = wps_display_popup->progressbar;
409 time = wps_display_popup->time;
410 value = elm_progressbar_value_get(progressbar);
413 WDPOP_LOGE( "Progress end.\n");
415 ecore_timer_del(pb_timer);
419 return ECORE_CALLBACK_CANCEL;
422 wps_display_popup->step++;
423 step = wps_display_popup->step;
424 value = ((double)step) / WFD_POP_TIMER_120;
425 elm_progressbar_value_set(progressbar, value);
426 WDPOP_LOGD( "step: %d, value: %f\n", wps_display_popup->step, value);
428 /* show the time label */
431 snprintf(time_label, 32, "00:0%d", step);
433 snprintf(time_label, 32, "00:%d", step);
437 snprintf(time_label, 32, "0%d:0%d", step/60, step%60);
439 snprintf(time_label, 32, "0%d:%d", step/60, step%60);
443 elm_object_text_set(time, time_label);
445 return ECORE_CALLBACK_RENEW;
449 * This function let the app create a edit filed
451 * @param[in] parent the parent object
452 * @param[in] title the pointer to the title of edit field
453 * @param[in] guide the pointer to the text of guide
454 * @param[in] single_line whether it can support single line
455 * @param[in] is_editable whether it is avaliable to edit
457 static Evas_Object *_add_edit_field(Evas_Object *parent, const char *title, const char *guide, Eina_Bool single_line, Eina_Bool is_editable)
459 assertm_if(NULL == parent, "parent is NULL!!");
461 Evas_Object *layout = elm_layout_add(parent);
462 assertm_if(NULL == layout, "layout is NULL!!");
464 if (title && title[0] != '\0') {
465 elm_layout_theme_set(layout, "layout", "editfield", "title");
466 elm_object_part_text_set(layout, "elm.text", title);
468 elm_layout_theme_set(layout, "layout", "editfield", "default");
471 Evas_Object *entry = elm_entry_add(parent);
472 assertm_if(NULL == entry, "entry is NULL!!");
474 elm_object_part_content_set(layout, "elm.swallow.content", entry);
475 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
477 if (guide && guide[0] != '\0') {
478 elm_object_part_text_set(layout, "elm.guidetext", guide);
481 elm_entry_single_line_set(entry, single_line);
482 elm_entry_scrollable_set(entry, single_line);
483 elm_entry_editable_set(entry, is_editable);
484 elm_object_signal_emit(layout, "elm,state,eraser,hide", "elm");
485 evas_object_show(layout);
491 * This function let the app create a display popup
492 * @return display popup
493 * @param[in] win the window object
494 * @param[in] pop the pointer to the prepared popup
496 Evas_Object *wfd_draw_pop_type_display(Evas_Object * win, wfd_popup_t * pop)
498 __WDPOP_LOG_FUNC_ENTER__;
500 Evas_Object *popup = NULL;
501 Evas_Object *label = NULL;
502 Evas_Object *progressbar = NULL;
503 Evas_Object *time = NULL;
504 static wfd_wps_display_popup_t wps_display_popup;
506 popup = elm_popup_add(win);
507 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, 0.0);
509 Evas_Object *box = elm_box_add(popup);
511 evas_object_del(popup);
516 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
517 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
518 elm_object_part_content_set(popup, NULL, box);
519 evas_object_show(box);
522 label = elm_label_add(box);
523 elm_object_style_set(label, "popup/default");
524 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
525 elm_object_text_set(label, pop->text);
526 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
527 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, 0.0);
528 elm_box_pack_end(box, label);
529 evas_object_show(label);
531 /* add progressbar */
532 progressbar = elm_progressbar_add(box);
533 elm_object_style_set(progressbar, "list_progress");
534 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
535 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.0);
536 evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, 0.0);
537 elm_progressbar_value_set(progressbar, 0.0);
538 elm_box_pack_end(box, progressbar);
539 evas_object_show(progressbar);
542 time = elm_label_add(box);
543 elm_object_style_set(time, "popup/default");
544 elm_object_text_set(time, "00:00");
545 evas_object_size_hint_weight_set(time, EVAS_HINT_EXPAND, 0.0);
546 evas_object_size_hint_align_set(time, EVAS_HINT_FILL, 0.0);
547 elm_box_pack_end(box, time);
548 evas_object_show(time);
550 /* start progressbar timer */
551 wps_display_popup.step = 0;
552 wps_display_popup.progressbar = progressbar;
553 wps_display_popup.time = time;
554 pb_timer = ecore_timer_add(1, _fn_pb_timer, &wps_display_popup);
557 if (pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES ||
558 pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_NO) {
559 Evas_Object *btn1 = NULL;
560 btn1 = elm_button_add(popup);
561 elm_object_style_set(btn1, "popup_button/default");
562 elm_object_text_set(btn1, pop->label1);
563 elm_object_part_content_set(popup, "button1", btn1);
564 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
565 (void *) pop->resp_data1);
568 if (pop->resp_data2 == WFD_POP_RESP_APRV_CONNECT_NO) {
569 Evas_Object *btn2 = NULL;
570 btn2 = elm_button_add(popup);
571 elm_object_style_set(btn2, "popup_button/default");
572 elm_object_text_set(btn2, pop->label2);
573 elm_object_part_content_set(popup, "button2", btn2);
574 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
575 (void *) pop->resp_data2);
578 elm_object_content_set(popup, box);
579 evas_object_show(popup);
580 evas_object_show(win);
582 __WDPOP_LOG_FUNC_EXIT__;
587 * This function let the app create a keypad popup
588 * @return keypad popup
589 * @param[in] win the window object
590 * @param[in] pop the pointer to the prepared popup
592 Evas_Object *wfd_draw_pop_type_keypad(Evas_Object * win, wfd_popup_t * pop)
594 __WDPOP_LOG_FUNC_ENTER__;
595 wfd_appdata_t *ad = wfd_get_appdata();
597 Evas_Object *conformant = NULL;
598 Evas_Object *layout = NULL;
599 Evas_Object *pinpopup = NULL;
600 Evas_Object *label = NULL;
601 Evas_Object *btn1 = NULL, *btn2 = NULL;
603 conformant = elm_conformant_add(win);
604 assertm_if(NULL == conformant, "conformant is NULL!!");
605 elm_win_conformant_set(win, EINA_TRUE);
606 elm_win_resize_object_add(win, conformant);
607 evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, 0.0);
608 evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, 0.0);
609 evas_object_show(conformant);
611 layout = elm_layout_add(conformant);
612 elm_object_content_set(conformant, layout);
614 pinpopup = elm_popup_add(layout);
615 assertm_if(NULL == pinpopup, "pinpopup is NULL!!");
616 evas_object_size_hint_weight_set(pinpopup, EVAS_HINT_EXPAND, 0.0);
617 elm_object_part_text_set(pinpopup, "title,text", _("IDS_WFD_POP_TITILE_CONNECTION"));
619 Evas_Object *box = elm_box_add(pinpopup);
621 evas_object_del(pinpopup);
626 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
627 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
628 elm_object_part_content_set(pinpopup, NULL, box);
629 evas_object_show(box);
632 label = elm_label_add(box);
633 elm_object_style_set(label, "popup/default");
634 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
635 elm_object_text_set(label, pop->text);
636 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
637 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
638 elm_box_pack_end(box, label);
639 evas_object_show(label);
642 Evas_Object *body = elm_layout_add(box);
644 evas_object_del(pinpopup);
649 elm_layout_theme_set(body, "layout", "dialogue", "1icon");
650 evas_object_size_hint_weight_set(body, EVAS_HINT_EXPAND, 0.0);
651 evas_object_size_hint_align_set(body, EVAS_HINT_FILL, 0.0);
653 Evas_Object *editfield_pin = _add_edit_field(body, NULL, NULL, EINA_TRUE, EINA_TRUE);
654 Evas_Object *entry_pin = elm_object_part_content_get(editfield_pin, "elm.swallow.content");
655 ad->pin_entry = entry_pin;
656 evas_object_smart_callback_add(ad->pin_entry, "changed", _smart_ime_cb, NULL);
657 elm_object_part_content_set(body, "elm.icon", editfield_pin);
658 elm_box_pack_end(box, body);
659 evas_object_show(body);
661 elm_entry_password_set(ad->pin_entry, TRUE);
663 Evas_Object *check = elm_check_add(box);
664 elm_object_text_set(check, _("Show password"));
665 elm_object_focus_allow_set(check, EINA_FALSE);
666 evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.0);
667 evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.0);
668 evas_object_smart_callback_add(check, "changed", _check_changed_cb, NULL);
669 evas_object_show(check);
670 elm_box_pack_end(box, check);
673 btn1 = elm_button_add(pinpopup);
674 elm_object_style_set(btn1, "popup_button/default");
675 elm_object_text_set(btn1, pop->label1);
676 elm_object_part_content_set(pinpopup, "button1", btn1);
677 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb, (void *)pop->resp_data1);
679 btn2 = elm_button_add(pinpopup);
680 elm_object_style_set(btn2, "popup_button/default");
681 elm_object_text_set(btn2, pop->label2);
682 elm_object_part_content_set(pinpopup, "button2", btn2);
683 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb, (void *)pop->resp_data2);
685 elm_object_content_set(pinpopup, box);
686 evas_object_show(pinpopup);
687 evas_object_show(win);
688 elm_object_focus_set(ad->pin_entry, EINA_TRUE);
690 __WDPOP_LOG_FUNC_EXIT__;
695 * This function let the app create a popup
697 * @param[in] type the type of popup
698 * @param[in] userdata the pointer to the data which will be used
700 void wfd_prepare_popup(int type, void *userdata)
702 __WDPOP_LOG_FUNC_ENTER__;
703 wfd_appdata_t *ad = wfd_get_appdata();
704 wfd_popup_t *pop = ad->popup_data;
708 memset(pop, 0, sizeof(wfd_popup_t));
713 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ:
714 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECT_Q,
716 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_YES"));
717 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_SK_NO"));
718 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_PBC_YES;
719 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
721 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
724 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ:
725 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_ENTER_PIN_WITH_KEYPAD,
727 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
728 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
729 pop->timeout = WFD_POP_TIMER_120;
730 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK;
731 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
733 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
736 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ:
737 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_ENTER_PIN,
738 ad->peer_name, WFD_POP_TIMER_120);
739 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
740 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
741 pop->timeout = WFD_POP_TIMER_120;
742 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES;
743 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
745 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
748 case /* MT */ WFD_POP_PROG_CONNECT:
749 snprintf(pop->text, sizeof(pop->text), "%s", _("IDS_WFD_POP_CONNECTING"));
750 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
751 pop->timeout = WFD_POP_TIMER_120;
752 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
754 ad->popup = wfd_draw_pop_type_b(ad->win, pop);
757 case /* MO */ WFD_POP_PROG_CONNECT_WITH_KEYPAD:
758 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECTING_WITH_KEYPAD,
759 ad->peer_name, WFD_POP_TIMER_120, ad->peer_name);
760 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
761 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
762 pop->timeout = WFD_POP_TIMER_120;
763 pop->resp_data1 = WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK;
764 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
766 ad->popup = wfd_draw_pop_type_keypad(ad->win, pop);
769 case /* MO/MT */ WFD_POP_PROG_CONNECT_WITH_PIN:
770 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECTING_WITH_PIN,
771 ad->peer_name, WFD_POP_TIMER_120, ad->pin_number);
772 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
773 pop->timeout = WFD_POP_TIMER_120;
774 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
776 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
779 case WFD_POP_PROG_CONNECT_CANCEL:
780 snprintf(pop->text, sizeof(pop->text), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
781 pop->timeout = WFD_POP_TIMER_120;
782 ad->popup = wfd_draw_pop_type_a(ad->win, pop);
789 __WDPOP_LOG_FUNC_EXIT__;
794 * This function let the app create a tickernoti syspopup
796 * @param[in] msg the pointer to message of tickernoti
798 void wfd_tickernoti_popup(char *msg)
800 __WDPOP_LOG_FUNC_ENTER__;
807 WDPOP_LOGD( "FAIL: bundle_create()\n");
811 /* tickernoti style */
812 ret = bundle_add(b, "0", "info");
814 WDPOP_LOGD( "Fail to add tickernoti style\n");
820 ret = bundle_add(b, "1", msg);
822 WDPOP_LOGD( "Fail to add popup text\n");
827 /* orientation of tickernoti */
828 ret = bundle_add(b, "2", "0");
830 WDPOP_LOGD( "Fail to add orientation of tickernoti\n");
835 /* timeout(second) of tickernoti */
836 ret = bundle_add(b, "3", "3");
838 WDPOP_LOGD( "Fail to add timeout of tickernoti\n");
843 /* launch tickernoti */
844 ret = syspopup_launch(TICKERNOTI_SYSPOPUP, b);
846 WDPOP_LOGD( "Fail to launch syspopup\n");
850 __WDPOP_LOG_FUNC_EXIT__;