25 #define PASSWORD "12345678"
32 Serial.print(
"setup begin\r\n");
34 Serial.print(
"FW Version:");
38 Serial.print(
"to station + softap ok\r\n");
40 Serial.print(
"to station + softap err\r\n");
43 if (wifi.
joinAP(SSID, PASSWORD)) {
44 Serial.print(
"Join AP success\r\n");
48 Serial.print(
"Join AP failure\r\n");
52 Serial.print(
"multiple ok\r\n");
54 Serial.print(
"multiple err\r\n");
58 Serial.print(
"start tcp server ok\r\n");
60 Serial.print(
"start tcp server err\r\n");
64 Serial.print(
"set tcp server timout 10 seconds\r\n");
66 Serial.print(
"set tcp server timout err\r\n");
69 Serial.print(
"setup end\r\n");
74 uint8_t buffer[128] = {0};
76 uint32_t len = wifi.
recv(&mux_id, buffer,
sizeof(buffer), 100);
78 Serial.print(
"Status:[");
82 Serial.print(
"Received from :");
85 for(uint32_t i = 0; i < len; i++) {
86 Serial.print((
char)buffer[i]);
88 Serial.print(
"]\r\n");
90 if(wifi.
send(mux_id, buffer, len)) {
91 Serial.print(
"send back ok\r\n");
93 Serial.print(
"send back err\r\n");
97 Serial.print(
"release tcp ");
99 Serial.println(
" ok");
101 Serial.print(
"release tcp");
102 Serial.print(mux_id);
103 Serial.println(
" err");
106 Serial.print(
"Status:[");
bool send(const uint8_t *buffer, uint32_t len)
Send data based on TCP or UDP builded already in single mode.
bool joinAP(String ssid, String pwd, uint8_t pattern=3)
Join in AP.
String getVersion(void)
Get the version of AT Command Set.
bool releaseTCP(void)
Release TCP connection in single mode.
uint32_t recv(uint8_t *buffer, uint32_t buffer_size, uint32_t timeout=1000)
Receive data from TCP or UDP builded already in single mode.
bool enableMUX(void)
Enable IP MUX(multiple connection mode).
String getLocalIP(void)
Get the IP address of ESP8266.
The definition of class ESP8266.
bool setOprToStationSoftAP(uint8_t pattern1=3, uint8_t pattern2=3)
Set operation mode to station + softap.
bool setTCPServerTimeout(uint32_t timeout=180)
Set the timeout of TCP Server.
Provide an easy-to-use way to manipulate ESP8266.
bool startTCPServer(uint32_t port=333)
Start TCP Server(Only in multiple mode).
String getIPStatus(void)
Get the current status of connection(UDP and TCP).