Wi-Fi_softap_get_config(config);//Getsoft-APconfigfirst.
sprintf(config->ssid,DEMO_AP_SSID);
sprintf(config->password,DEMO_AP_PASSWORD);
config->authmode=AUTH_WPA_WPA2_PSK;
config->ssid_len=0;//oritsactualSSIDlength
config->max_connection=4;
Wi-Fi_softap_set_config(config);//SetESP8266soft-APconfig
free(config);
3. Get the Station info when ESP8266 functions as SoftAP.
structstation_info*station=Wi-Fi_softap_get_station_info();
while(station){
printf(bssid:MACSTR,ip:IPSTR/n,
MAC2STR(station->bssid),IP2STR(&station->ip));
station=STAILQ_NEXT(station,next);
}
Wi-Fi_softap_free_station_info();//Freeitbycallingfunctions
4. When ESP8266 functions as SoftAP, its default IP address is 192.168.4.1. The IP
address is subject to modification by developers; however, the DHCP server must be
closed first before modifying the address. Below is an example of setting the IP address
as 192.168.5.1.
Wi-Fi_softap_dhcps_stop();//disablesoft-APDHCPserver
structip_infoinfo;
IP4_ADDR(&info.ip,192,168,5,1);//setIP
IP4_ADDR(&info.gw,192,168,5,1);//setgateway
IP4_ADDR(&info.netmask,255,255,255,0);//setnetmask
Wi-Fi_set_ip_info(SOFTAP_IF,&info);
5. The range of the IP address allocated by ESP8266 SoftAP can be set by developers.
For example, the IP address can range from 192.168.5.100 to 192.168.5.105. Please
enable the DHCP server when the configuration is completed.
structdhcps_leasedhcp_lease;
IP4_ADDR(&dhcp_lease.start_ip,192,168,5,100);
IP4_ADDR(&dhcp_lease.end_ip,192,168,5,105);
Wi-Fi_softap_set_dhcps_lease(&dhcp_lease);
Wi-Fi_softap_dhcps_start();//enablesoft-APDHCPserver