您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ wifi_set_opmode函数代码示例

51自学网 2021-06-03 09:56:41
  C++
这篇教程C++ wifi_set_opmode函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中wifi_set_opmode函数的典型用法代码示例。如果您正苦于以下问题:C++ wifi_set_opmode函数的具体用法?C++ wifi_set_opmode怎么用?C++ wifi_set_opmode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了wifi_set_opmode函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: config_wifi_new

void ICACHE_FLASH_ATTR config_wifi_new(void){        wifi_softap_dhcps_stop();	//vTaskDelay( xDelay );        wifi_set_opmode(NULL_MODE);	//vTaskDelay( xDelay );	wifi_set_opmode(SOFTAP_MODE);	//vTaskDelay( xDelay );	struct softap_config apConfig;	char ssid[8];	wifi_set_event_handler_cb(wifi_event_cb);	//mode_info();	memset(apConfig.ssid, 0, sizeof(apConfig.ssid));	sprintf(ssid, "%s/0", WIFI_APSSID);	memcpy(apConfig.ssid, ssid, strlen(ssid));	printf("SSID %s/n",apConfig.ssid);	apConfig.authmode = AUTH_OPEN;	apConfig.channel = 5;	apConfig.ssid_len=strlen(ssid);	apConfig.max_connection = 255;	apConfig.ssid_hidden = 0;	wifi_softap_set_config(&apConfig);	//vTaskDelay( xDelay );	wifi_softap_dhcps_start();	//vTaskDelay( xDelay*10 );	coap_restart(0);}
开发者ID:JanisIOT,项目名称:JanisEsp8266,代码行数:26,


示例2: mesh_SetSoftap

/****************************************************************************** * FunctionName : mesh_SetSoftap * Description  : If the device failed to join mesh network,                  open the SoftAP interface for webserver                  The SSID should not be the same form as that of the device in mesh network*******************************************************************************/void ICACHE_FLASH_ATTRmesh_SetSoftap(){    MESH_INFO("----------------------/r/n");    MESH_INFO("MESH ENABLE SOFTAP /r/n");    MESH_INFO("----------------------/r/n");    struct softap_config config_softap;    char ssid[33]={0};    wifi_softap_get_config(&config_softap);    os_memset(config_softap.password, 0, sizeof(config_softap.password));    os_memset(config_softap.ssid, 0, sizeof(config_softap.ssid));    os_sprintf(ssid,"ESP_%06X",system_get_chip_id());    os_memcpy(config_softap.ssid, ssid, os_strlen(ssid));    config_softap.ssid_len = os_strlen(ssid);    config_softap.ssid_hidden = 0;    config_softap.channel = wifi_get_channel();    #ifdef SOFTAP_ENCRYPT        char password[33];        char macaddr[6];        os_sprintf(password, MACSTR "_%s", MAC2STR(macaddr), PASSWORD);        os_memcpy(config_softap.password, password, os_strlen(password));        config_softap.authmode = AUTH_WPA_WPA2_PSK;    #else        os_memset(config_softap.password,0,sizeof(config_softap.password));        config_softap.authmode = AUTH_OPEN;    #endif    wifi_set_opmode(STATIONAP_MODE);    wifi_softap_set_config(&config_softap);    wifi_set_opmode(STATIONAP_MODE);    wifi_softap_get_config(&config_softap);    MESH_INFO("SSID: %s /r/n",config_softap.ssid);    MESH_INFO("CHANNEL: %d /r/n",config_softap.channel);    MESH_INFO("-------------------------/r/n");}
开发者ID:koanpl,项目名称:ESP8266_LIGHT_WITH_MESH,代码行数:40,


示例3: resetTimerCb

// This routine is ran some time after a connection attempt to an access point. If// the connect succeeds, this gets the module in STA-only mode. If it fails, it ensures// that the module is in STA+AP mode so the user has a chance to recover.static void ICACHE_FLASH_ATTR resetTimerCb(void *arg) {  int x = wifi_station_get_connect_status();  int m = wifi_get_opmode() & 0x3;  DBG("Wifi check: mode=%s status=%d/n", wifiMode[m], x);  if (x == STATION_GOT_IP) {    if (m != 1) {#ifdef CHANGE_TO_STA      // We're happily connected, go to STA mode      DBG("Wifi got IP. Going into STA mode../n");      wifi_set_opmode(1);      os_timer_arm(&resetTimer, RESET_TIMEOUT, 0); // check one more time after switching to STA-only#endif    }    log_uart(false);    // no more resetTimer at this point, gotta use physical reset to recover if in trouble  } else {    if (m != 3) {      DBG("Wifi connect failed. Going into STA+AP mode../n");      wifi_set_opmode(3);    }    log_uart(true);    DBG("Enabling/continuing uart log/n");    os_timer_arm(&resetTimer, RESET_TIMEOUT, 0);  }}
开发者ID:seco,项目名称:esp-link,代码行数:29,


示例4: resetTimerCb

// This routine is ran some time after a connection attempt to an access point. If// the connect succeeds, this gets the module in STA-only mode. If it fails, it ensures// that the module is in STA+AP mode so the user has a chance to recover.static void ICACHE_FLASH_ATTR resetTimerCb(void *arg) {  int x = wifi_station_get_connect_status();  int m = wifi_get_opmode() & 0x3;  DBG("Wifi check: mode=%s status=%d/n", wifiMode[m], x);  if (m == 2) return; // 2=AP, in AP-only mode we don't do any auto-switching  if ( x == STATION_GOT_IP ) {    // if we got an IP we could switch to STA-only...    if (m != 1) { // 1=STA#ifdef CHANGE_TO_STA      // We're happily connected, go to STA mode      DBG("Wifi got IP. Going into STA mode../n");      wifi_set_opmode(1);      os_timer_arm(&resetTimer, RESET_TIMEOUT, 0); // check one more time after switching to STA-only#endif    }    log_uart(false);    // no more resetTimer at this point, gotta use physical reset to recover if in trouble  } else {    // we don't have an IP address    if (m != 3) {      DBG("Wifi connect failed. Going into STA+AP mode../n");      wifi_set_opmode(3);      wifi_softap_set_config(&apconf);    }    log_uart(true);    DBG("Enabling/continuing uart log/n");    os_timer_arm(&resetTimer, RESET_TIMEOUT, 0);  }}
开发者ID:mroavi,项目名称:esp-link,代码行数:34,


示例5: resetTimerCb

//This routine is ran some time after a connection attempt to an access point. If//the connect succeeds, this gets the module in STA-only mode.static void ICACHE_FLASH_ATTR resetTimerCb(void *arg) {	int x = wifi_station_get_connect_status();	int m = wifi_get_opmode() & 0x3;	os_printf("Wifi check: mode=%s status=%d/n", wifiMode[m], x);	if (x == STATION_GOT_IP) {		if (m != 1) {			// We're happily connected, go to STA mode			os_printf("Wifi got IP. Going into STA mode../n");			wifi_set_opmode(1);			wifi_set_sleep_type(SLEEP_MODE);			os_timer_arm(&resetTimer, RESET_TIMEOUT, 0);			//os_timer_disarm(&deepTimer);			//os_timer_setfn(&deepTimer, deepSleepCb, NULL);			//os_timer_arm(&deepTimer, 1000, 1);		}		log_uart(false);		// no more resetTimer at this point, gotta use physical reset to recover if in trouble	} else {		if (m != 3) {			os_printf("Wifi connect failed. Going into STA+AP mode../n");			wifi_set_opmode(3);		}		log_uart(true);		os_printf("Enabling/continuing uart log/n");		os_timer_arm(&resetTimer, RESET_TIMEOUT, 0);	}}
开发者ID:alonewolfx2,项目名称:esp-link,代码行数:30,


示例6: user_init

/****************************************************************************** * FunctionName : user_init * Description  : entry of user application, init user function here * Parameters   : none * Returns      : none*******************************************************************************/void user_init(void){    bool ret;    PIN_FUNC_SELECT(LED_GPIO_MUX, LED_GPIO_FUNC);    xUARTQueue = xQueueCreate(128, sizeof(char));    uart_init_new();    UART_intr_handler_register(&uart0_rx_intr_handler, &xUARTQueue);    ETS_UART_INTR_ENABLE();    printf("SDK version:%s/n", system_get_sdk_version());    GPIO_OUTPUT_SET(LED_GPIO, 0);      //Set  station mode   wifi_set_opmode(STATIONAP_MODE);   // ESP8266 connect to router.   // user_set_station_config();   // Setup TCP server      wifi_station_set_auto_connect(0);    // wifi_station_set_reconnect_policy(0);    printf("Wifi Button example program. /r/n");    if (!read_user_config(&user_config))    {        ret = wifi_set_opmode(STATIONAP_MODE);        DBG("wifi_set_opmode returns %d op_mode now %d/r/n", ret, wifi_get_opmode());        // user_set_station_config();        user_tcpserver_init(SERVER_LOCAL_PORT);        // user_tcpserver_init(SERVER_LOCAL_PORT);        wifi_station_set_auto_connect(1);    }    else    {        printf ("No valid config/r/n");    }    printf("Hiya");    // sys_init_timing();   lwip_init();   // while(1);   // xTaskCreate(check_input, "input", 256, &xUARTQueue, 3, NULL);   // xTaskCreate(helloworld, "hw", configMINIMAL_STACK_SIZE, NULL, 2, NULL);   // xTaskCreate(blinky, "bl", configMINIMAL_STACK_SIZE, NULL, 2, NULL);}
开发者ID:Andrew-Collins,项目名称:esp8266-sdk,代码行数:57,


示例7: restoreFactorySettings

void restoreFactorySettings() {	wifi_station_disconnect();	wifi_set_opmode(0x3); //reset to STA+AP mode	struct softap_config apConfig;	wifi_softap_get_config(&apConfig);	os_strncpy((char*)apConfig.ssid, "smartswitch", 18);	apConfig.authmode = 0; //Disable security	wifi_softap_set_config(&apConfig);	struct station_config stconf;	os_strncpy((char*)stconf.ssid, "", 2);	os_strncpy((char*)stconf.password, "", 2);	wifi_station_set_config(&stconf);	OLED_CLS();	OLED_Print(2, 0, "RESET", 1);	os_printf("Reset completed. Restarting system.../n");	ioOutput(0, GPIO_OUTPUT1);	ioOutput(0, GPIO_OUTPUT2);	while (!GPIO_INPUT_GET(GPIO_BUTTON1)) { os_printf("."); };	while (!GPIO_INPUT_GET(GPIO_BUTTON2)) { os_printf("."); };	system_restart();}
开发者ID:MbedTinkerer,项目名称:ESP8266-relay-board-firmware,代码行数:27,


示例8: user_wifi_init

/* * 函数:user_wifi_init * 说明:WiFi配置初始化 */void ICACHE_FLASH_ATTRuser_wifi_init(void){	wifi_set_opmode(STATION_MODE);	user_set_station_config(WIFI_SSID, WIFI_PASSWORD);    wifi_set_event_handler_cb(wifi_handle_event_cb);}
开发者ID:zouchuan1991,项目名称:ESP8266-Demos,代码行数:11,


示例9: user_init

/****************************************************************************** * FunctionName : user_init * Description  : entry of user application, init user function here * Parameters   : none * Returns      : none*******************************************************************************/void user_init(void){    uart_div_modify(0, UART_CLK_FREQ / 115200);    wifi_set_opmode(STATION_MODE);    websocket_start(&test_mode);}
开发者ID:hawkhsieh,项目名称:ESP8266_RTOS_SDK,代码行数:13,


示例10: setup_wifi_ap_mode

//============================================================================================================================void setup_wifi_ap_mode(void){	wifi_set_opmode((wifi_get_opmode()|STATIONAP_MODE)&STATIONAP_MODE);	struct softap_config apconfig;	if(wifi_softap_get_config(&apconfig))	{		wifi_softap_dhcps_stop();		os_memset(apconfig.ssid, 0, sizeof(apconfig.ssid));		os_memset(apconfig.password, 0, sizeof(apconfig.password));		apconfig.ssid_len = os_sprintf(apconfig.ssid, configs.hwSettings.wifi.SSID);//"HA-HA-HA");		os_sprintf(apconfig.password, "%s", configs.hwSettings.wifi.SSID_PASS);//"qwertyuiop");		apconfig.authmode = configs.hwSettings.wifi.auth;//AUTH_OPEN;//AUTH_WPA_WPA2_PSK;		apconfig.ssid_hidden = 0;		apconfig.channel = 7;		apconfig.max_connection = 4;		if(!wifi_softap_set_config(&apconfig))		{			//#if DEBUG_LEVEL > 0			ets_uart_printf("ESP8266 not set AP config!/r/n");			//#endif		};		struct ip_info ipinfo;		wifi_get_ip_info(SOFTAP_IF, &ipinfo);		IP4_ADDR(&ipinfo.ip, 192, 168, 4, 100);		IP4_ADDR(&ipinfo.gw, 192, 168, 4, 100);		IP4_ADDR(&ipinfo.netmask, 255, 255, 255, 0);		wifi_set_ip_info(SOFTAP_IF, &ipinfo);		wifi_softap_dhcps_start();	}	//#if DEBUG_LEVEL > 0	ets_uart_printf("ESP8266 in AP mode configured./r/n");	//#endif}
开发者ID:tsbp,项目名称:ESP8266_74HC595,代码行数:34,


示例11: setup_wifi_ap_mode

void setup_wifi_ap_mode(void){	wifi_set_opmode((wifi_get_opmode()|SOFTAP_MODE)&STATIONAP_MODE);	struct softap_config apconfig;	if(wifi_softap_get_config(&apconfig))	{		wifi_softap_dhcps_stop();		memset(apconfig.ssid, 0, sizeof(apconfig.ssid));		memset(apconfig.password, 0, sizeof(apconfig.password));		apconfig.ssid_len = os_sprintf(apconfig.ssid, WIFI_AP_NAME);		os_sprintf(apconfig.password, "%s", WIFI_AP_PASSWORD);		apconfig.authmode = AUTH_WPA_WPA2_PSK;		apconfig.ssid_hidden = 0;		apconfig.channel = 7;		apconfig.max_connection = 4;		if(!wifi_softap_set_config(&apconfig))		{			#ifdef PLATFORM_DEBUG			os_printf("ESP8266 not set AP config!/r/n");			#endif		};		struct ip_info ipinfo;		wifi_get_ip_info(SOFTAP_IF, &ipinfo);		IP4_ADDR(&ipinfo.ip, 192, 168, 4, 1);		IP4_ADDR(&ipinfo.gw, 192, 168, 4, 1);		IP4_ADDR(&ipinfo.netmask, 255, 255, 255, 0);		wifi_set_ip_info(SOFTAP_IF, &ipinfo);		wifi_softap_dhcps_start();	}	#ifdef PLATFORM_DEBUG	os_printf("ESP8266 in AP mode configured./r/n");	#endif}
开发者ID:wriley,项目名称:iMailbox,代码行数:33,


示例12: at_setupCmdCwmode

/**  * @brief  Setup commad of set wifi mode.  * @param  id: commad id number  * @param  pPara: AT input param  * @retval None  */void ICACHE_FLASH_ATTRat_setupCmdCwmode(uint8_t id, char *pPara){  uint8_t mode;  char temp[32];  pPara++;  mode = atoi(pPara);  if(mode == at_wifiMode)  {    uart0_sendStr("no change/r/n");    return;  }  if((mode >= 1) && (mode <= 3))  {    ETS_UART_INTR_DISABLE();    wifi_set_opmode(mode);    ETS_UART_INTR_ENABLE();    at_backOk;//    system_restart();  }  else  {    at_backError;  }}
开发者ID:EUA,项目名称:esp8266,代码行数:32,


示例13: WIFI_999_Connect

void ICACHE_FLASH_ATTR WIFI_999_Connect(uint8_t* ssid, uint8_t* pass, WifiCallback cb){	struct station_config stationConf;	INFO("WIFI_INIT/r/n");	wifi_set_opmode(STATION_MODE);	wifi_station_set_auto_connect(FALSE);	wifiCb = cb;	os_memset(&stationConf, 0, sizeof(struct station_config));	os_sprintf(stationConf.ssid, "%s", ssid);	os_sprintf(stationConf.password, "%s", pass);	wifi_station_set_config(&stationConf);	os_timer_disarm(&WiFiLinker);	os_timer_setfn(&WiFiLinker, (os_timer_func_t *)wifi_check_ip, NULL);	os_timer_arm(&WiFiLinker, 1000, 0);	wifi_station_set_auto_connect(TRUE);	/*	 * Reconnect is only in SDK 1.2 and newer.  :-(	 *	 * wifi_station_set_reconnect_policy(TRUE);	// After a hint from Pete Scargill.	 */	wifi_station_connect();}
开发者ID:PuceBaboon,项目名称:ESP8266-I2C-Fail,代码行数:28,


示例14: config_wifi

static void config_wifi(){    NODE_DBG("Putting AP UP");    platform_key_led(0);            wifi_station_set_auto_connect(1);     wifi_set_opmode(0x03); // station+ap mode                           struct softap_config config;    wifi_softap_get_config(&config);    char ssid[]="SmartRelay"SERIAL_NUMBER;    strcpy(config.ssid,ssid);    memset(config.password,0,64);    config.ssid_len=strlen(ssid);    config.channel=11;    config.authmode=AUTH_OPEN;    config.max_connection=4;    config.ssid_hidden=0;    wifi_softap_set_config(&config);    }
开发者ID:andresvidal,项目名称:esp-ginx,代码行数:25,


示例15: user_init

void user_init(void){    os_printf("SDK version:%s/n", system_get_sdk_version());	    wifi_set_opmode(STATION_MODE);    smartconfig_start(smartconfig_done);}
开发者ID:ctrowat,项目名称:ideal-disco,代码行数:7,


示例16: wifi_get_opmode

void AccessPointClass::enable(bool enabled){	uint8 mode = wifi_get_opmode() & ~SOFTAP_MODE;	if (enabled) mode |= SOFTAP_MODE;//	wifi_set_opmode(static_cast<WIFI_MODE>(mode));	wifi_set_opmode((WIFI_MODE)mode);}
开发者ID:alon24,项目名称:SmingRTOS,代码行数:7,


示例17: esptouch_SuccessCb

/****************************************************************************** * FunctionName : esptouch_SuccessCb * Description  : esp-touch success callback*******************************************************************************/void ICACHE_FLASH_ATTR    esptouch_SuccessCb(void* data){    wifi_set_opmode(STATIONAP_MODE);        os_timer_disarm(&esptouch_tout_t);//disable check timeout     #if LIGHT_DEVICE    light_hint_stop(HINT_WHITE);    #endif    SC_INFO("ESP-TOUCH SUCCESS /r/n");        SC_INFO("ENABLE LIGHT ACTION(ESP-NOW)");    SC_INFO("debug: channel:%d/r/n",wifi_get_channel());#if ESP_MESH_SUPPORT    if(MESH_DISABLE == espconn_mesh_get_status()){        //user_MeshStart();        //mesh_enable_task();    }    user_esp_platform_connect_ap_cb();    //user_MeshStart();#else    user_esp_platform_connect_ap_cb();#endif#if ESP_NOW_SUPPORT    light_EspnowInit();#endif    SC_INFO("CONNECTED TO AP...ENABLE MESH AND RUN PLATFORM CODE ...WAIT.../r/n");}
开发者ID:koanpl,项目名称:ESP8266_LIGHT_WITH_MESH,代码行数:33,


示例18: user_init

void user_init(){    struct station_config conf;    // This is used to setup the serial communication    uart_div_modify(0, UART_CLK_FREQ / 115200);    wifi_set_opmode(STATION_MODE);    // os_bzero ( &conf, sizeof(struct station_config) );    os_memset ( &conf, 0, sizeof(struct station_config) );    os_memcpy (&conf.ssid, ssid, 32);    os_memcpy (&conf.password, pass, 64 );    wifi_station_set_config (&conf);    // And this is used to print some information    os_printf("/n");    os_printf("SDK version:%s/n", system_get_sdk_version());    system_print_meminfo();    os_delay_us ( 1 );    os_printf ( "CPU Hz = %d/n", system_get_cpu_freq() );    show_mac ();    show_ip ();    /* set a callback for wifi events */    wifi_set_event_handler_cb ( wifi_event );}
开发者ID:jonshouse1,项目名称:esp8266-jahttp,代码行数:28,


示例19: user_init

void ICACHE_FLASH_ATTR user_init(void) {	uart_div_modify(0, UART_CLK_FREQ / BAUD);	wifi_set_opmode(STATION_MODE);	wifi_station_connect();	/*** I
C++ wifi_station_connect函数代码示例
C++ wifi_set_carddetect函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。