From: Jaehyun Kim Date: Thu, 27 Oct 2022 07:37:15 +0000 (+0900) Subject: DA: Fix connetion state callback issues X-Git-Tag: accepted/tizen/7.0/unified/20230126.170237~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e6f9a29ffc99aaf96fd793cea25ed0b2eeb136e;p=platform%2Fcore%2Fapi%2Fwifi-manager.git DA: Fix connetion state callback issues Change-Id: I53dbf4064633851d7e047cac6056712bcdeacd2b Signed-off-by: Jaehyun Kim --- diff --git a/src/network_signal.c b/src/network_signal.c index b66b9e5..be30864 100644 --- a/src/network_signal.c +++ b/src/network_signal.c @@ -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) { diff --git a/src/wifi_internal.c b/src/wifi_internal.c index be4ad35..77cf5ae 100644 --- a/src/wifi_internal.c +++ b/src/wifi_internal.c @@ -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 !=