framework/src/st_things/things_stack/utils/things_network.c
//--------------------------------------------------------------------------------
/**
 * Function definiton for callback of wifi connected to AP in station mode.
 */
Function definiton for callback of wifi connected to AP in station mode.
Function definiton for callback of wifi connected to AP in station mode .
void things_wifi_sta_connected(wifi_manager_result_e res)
{
	bool is_wifi_retry_connect = false;
	if (res == WIFI_MANAGER_FAIL) {
		THINGS_LOG_E(TAG, "Failed to connect to the AP");
		if (!dm_is_es_complete()) {
			g_retry_connect_cnt++;
			if (g_retry_connect_cnt <= MAX_WIFI_CONNECT_RETRY_COUNT) {
				is_wifi_retry_connect = true;
				THINGS_LOG_E(TAG, "(%d) Retry to connect ap during easy-setup.", g_retry_connect_cnt);
			} else {
				return;
			}
		} else {
			is_wifi_retry_connect = true;
			THINGS_LOG_V(TAG, "Retry to connect ap during normal time.");
		}
	} else {
		is_wifi_retry_connect = false;
		THINGS_LOG_V(TAG, "Stop retry to connect ap.");
	}
	THINGS_LOG_V(TAG, "T%d --> %s", getpid(), __FUNCTION__);
	if (things_is_things_module_initialized() == 1) {
		pthread_create_rtos(&h_thread_things_wifi_join, NULL, (pthread_func_type)t_things_wifi_join_loop, (void *)&is_wifi_retry_connect, THINGS_STACK_WIFI_JOIN_THREAD);
	} else {
		THINGS_LOG_E(TAG, "things module was not initialized.");
	}
}
void things_wifi_sta_connected ( wifi_manager_result_e res ) { bool is_wifi_retry_connect = false ; if ( res == WIFI_MANAGER_FAIL ) { THINGS_LOG_E ( TAG , " " ) ; if ( ! dm_is_es_complete ( ) ) { g_retry_connect_cnt ++ ; if ( g_retry_connect_cnt <= MAX_WIFI_CONNECT_RETRY_COUNT ) { is_wifi_retry_connect = true ; THINGS_LOG_E ( TAG , " " , g_retry_connect_cnt ) ; } else { return ; } } else { is_wifi_retry_connect = true ; THINGS_LOG_V ( TAG , " " ) ; } } else { is_wifi_retry_connect = false ; THINGS_LOG_V ( TAG , " " ) ; } THINGS_LOG_V ( TAG , " " , getpid ( ) , __FUNCTION__ ) ; if ( things_is_things_module_initialized ( ) == 1 ) { pthread_create_rtos ( & h_thread_things_wifi_join , NULL , ( pthread_func_type ) t_things_wifi_join_loop , ( void * ) & is_wifi_retry_connect , THINGS_STACK_WIFI_JOIN_THREAD ) ; } else { THINGS_LOG_E ( TAG , " " ) ; } }
Function definiton for callback of wifi connected to AP in station mode.
Function definiton for callback of wifi connected to AP in station mode .
/* If WiFi is failed to connect to AP.Then it will retry to connect to home AP. */ // Retry to connect to AP during easy-setup. /**
				 * Set this variable to true for calling the api for reconnect to home AP.
				 */ // Retry to connect home AP during normal time. /* If WiFi is connected to home AP.No need to retry to connect to home AP. */ // If things stack is initialzed.Then create a thread to wifi join.