From 495f0773afdbbfc819fad73f92a2a1046e25c680 Mon Sep 17 00:00:00 2001 From: Kim Gibyoung Date: Sun, 3 Feb 2013 03:03:33 +0900 Subject: [PATCH] Fix bug of invitation behavior Change-Id: Ic957e12a26bb42194fdba80d44091833133acfe8 --- debian/changelog | 8 +++++++ packaging/libug-setting-wifidirect-efl.spec | 2 +- popup-wifidirect/include/wfd-app.h | 2 ++ popup-wifidirect/src/wfd-app-client.c | 18 +++++++++++++- popup-wifidirect/src/wfd-app-popup-view.c | 37 +++++++++++++++++++++++++++++ 5 files changed, 65 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5065795..40bd29f 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ug-setting-wifidirect-efl (1.0.8) precise; urgency=low + + * Fix bug of invitation behavior + * Git: rsa/apps/home/ug-wifi-direct + * Tag: libug-setting-wifidirect-efl_1.0.8 + + -- Gibyoung Kim Sun, 03 Feb 2013 02:58:48 +0900 + ug-setting-wifidirect-efl (1.0.7) precise; urgency=low * Update for STMS diff --git a/packaging/libug-setting-wifidirect-efl.spec b/packaging/libug-setting-wifidirect-efl.spec index 8dd5b2a..298dd2b 100755 --- a/packaging/libug-setting-wifidirect-efl.spec +++ b/packaging/libug-setting-wifidirect-efl.spec @@ -3,7 +3,7 @@ Name: libug-setting-wifidirect-efl Summary: Wi-Fi Direct setting UI gadget -Version: 1.0.7 +Version: 1.0.8 Release: 1 Group: TO_BE_FILLED License: Flora License diff --git a/popup-wifidirect/include/wfd-app.h b/popup-wifidirect/include/wfd-app.h index 59d808c..8ed9346 100755 --- a/popup-wifidirect/include/wfd-app.h +++ b/popup-wifidirect/include/wfd-app.h @@ -69,6 +69,7 @@ enum { WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ, WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ, WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ, + WFD_POP_APRV_CONNECTION_INVITATION_REQ, WFD_POP_PROG_CONNECT, WFD_POP_PROG_DISCONNECT, @@ -84,6 +85,7 @@ enum { WFD_POP_RESP_OK, WFD_POP_RESP_CANCEL, WFD_POP_RESP_APRV_CONNECT_PBC_YES = 1, + WFD_POP_RESP_APRV_CONNECT_INVITATION_YES, WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK, WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES, WFD_POP_RESP_APRV_CONNECT_NO, diff --git a/popup-wifidirect/src/wfd-app-client.c b/popup-wifidirect/src/wfd-app-client.c index 5a103c3..283416d 100755 --- a/popup-wifidirect/src/wfd-app-client.c +++ b/popup-wifidirect/src/wfd-app-client.c @@ -478,7 +478,8 @@ void _cb_connection(int error_code, wifi_direct_connection_state_e connection_st } /* when disconnection, mac_address is empty */ - if (connection_state <= WIFI_DIRECT_CONNECTION_RSP) { + if (connection_state <= WIFI_DIRECT_CONNECTION_RSP || + connection_state == WIFI_DIRECT_INVITATION_REQ) { memset(ad->peer_mac, 0, sizeof(ad->peer_mac)); memset(ad->peer_name, 0, sizeof(ad->peer_name)); strncpy(ad->peer_mac, mac_address, strlen(mac_address)); @@ -645,6 +646,21 @@ void _cb_connection(int error_code, wifi_direct_connection_state_e connection_st /* tickernoti popup */ wfd_tickernoti_popup(_("IDS_WFD_POP_CONNECTING")); } + break; + case WIFI_DIRECT_INVITATION_REQ: + { + WDPOP_LOGD( "event ------------------ WIFI_DIRECT_INVITATION_REQ\n"); + bool auto_connection_mode = FALSE; + + wifi_direct_is_autoconnection_mode(&auto_connection_mode); + if (auto_connection_mode == TRUE) { + result = wifi_direct_connect(ad->peer_mac); + printf("wifi_direct_accept_connection() result=[%d]\n", result); + } else { + wfd_prepare_popup(WFD_POP_APRV_CONNECTION_INVITATION_REQ, NULL); + } + } + break; default: break; diff --git a/popup-wifidirect/src/wfd-app-popup-view.c b/popup-wifidirect/src/wfd-app-popup-view.c index 83456be..3b07f3d 100755 --- a/popup-wifidirect/src/wfd-app-popup-view.c +++ b/popup-wifidirect/src/wfd-app-popup-view.c @@ -84,6 +84,30 @@ static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info) } break; + case WFD_POP_RESP_APRV_CONNECT_INVITATION_YES: + WDPOP_LOGI( + "WFD_POP_RESP_APRV_CONNECT_INVITATION_YES [" MACSTR "]\n", MAC2STR(ad->peer_mac)); + wfd_destroy_popup(); + + result = wifi_direct_connect(ad->peer_mac); + WDPOP_LOGD( + "wifi_direct_connect() result=[%d]\n", + result); + if (result == WIFI_DIRECT_ERROR_NONE) { + /* tickernoti popup */ + wfd_tickernoti_popup(_("IDS_WFD_POP_CONNECTING")); + } else { + WDPOP_LOGE( + "wifi_direct_connect() FAILED!!\n"); + evas_object_hide(ad->win); + + /* tickernoti popup */ + snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name); + wfd_tickernoti_popup(msg); + } + + break; + case /* MT */ WFD_POP_RESP_APRV_CONNECT_DISPLAY_OK: { char *pin = NULL; @@ -544,6 +568,8 @@ Evas_Object *wfd_draw_pop_type_display(Evas_Object * win, wfd_popup_t * pop) wps_display_popup.step = 0; wps_display_popup.progressbar = progressbar; wps_display_popup.time = time; + if(pb_timer) + ecore_timer_del(pb_timer); pb_timer = ecore_timer_add(1, _fn_pb_timer, &wps_display_popup); /* add buttons */ @@ -712,6 +738,17 @@ void wfd_prepare_popup(int type, void *userdata) pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO; ad->popup = wfd_draw_pop_type_c(ad->win, pop); + break; + + case WFD_POP_APRV_CONNECTION_INVITATION_REQ: + snprintf(pop->text, sizeof(pop->text), IDS_WFD_POP_CONNECT_Q, + ad->peer_name); + snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_YES")); + snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_SK_NO")); + pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_INVITATION_YES; + pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO; + + ad->popup = wfd_draw_pop_type_c(ad->win, pop); break; case /* MT */ WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ: -- 2.7.4