26 #define PASSWORD "12345678"
33 Serial.print(
"setup begin\r\n");
35 Serial.println(
"set uart is ok ");
38 Serial.println(
"set uart is error");
42 Serial.println(
"it is STA");
45 Serial.println(
"it is AP");
48 Serial.println(
"it is AP+SoftAP");
51 wifi.
joinAP(SSID,PASSWORD);
55 Serial.println(
"it is leave");
60 Serial.println(
"it is set param ok");
64 Serial.print(
"the state of DHCP:");
65 Serial.println(wifi.
getDHCP().c_str());
67 Serial.println(
"it is set DHCP OK");
69 Serial.println(wifi.
getDHCP().c_str());
71 Serial.println(
"take off auto connect ok");
73 Serial.print(
"get the station mac: ");
76 Serial.println(
"set station mac is ok ");
79 Serial.println(
"it is error");
81 Serial.print(
"get the station mac: ");
83 Serial.print(
"get the station's ip");
86 if(wifi.
setStationIp(
"192.168.1.6",
"192.168.1.1",
"255.255.255.0")){
87 Serial.println(
"set station's ip is ok");
90 Serial.println(
"set station's ip is error");
92 Serial.print(
"get the station's ip");
95 Serial.print(
"get the ap's ap");
96 Serial.println(wifi.
getAPIp().c_str());
98 if(wifi.
setAPIp(
"192.168.1.1")){
99 Serial.println(
"set ap's ip is ok");
103 Serial.println(
"set ap's is is error");
105 Serial.print(
"get the ap's ap");
106 Serial.println(wifi.
getAPIp().c_str());
109 Serial.println(
"start smartconfig is ok");
112 Serial.println(
"start smartconfig is error");
115 Serial.println(
"stop smartconfig is ok");
118 Serial.println(
"stop smartconfig is error");
120 Serial.print(
"get the current status of connection:");
123 Serial.println(
"save trans link is ok");
126 Serial.println(
"save trans link is error");
128 Serial.println(
"setup end\r\n");
bool setAutoConnect(uint8_t en)
make boot automatically connected.
String getStationIp(uint8_t pattern=3)
Get the station's IP.
bool joinAP(String ssid, String pwd, uint8_t pattern=3)
Join in AP.
bool setSoftAPParam(String ssid, String pwd, uint8_t chl=7, uint8_t ecn=4, uint8_t pattern=3)
Set SoftAP parameters.
String getDHCP(uint8_t pattern=3)
Get the current state of DHCP.
bool setOprToSoftAP(uint8_t pattern1=3, uint8_t pattern2=3)
Set operation mode to softap.
bool setStationMac(String mac, uint8_t pattern=3)
Set the station's MAC address.
String getNowConecAp(uint8_t pattern=3)
Search and returns the current connect AP.
bool setStationIp(String ip, String gateway, String netmask, uint8_t pattern=3)
Set the station's IP.
bool setUart(uint32_t baudrate, uint8_t pattern)
Set up a serial port configuration.
String getWifiModeList(void)
Get the model values list.
bool setAPIp(String ip, uint8_t pattern=3)
Set the AP IP.
The definition of class ESP8266.
String getSoftAPParam(uint8_t pattern=3)
get SoftAP parameters.
bool saveTransLink(uint8_t mode, String ip, uint32_t port)
Save the passthrough links.
bool startSmartConfig(uint8_t type)
start smartconfig.
bool setDHCP(uint8_t mode, uint8_t en, uint8_t pattern=3)
Set the state of DHCP.
bool setOprToStationSoftAP(uint8_t pattern1=3, uint8_t pattern2=3)
Set operation mode to station + softap.
bool leaveAP(void)
Leave AP joined before.
String getAPIp(uint8_t pattern=3)
Get the AP's IP.
bool stopSmartConfig(void)
stop smartconfig.
Provide an easy-to-use way to manipulate ESP8266.
String getAPList(void)
Search available AP list and return it.
String getStationMac(uint8_t pattern=3)
Get the station's MAC address.
String getIPStatus(void)
Get the current status of connection(UDP and TCP).
bool setOprToStation(uint8_t pattern1=3, uint8_t pattern2=3)
Set operation mode to station.
String getJoinedDeviceIP(void)
Get the IP list of devices connected to SoftAP.