Fix bug of invitation behavior
authorKim Gibyoung <lastkgb.kim@samsung.com>
Sat, 2 Feb 2013 18:03:33 +0000 (03:03 +0900)
committerKim Gibyoung <lastkgb.kim@samsung.com>
Sat, 2 Feb 2013 19:31:16 +0000 (04:31 +0900)
Change-Id: Ic957e12a26bb42194fdba80d44091833133acfe8

debian/changelog
packaging/libug-setting-wifidirect-efl.spec
popup-wifidirect/include/wfd-app.h
popup-wifidirect/src/wfd-app-client.c
popup-wifidirect/src/wfd-app-popup-view.c

index 5065795..40bd29f 100755 (executable)
@@ -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 <laskgb.kim@samsung.com>  Sun, 03 Feb 2013 02:58:48 +0900
+
 ug-setting-wifidirect-efl (1.0.7) precise; urgency=low
 
   * Update for STMS
index 8dd5b2a..298dd2b 100755 (executable)
@@ -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
index 59d808c..8ed9346 100755 (executable)
@@ -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,
index 5a103c3..283416d 100755 (executable)
@@ -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;
 
index 83456be..3b07f3d 100755 (executable)
@@ -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: