Accept incoming negotiation request when autoconnection is ON.
[platform/core/connectivity/wifi-direct-manager.git] / src / wifi-direct-session.c
index 333e5b9..f5211f7 100644 (file)
@@ -1057,13 +1057,24 @@ int wfd_session_process_event(wfd_manager_s *manager, wfd_oem_event_s *event)
                        wfd_state_set(manager, WIFI_DIRECT_STATE_CONNECTING);
                        wfd_util_set_wifi_direct_state(WIFI_DIRECT_STATE_CONNECTING);
 
-                       char peer_mac_address[MACSTR_LEN+1] = {0, };
-                       g_snprintf(peer_mac_address, MACSTR_LEN, MACSTR, MAC2STR(event->dev_addr));
-                       wfd_manager_dbus_emit_signal(WFD_MANAGER_MANAGE_INTERFACE,
-                                       "Connection",
-                                       g_variant_new("(iis)", WIFI_DIRECT_ERROR_NONE,
-                                               WFD_EVENT_CONNECTION_REQ,
-                                               peer_mac_address));
+                       if (manager->autoconnection == TRUE) {
+                               /**
+                                * TODO: Add autoconnection peer matching logic.
+                                */
+                               /**
+                                * In autoconnection mode, connection request notification
+                                * should not be sent to library.
+                                */
+                               res  = wfd_session_connect(session);
+                       } else {
+                               char peer_mac_address[MACSTR_LEN+1] = {0, };
+                               g_snprintf(peer_mac_address, MACSTR_LEN, MACSTR, MAC2STR(event->dev_addr));
+                               wfd_manager_dbus_emit_signal(WFD_MANAGER_MANAGE_INTERFACE,
+                                                            "Connection",
+                                                            g_variant_new("(iis)", WIFI_DIRECT_ERROR_NONE,
+                                                                          WFD_EVENT_CONNECTION_REQ,
+                                                                          peer_mac_address));
+                       }
                } else {
                        /* Sometimes, Provision Discovery response is not received.
                         * At this time, connection should be triggered by GO Negotiation request event */
@@ -1072,8 +1083,13 @@ int wfd_session_process_event(wfd_manager_s *manager, wfd_oem_event_s *event)
                                        break;
                                res = wfd_session_connect(session);
                        } else {
-                               /* In autoconnection mode, MT should not send GO Nego Req
-                                  before receiving the GO Nego Req from peer (MO). */
+                               /**
+                                * TODO: Add autoconnection peer matching logic.
+                                */
+                               /**
+                                * In autoconnection mode, MT should not send GO Nego Req
+                                * before receiving the GO Nego Req from peer (MO).
+                                */
                                if (manager->autoconnection == TRUE)
                                        res  = wfd_session_connect(session);
                        }