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 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
142 wfd_tickernoti_popup(msg);
147 case /* MO */ WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK:
150 "WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK\n");
154 int len = strlen(ad->pin_number);
155 WDPOP_LOGD( "button ok: pin [%s]", ad->pin_number);
159 wfd_tickernoti_popup(_("IDS_CST_BODY_PASSWORD_TOO_LONG"));
161 wfd_tickernoti_popup(_("IDS_ST_BODY_PASSWORD_TOO_SHORT"));
162 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
167 WDPOP_LOGD( "pin=[%s]\n", ad->pin_number);
169 result = wifi_direct_set_wps_pin(ad->pin_number);
170 if (result != WIFI_DIRECT_ERROR_NONE) {
171 /* tickernoti popup */
172 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
173 wfd_tickernoti_popup(msg);
177 //result = wifi_direct_activate_pushbutton();
178 result = wifi_direct_accept_connection(ad->peer_mac);
180 "wifi_direct_accept_connection(%s) result=[%d]\n",
181 ad->peer_mac, result);
182 if (result != WIFI_DIRECT_ERROR_NONE) {
184 "wifi_direct_accept_connection() FAILED!!\n");
185 evas_object_hide(ad->win);
187 /* tickernoti popup */
188 snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
189 wfd_tickernoti_popup(msg);
194 case /* MT */ WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES:
197 "WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES\n");
200 ecore_timer_del(pb_timer);
204 wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
208 case /* MT */ WFD_POP_RESP_APRV_CONNECT_NO:
211 "WFD_POP_RESP_APRV_CONNECT_NO: destroy_popup...\n");
215 ecore_timer_del(pb_timer);
219 result = wifi_direct_disconnect(ad->peer_mac);
221 "wifi_direct_disconnect[%s] result=[%d]\n",
222 ad->peer_mac, result);
228 WDPOP_LOGE( "Unknown respone\n");
229 evas_object_hide(ad->win);
234 __WDPOP_LOG_FUNC_EXIT__;
238 * This function let the app destroy the popup
242 void wfd_destroy_popup()
244 __WDPOP_LOG_FUNC_ENTER__;
245 wfd_appdata_t *ad = wfd_get_appdata();
248 WDPOP_LOGE( "ad is NULL\n");
253 evas_object_del(ad->popup);
257 if (ad->popup_timeout_handle > 0) {
258 g_source_remove(ad->popup_timeout_handle);
259 ad->popup_timeout_handle = 0;
262 evas_object_hide(ad->win);
264 __WDPOP_LOG_FUNC_EXIT__;
269 * This function let the app create a popup which includes no button
271 * @param[in] win the window object
272 * @param[in] pop the pointer to the prepared popup
274 static Evas_Object *wfd_draw_pop_type_a(Evas_Object * win, wfd_popup_t * pop)
276 __WDPOP_LOG_FUNC_ENTER__;
279 popup = elm_popup_add(win);
280 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
281 elm_object_text_set(popup, pop->text);
282 elm_popup_timeout_set(popup, pop->timeout);
283 evas_object_show(popup);
284 evas_object_show(win);
286 __WDPOP_LOG_FUNC_EXIT__;
291 * This function let the app create a popup which includes one button
293 * @param[in] win the window object
294 * @param[in] pop the pointer to the prepared popup
296 static Evas_Object *wfd_draw_pop_type_b(Evas_Object * win, wfd_popup_t * pop)
298 __WDPOP_LOG_FUNC_ENTER__;
299 Evas_Object *popup = NULL;
300 Evas_Object *btn = NULL;
302 popup = elm_popup_add(win);
303 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
304 elm_object_text_set(popup, pop->text);
306 btn = elm_button_add(popup);
307 elm_object_style_set(btn, "popup_button/default");
308 elm_object_text_set(btn, pop->label1);
309 elm_object_part_content_set(popup, "button1", btn);
310 evas_object_smart_callback_add(btn, "clicked", __popup_resp_cb, (void *) pop->resp_data1);
312 evas_object_show(popup);
313 evas_object_show(win);
315 __WDPOP_LOG_FUNC_EXIT__;
320 * This function let the app create a popup which includes two buttons
322 * @param[in] win the window object
323 * @param[in] pop the pointer to the prepared popup
325 static Evas_Object *wfd_draw_pop_type_c(Evas_Object * win, wfd_popup_t * pop)
327 __WDPOP_LOG_FUNC_ENTER__;
328 Evas_Object *popup = NULL;
329 Evas_Object *btn1 = NULL, *btn2 = NULL;
331 popup = elm_popup_add(win);
332 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
333 elm_object_text_set(popup, pop->text);
335 btn1 = elm_button_add(popup);
336 elm_object_style_set(btn1, "popup_button/default");
337 elm_object_text_set(btn1, pop->label1);
338 elm_object_part_content_set(popup, "button1", btn1);
339 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
340 (void *) pop->resp_data1);
342 btn2 = elm_button_add(popup);
343 elm_object_style_set(btn2, "popup_button/default");
344 elm_object_text_set(btn2, pop->label2);
345 elm_object_part_content_set(popup, "button2", btn2);
346 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
347 (void *) pop->resp_data2);
349 evas_object_show(popup);
350 evas_object_show(win);
352 __WDPOP_LOG_FUNC_EXIT__;
357 * This function let the ug make a change callback for password input
359 * @param[in] data the pointer to the main data structure
360 * @param[in] obj the pointer to the evas object
361 * @param[in] event_info the pointer to the event information
363 static void _smart_ime_cb(void *data, Evas_Object * obj, void *event_info)
365 __WDPOP_LOG_FUNC_ENTER__;
366 wfd_appdata_t *ad = wfd_get_appdata();
368 Ecore_IMF_Context *imf_context = NULL;
369 imf_context = (Ecore_IMF_Context *) ad->pin_entry;
371 if (NULL == imf_context) {
372 WDPOP_LOGE( "Error!!! Ecore_IMF_Context is NULL!!");
376 const char *txt = elm_entry_markup_to_utf8(elm_entry_entry_get((const Evas_Object *) imf_context));
378 WDPOP_LOGD( "* text [%s], len=[%d]", txt, strlen(txt));
379 strncpy(ad->pin_number, txt, sizeof(ad->pin_number));
384 __WDPOP_LOG_FUNC_EXIT__;
388 * This function let the app make a change callback for password checkbox
390 * @param[in] data the pointer to the main data structure
391 * @param[in] obj the pointer to the evas object
392 * @param[in] event_info the pointer to the event information
394 static void _check_changed_cb(void *data, Evas_Object * obj, void *event_info)
396 wfd_appdata_t *ad = wfd_get_appdata();
402 Eina_Bool state = elm_check_state_get(obj);
403 elm_entry_password_set(ad->pin_entry, !state);
404 elm_entry_autocapital_type_set(ad->pin_entry, ELM_AUTOCAPITAL_TYPE_NONE);
408 * This function let the app make a callback for progressbar timer
409 * @return if stop the timer, return ECORE_CALLBACK_CANCEL, else return ECORE_CALLBACK_RENEW
410 * @param[in] data the pointer to the wps structure
412 static Eina_Bool _fn_pb_timer(void *data)
416 char time_label[32] = {0};
417 wfd_wps_display_popup_t *wps_display_popup = (wfd_wps_display_popup_t *) data;
419 if (NULL == wps_display_popup) {
420 WDPOP_LOGE( "Param is NULL.\n");
421 return ECORE_CALLBACK_CANCEL;
424 Evas_Object *progressbar = NULL;
425 Evas_Object *time = NULL;
427 progressbar = wps_display_popup->progressbar;
428 time = wps_display_popup->time;
429 value = elm_progressbar_value_get(progressbar);
432 WDPOP_LOGE( "Progress end.\n");
434 ecore_timer_del(pb_timer);
438 return ECORE_CALLBACK_CANCEL;
441 wps_display_popup->step++;
442 step = wps_display_popup->step;
443 value = ((double)step) / WFD_POP_TIMER_120;
444 elm_progressbar_value_set(progressbar, value);
445 WDPOP_LOGD( "step: %d, value: %f\n", wps_display_popup->step, value);
447 /* show the time label */
450 snprintf(time_label, 32, "00:0%d", step);
452 snprintf(time_label, 32, "00:%d", step);
456 snprintf(time_label, 32, "0%d:0%d", step/60, step%60);
458 snprintf(time_label, 32, "0%d:%d", step/60, step%60);
462 elm_object_text_set(time, time_label);
464 return ECORE_CALLBACK_RENEW;
468 * This function let the app create a edit filed
470 * @param[in] parent the parent object
471 * @param[in] title the pointer to the title of edit field
472 * @param[in] guide the pointer to the text of guide
473 * @param[in] single_line whether it can support single line
474 * @param[in] is_editable whether it is avaliable to edit
476 static Evas_Object *_add_edit_field(Evas_Object *parent, const char *title, const char *guide, Eina_Bool single_line, Eina_Bool is_editable)
478 assertm_if(NULL == parent, "parent is NULL!!");
480 Evas_Object *layout = elm_layout_add(parent);
481 assertm_if(NULL == layout, "layout is NULL!!");
483 if (title && title[0] != '\0') {
484 elm_layout_theme_set(layout, "layout", "editfield", "title");
485 elm_object_part_text_set(layout, "elm.text", title);
487 elm_layout_theme_set(layout, "layout", "editfield", "default");
490 Evas_Object *entry = elm_entry_add(parent);
491 assertm_if(NULL == entry, "entry is NULL!!");
493 elm_object_part_content_set(layout, "elm.swallow.content", entry);
494 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
496 if (guide && guide[0] != '\0') {
497 elm_object_part_text_set(layout, "elm.guidetext", guide);
500 elm_entry_single_line_set(entry, single_line);
501 elm_entry_scrollable_set(entry, single_line);
502 elm_entry_editable_set(entry, is_editable);
503 elm_object_signal_emit(layout, "elm,state,eraser,hide", "elm");
504 evas_object_show(layout);
510 * This function let the app create a display popup
511 * @return display popup
512 * @param[in] win the window object
513 * @param[in] pop the pointer to the prepared popup
515 Evas_Object *wfd_draw_pop_type_display(Evas_Object * win, wfd_popup_t * pop)
517 __WDPOP_LOG_FUNC_ENTER__;
519 Evas_Object *popup = NULL;
520 Evas_Object *label = NULL;
521 Evas_Object *progressbar = NULL;
522 Evas_Object *time = NULL;
523 static wfd_wps_display_popup_t wps_display_popup;
525 popup = elm_popup_add(win);
526 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, 0.0);
528 Evas_Object *box = elm_box_add(popup);
530 evas_object_del(popup);
535 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
536 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
537 elm_object_part_content_set(popup, NULL, box);
538 evas_object_show(box);
541 label = elm_label_add(box);
542 elm_object_style_set(label, "popup/default");
543 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
544 elm_object_text_set(label, pop->text);
545 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
546 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, 0.0);
547 elm_box_pack_end(box, label);
548 evas_object_show(label);
550 /* add progressbar */
551 progressbar = elm_progressbar_add(box);
552 elm_object_style_set(progressbar, "list_progress");
553 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
554 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.0);
555 evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, 0.0);
556 elm_progressbar_value_set(progressbar, 0.0);
557 elm_box_pack_end(box, progressbar);
558 evas_object_show(progressbar);
561 time = elm_label_add(box);
562 elm_object_style_set(time, "popup/default");
563 elm_object_text_set(time, "00:00");
564 evas_object_size_hint_weight_set(time, EVAS_HINT_EXPAND, 0.0);
565 evas_object_size_hint_align_set(time, EVAS_HINT_FILL, 0.0);
566 elm_box_pack_end(box, time);
567 evas_object_show(time);
569 /* start progressbar timer */
570 wps_display_popup.step = 0;
571 wps_display_popup.progressbar = progressbar;
572 wps_display_popup.time = time;
574 ecore_timer_del(pb_timer);
575 pb_timer = ecore_timer_add(1, _fn_pb_timer, &wps_display_popup);
578 if (pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES ||
579 pop->resp_data1 == WFD_POP_RESP_APRV_CONNECT_NO) {
580 Evas_Object *btn1 = NULL;
581 btn1 = elm_button_add(popup);
582 elm_object_style_set(btn1, "popup_button/default");
583 elm_object_text_set(btn1, pop->label1);
584 elm_object_part_content_set(popup, "button1", btn1);
585 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
586 (void *) pop->resp_data1);
589 if (pop->resp_data2 == WFD_POP_RESP_APRV_CONNECT_NO) {
590 Evas_Object *btn2 = NULL;
591 btn2 = elm_button_add(popup);
592 elm_object_style_set(btn2, "popup_button/default");
593 elm_object_text_set(btn2, pop->label2);
594 elm_object_part_content_set(popup, "button2", btn2);
595 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
596 (void *) pop->resp_data2);
599 elm_object_content_set(popup, box);
600 evas_object_show(popup);
601 evas_object_show(win);
603 __WDPOP_LOG_FUNC_EXIT__;
608 * This function let the app create a keypad popup
609 * @return keypad popup
610 * @param[in] win the window object
611 * @param[in] pop the pointer to the prepared popup
613 Evas_Object *wfd_draw_pop_type_keypad(Evas_Object * win, wfd_popup_t * pop)
615 __WDPOP_LOG_FUNC_ENTER__;
616 wfd_appdata_t *ad = wfd_get_appdata();
618 Evas_Object *conformant = NULL;
619 Evas_Object *layout = NULL;
620 Evas_Object *pinpopup = NULL;
621 Evas_Object *label = NULL;
622 Evas_Object *btn1 = NULL, *btn2 = NULL;
624 conformant = elm_conformant_add(win);
625 assertm_if(NULL == conformant, "conformant is NULL!!");
626 elm_win_conformant_set(win, EINA_TRUE);
627 elm_win_resize_object_add(win, conformant);
628 evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, 0.0);
629 evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, 0.0);
630 evas_object_show(conformant);
632 layout = elm_layout_add(conformant);
633 elm_object_content_set(conformant, layout);
635 pinpopup = elm_popup_add(layout);
636 assertm_if(NULL == pinpopup, "pinpopup is NULL!!");
637 evas_object_size_hint_weight_set(pinpopup, EVAS_HINT_EXPAND, 0.0);
638 elm_object_part_text_set(pinpopup, "title,text", _("IDS_WFD_POP_TITILE_CONNECTION"));
640 Evas_Object *box = elm_box_add(pinpopup);
642 evas_object_del(pinpopup);
647 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
648 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
649 elm_object_part_content_set(pinpopup, NULL, box);
650 evas_object_show(box);
653 label = elm_label_add(box);
654 elm_object_style_set(label, "popup/default");
655 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
656 elm_object_text_set(label, pop->text);
657 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
658 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
659 elm_box_pack_end(box, label);
660 evas_object_show(label);
663 Evas_Object *body = elm_layout_add(box);
665 evas_object_del(pinpopup);
670 elm_layout_theme_set(body, "layout", "dialogue", "1icon");
671 evas_object_size_hint_weight_set(body, EVAS_HINT_EXPAND, 0.0);
672 evas_object_size_hint_align_set(body, EVAS_HINT_FILL, 0.0);
674 Evas_Object *editfield_pin = _add_edit_field(body, NULL, NULL, EINA_TRUE, EINA_TRUE);
675 Evas_Object *entry_pin = elm_object_part_content_get(editfield_pin, "elm.swallow.content");
676 ad->pin_entry = entry_pin;
677 evas_object_smart_callback_add(ad->pin_entry, "changed", _smart_ime_cb, NULL);
678 elm_object_part_content_set(body, "elm.icon", editfield_pin);
679 elm_box_pack_end(box, body);
680 evas_object_show(body);
682 elm_entry_password_set(ad->pin_entry, TRUE);
684 Evas_Object *check = elm_check_add(box);
685 elm_object_text_set(check, _("Show password"));
686 elm_object_focus_allow_set(check, EINA_FALSE);
687 evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.0);
688 evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.0);
689 evas_object_smart_callback_add(check, "changed", _check_changed_cb, NULL);
690 evas_object_show(check);
691 elm_box_pack_end(box, check);
694 btn1 = elm_button_add(pinpopup);
695 elm_object_style_set(btn1, "popup_button/default");
696 elm_object_text_set(btn1, pop->label1);
697 elm_object_part_content_set(pinpopup, "button1", btn1);
698 evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb, (void *)pop->resp_data1);
700 btn2 = elm_button_add(pinpopup);
701 elm_object_style_set(btn2, "popup_button/default");
702 elm_object_text_set(btn2, pop->label2);
703 elm_object_part_content_set(pinpopup, "button2", btn2);
704 evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb, (void *)pop->resp_data2);
706 elm_object_content_set(pinpopup, box);
707 evas_object_show(pinpopup);
708 evas_object_show(win);
709 elm_object_focus_set(ad->pin_entry, EINA_TRUE);
711 __WDPOP_LOG_FUNC_EXIT__;
716 * This function let the app create a popup
718 * @param[in] type the type of popup
719 * @param[in] userdata the pointer to the data which will be used
721 void wfd_prepare_popup(int type, void *userdata)
723 __WDPOP_LOG_FUNC_ENTER__;
724 wfd_appdata_t *ad = wfd_get_appdata();
725 wfd_popup_t *pop = ad->popup_data;
729 memset(pop, 0, sizeof(wfd_popup_t));
734 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ:
735 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECT_Q,
737 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_YES"));
738 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_SK_NO"));
739 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_PBC_YES;
740 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
742 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
745 case WFD_POP_APRV_CONNECTION_INVITATION_REQ:
746 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECT_Q,
748 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_YES"));
749 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_SK_NO"));
750 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_INVITATION_YES;
751 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
753 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
756 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ:
757 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_ENTER_PIN_WITH_KEYPAD,
759 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
760 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
761 pop->timeout = WFD_POP_TIMER_120;
762 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK;
763 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
765 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
768 case /* MT */ WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ:
769 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_ENTER_PIN,
770 ad->peer_name, WFD_POP_TIMER_120);
771 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
772 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
773 pop->timeout = WFD_POP_TIMER_120;
774 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES;
775 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
777 ad->popup = wfd_draw_pop_type_c(ad->win, pop);
780 case /* MT */ WFD_POP_PROG_CONNECT:
781 snprintf(pop->text, sizeof(pop->text), "%s", _("IDS_WFD_POP_CONNECTING"));
782 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
783 pop->timeout = WFD_POP_TIMER_120;
784 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
786 ad->popup = wfd_draw_pop_type_b(ad->win, pop);
789 case /* MO */ WFD_POP_PROG_CONNECT_WITH_KEYPAD:
790 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECTING_WITH_KEYPAD,
791 ad->peer_name, WFD_POP_TIMER_120, ad->peer_name);
792 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_OK"));
793 snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
794 pop->timeout = WFD_POP_TIMER_120;
795 pop->resp_data1 = WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK;
796 pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
798 ad->popup = wfd_draw_pop_type_keypad(ad->win, pop);
801 case /* MO/MT */ WFD_POP_PROG_CONNECT_WITH_PIN:
802 snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECTING_WITH_PIN,
803 ad->peer_name, WFD_POP_TIMER_120, ad->pin_number);
804 snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
805 pop->timeout = WFD_POP_TIMER_120;
806 pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_NO;
808 ad->popup = wfd_draw_pop_type_display(ad->win, pop);
811 case WFD_POP_PROG_CONNECT_CANCEL:
812 snprintf(pop->text, sizeof(pop->text), "%s", dgettext("sys_string", "IDS_COM_POP_CANCEL"));
813 pop->timeout = WFD_POP_TIMER_120;
814 ad->popup = wfd_draw_pop_type_a(ad->win, pop);
821 __WDPOP_LOG_FUNC_EXIT__;
826 * This function let the app create a tickernoti syspopup
828 * @param[in] msg the pointer to message of tickernoti
830 void wfd_tickernoti_popup(char *msg)
832 __WDPOP_LOG_FUNC_ENTER__;
839 WDPOP_LOGD( "FAIL: bundle_create()\n");
843 /* tickernoti style */
844 ret = bundle_add(b, "0", "info");
846 WDPOP_LOGD( "Fail to add tickernoti style\n");
852 ret = bundle_add(b, "1", msg);
854 WDPOP_LOGD( "Fail to add popup text\n");
859 /* orientation of tickernoti */
860 ret = bundle_add(b, "2", "0");
862 WDPOP_LOGD( "Fail to add orientation of tickernoti\n");
867 /* timeout(second) of tickernoti */
868 ret = bundle_add(b, "3", "3");
870 WDPOP_LOGD( "Fail to add timeout of tickernoti\n");
875 /* launch tickernoti */
876 ret = syspopup_launch(TICKERNOTI_SYSPOPUP, b);
878 WDPOP_LOGD( "Fail to launch syspopup\n");
882 __WDPOP_LOG_FUNC_EXIT__;