DA: Save last net_profile_info_s for connection state callback 56/283456/1
authorJaehyun Kim <jeik01.kim@samsung.com>
Thu, 27 Oct 2022 06:57:33 +0000 (15:57 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Thu, 27 Oct 2022 06:57:33 +0000 (15:57 +0900)
Save the last net_profile_info_s structure to send the connection state callback.
It doesn't have to send the null parameter to connection state callback.
So it saves the last net_profile_info_s structure.

Change-Id: Id71db25f97fad96d4403b614e27ccc8410f492ba
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/wifi_internal.c

index b26399c..be4ad35 100644 (file)
@@ -663,10 +663,17 @@ static void __state_changed_cb(wifi_manager_handle_s *wifi_handle, char *profile
                net_profile_info_s *profile_info, wifi_manager_connection_state_e state)
 {
        net_profile_info_s *ap_info = NULL;
+       static net_profile_info_s last_prof_info;
 
        if (profile_name == NULL)
                return;
 
+       if (profile_info != NULL) {
+               memcpy(&last_prof_info, profile_info, sizeof(net_profile_info_s));
+               last_prof_info.vsie_list = NULL;
+               last_prof_info.bssid_list = NULL;
+       }
+
        WIFI_LOG(WIFI_INFO, "%s state changed : %s", profile_name, __convert_ap_state_to_string(state));
 
        if (wifi_handle->connection_state_cb) {
@@ -686,6 +693,9 @@ static void __state_changed_cb(wifi_manager_handle_s *wifi_handle, char *profile
                                        _wifi_copy_bssid_list,
                                        NULL);
                } else {
+                       if (!g_strcmp0(last_prof_info.ProfileName, profile_name))
+                               memcpy(ap_info, &last_prof_info, sizeof(net_profile_info_s));
+
                        ap_info->network_info = wifi_handle->network_info;
                }