Пример #1
0
void wps_judge_staion_disconnect(void) 
{
	int mode = 0;
	unsigned char ssid[33];

	wext_get_mode(WLAN0_NAME, &mode);

	switch(mode) {
	case IW_MODE_MASTER:		//In AP mode
		rltk_wlan_deinit();
		rltk_wlan_init(0,RTW_MODE_STA);
		rltk_wlan_start(0);
		break;
	case IW_MODE_INFRA:		//In STA mode
		if(wext_get_ssid(WLAN0_NAME, ssid) > 0)
			wifi_disconnect();
	}	
}
Пример #2
0
int wifi_off(void)
{
	int ret = 0;
	int timeout = 20;

	if((rltk_wlan_running(WLAN0_IDX) == 0) &&
		(rltk_wlan_running(WLAN1_IDX) == 0)) {
		printf("\n\rWIFI is not running");
		return 0;
	}
#if CONFIG_LWIP_LAYER
	dhcps_deinit();
	LwIP_DHCP(0, DHCP_STOP);
#endif	
	printf("\n\rDeinitializing WIFI ...");
	rltk_wlan_deinit();

	while(1) {
		if((rltk_wlan_running(WLAN0_IDX) == 0) &&
			(rltk_wlan_running(WLAN1_IDX) == 0)) {
			printf("\n\rWIFI deinitialized");
			break;
		}

		if(timeout == 0) {
			printf("\n\rERROR: Deinit WIFI timeout!");
			break;
		}

		vTaskDelay(1 * configTICK_RATE_HZ);
		timeout --;
	}

	wifi_mode = RTW_MODE_NONE;

#if CONFIG_INIC_EN
	inic_stop();
#endif

	return ret;
}