DA: Fix connetion state callback issues 59/283459/1
authorJaehyun Kim <jeik01.kim@samsung.com>
Thu, 27 Oct 2022 07:37:15 +0000 (16:37 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Thu, 27 Oct 2022 07:37:15 +0000 (16:37 +0900)
Change-Id: I53dbf4064633851d7e047cac6056712bcdeacd2b
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/network_signal.c
src/wifi_internal.c

index b66b9e5..be30864 100644 (file)
@@ -835,6 +835,17 @@ static int __net_handle_service_state_changed(network_info_s *network_info,
        if (old_state == new_state)
                return Error;
 
+#if defined TIZEN_DA
+       /*
+        * Send connection state callback to upper layer.
+        * This problem is that the target does not send the connection state callback to upper layer if its usb module is reattaced.
+        * Ignore configuration state when disconnection with AP.
+        */
+       if ((old_state == NET_STATE_TYPE_READY || old_state == NET_STATE_TYPE_ONLINE)
+                && new_state == NET_STATE_TYPE_CONFIGURATION)
+               return Error;
+#endif /* TIZEN_DA */
+
        network_info->service_state = new_state;
 
        switch (new_state) {
index be4ad35..77cf5ae 100644 (file)
@@ -674,6 +674,21 @@ static void __state_changed_cb(wifi_manager_handle_s *wifi_handle, char *profile
                last_prof_info.bssid_list = NULL;
        }
 
+#if defined TIZEN_DA
+       /*
+        * Fix connection callback issue.
+        * It ignore configuration state after disconnection state in connection_state_changed_cb.
+        */
+       static wifi_manager_connection_state_e last_state = WIFI_MANAGER_CONNECTION_STATE_DISCONNECTED;
+
+       if (last_state == WIFI_MANAGER_CONNECTION_STATE_DISCONNECTED && state == WIFI_MANAGER_CONNECTION_STATE_CONFIGURATION) {
+               WIFI_LOG(WIFI_INFO, "Previous state is disconnected, so ignore the configuration state.");
+               return;
+       }
+
+       last_state = state;
+#endif /* TIZEN_DA */
+
        WIFI_LOG(WIFI_INFO, "%s state changed : %s", profile_name, __convert_ap_state_to_string(state));
 
        if (wifi_handle->connection_state_cb) {
@@ -1302,6 +1317,15 @@ static void _wifi_evt_cb(net_event_info_s *event_cb, void *user_data)
                if ((_wifi_check_profile_name_validity(event_cb->ProfileName) !=
                        true) && (event_cb->Error !=
                                NET_ERR_CONNECTION_CONNECT_FAILED) &&
+#if defined TIZEN_DA
+                               /*
+                                * Send the connection callback to upper layer when specific failure case.
+                                * It has the problem that does not connection callback to wifi-manager
+                                * when it received the failure event from net-config before it gets the service state from connman.
+                                */
+                               (event_cb->Error !=
+                                NET_ERR_INVALID_OPERATION) &&
+#endif /* TIZEN_DA */
                                (event_cb->Error !=
                                 NET_ERR_CONNECTION_WPS_TIMEOUT) &&
                                (event_cb->Error !=