26 #ifdef ESP8266_USE_SOFTWARE_SERIAL
27 #include "SoftwareSerial.h"
30 #define VERSION_18 0X18
31 #define VERSION_22 0X22
37 #define USER_SEL_VERSION VERSION_18
45 #ifdef ESP8266_USE_SOFTWARE_SERIAL
54 #if (USER_SEL_VERSION == VERSION_22)
55 ESP8266(SoftwareSerial &uart, uint32_t baud = 115200);
56 #elif (USER_SEL_VERSION == VERSION_18)
57 ESP8266(SoftwareSerial &uart, uint32_t baud = 9600);
69 #if (USER_SEL_VERSION == VERSION_22)
70 ESP8266(HardwareSerial &uart, uint32_t baud = 115200);
71 #elif (USER_SEL_VERSION == VERSION_18)
72 ESP8266(HardwareSerial &uart, uint32_t baud = 9600);
143 bool setUart(uint32_t baudrate,uint8_t pattern);
210 bool joinAP(String ssid, String pwd,uint8_t pattern=3);
233 bool setSoftAPParam(String ssid, String pwd, uint8_t chl = 7, uint8_t ecn = 4,uint8_t pattern=3);
258 String
getDHCP(uint8_t pattern=3);
268 bool setDHCP(uint8_t mode, uint8_t en, uint8_t pattern=3);
313 bool setStationIp(String ip,String gateway,String netmask,uint8_t pattern=3);
322 String
getAPIp(uint8_t pattern=3);
332 bool setAPIp(String ip,uint8_t pattern=3);
393 bool createTCP(String addr, uint32_t port);
430 bool createTCP(uint8_t mux_id, String addr, uint32_t port);
450 bool registerUDP(uint8_t mux_id, String addr, uint32_t port);
546 bool send(
const uint8_t *buffer, uint32_t len);
557 bool send(uint8_t mux_id,
const uint8_t *buffer, uint32_t len);
567 uint32_t
recv(uint8_t *buffer, uint32_t buffer_size, uint32_t timeout = 1000);
578 uint32_t
recv(uint8_t mux_id, uint8_t *buffer, uint32_t buffer_size, uint32_t timeout = 1000);
592 uint32_t
recv(uint8_t *coming_mux_id, uint8_t *buffer, uint32_t buffer_size, uint32_t timeout = 1000);
604 String recvString(String target, uint32_t timeout = 1000);
609 String recvString(String target1, String target2, uint32_t timeout = 1000);
614 String recvString(String target1, String target2, String target3, uint32_t timeout = 1000);
619 bool recvFind(String target, uint32_t timeout = 1000);
625 bool recvFindAndFilter(String target, String begin, String end, String &data, uint32_t timeout = 1000);
636 uint32_t recvPkg(uint8_t *buffer, uint32_t buffer_size, uint32_t *data_len, uint32_t timeout, uint8_t *coming_mux_id);
641 bool eATGMR(String &version);
642 bool eATGSLP(uint32_t time);
643 bool eATE(uint8_t mode);
644 bool eATRESTORE(
void);
645 bool eATSETUART(uint32_t baudrate,uint8_t pattern);
647 bool qATCWMODE(uint8_t *mode,uint8_t pattern=3);
648 bool eATCWMODE(String &list) ;
649 bool sATCWMODE(uint8_t mode,uint8_t pattern=3);
650 bool qATCWJAP(String &ssid,uint8_t pattern=3) ;
651 bool sATCWJAP(String ssid, String pwd,uint8_t pattern=3);
652 bool eATCWLAP(String &list);
654 bool qATCWSAP(String &List,uint8_t pattern=3);
655 bool sATCWSAP(String ssid, String pwd, uint8_t chl, uint8_t ecn,uint8_t pattern=3);
656 bool eATCWLIF(String &list);
657 bool qATCWDHCP(String &List,uint8_t pattern=3);
658 bool sATCWDHCP(uint8_t mode, uint8_t en, uint8_t pattern=3);
659 bool eATCWAUTOCONN(uint8_t en);
660 bool qATCIPSTAMAC(String &mac,uint8_t pattern=3);
661 bool eATCIPSTAMAC(String mac,uint8_t pattern=3);
662 bool qATCIPSTAIP(String &ip,uint8_t pattern=3);
663 bool eATCIPSTAIP(String ip,String gateway,String netmask,uint8_t pattern=3);
664 bool qATCIPAP(String &ip,uint8_t pattern=3);
665 bool eATCIPAP(String ip,uint8_t pattern=3);
666 bool eCWSTARTSMART(uint8_t type);
667 bool eCWSTOPSMART(
void);
670 bool eATCIPSTATUS(String &list);
671 bool sATCIPSTARTSingle(String type, String addr, uint32_t port);
672 bool sATCIPSTARTMultiple(uint8_t mux_id, String type, String addr, uint32_t port);
673 bool sATCIPSENDSingle(
const uint8_t *buffer, uint32_t len);
674 bool sATCIPSENDMultiple(uint8_t mux_id,
const uint8_t *buffer, uint32_t len);
675 bool sATCIPCLOSEMulitple(uint8_t mux_id);
676 bool eATCIPCLOSESingle(
void);
677 bool eATCIFSR(String &list);
678 bool sATCIPMUX(uint8_t mode);
679 bool sATCIPSERVER(uint8_t mode, uint32_t port = 333);
680 bool sATCIPMODE(uint8_t mode);
681 bool eATSAVETRANSLINK(uint8_t mode,String ip,uint32_t port);
682 bool eATPING(String ip);
683 bool sATCIPSTO(uint32_t timeout);
690 #ifdef ESP8266_USE_SOFTWARE_SERIAL
691 SoftwareSerial *m_puart;
693 HardwareSerial *m_puart;
bool setAutoConnect(uint8_t en)
make boot automatically connected.
bool send(const uint8_t *buffer, uint32_t len)
Send data based on TCP or UDP builded already in single mode.
String getStationIp(uint8_t pattern=3)
Get the station's IP.
bool setPing(String ip)
PING COMMAND.
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 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 enableMUX(void)
Enable IP MUX(multiple connection mode).
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.
String getLocalIP(void)
Get the IP address of ESP8266.
bool deepSleep(uint32_t time)
Start function of deep sleep.
String getSoftAPParam(uint8_t pattern=3)
get SoftAP parameters.
bool createTCP(String addr, uint32_t port)
Create TCP connection in single mode.
bool unregisterUDP(void)
Unregister UDP port number in single mode.
bool startServer(uint32_t port=333)
Start Server(Only in multiple mode).
bool saveTransLink(uint8_t mode, String ip, uint32_t port)
Save the passthrough links.
bool stopTCPServer(void)
Stop TCP Server(Only in multiple mode).
bool setEcho(uint8_t mode)
Switch the echo function.
bool startSmartConfig(uint8_t type)
start smartconfig.
bool stopServer(void)
Stop Server(Only in multiple mode).
bool disableMUX(void)
Disable IP MUX(single connection mode).
bool setDHCP(uint8_t mode, uint8_t en, uint8_t pattern=3)
Set the state of DHCP.
bool restart(void)
Restart ESP8266 by "AT+RST".
bool kick(void)
Verify ESP8266 whether live or not.
bool setCIPMODE(uint8_t mode)
Set the module transfer mode.
bool registerUDP(String addr, uint32_t port)
Register UDP port number in single mode.
bool restore(void)
Restore factory.
bool setOprToStationSoftAP(uint8_t pattern1=3, uint8_t pattern2=3)
Set operation mode to station + softap.
bool leaveAP(void)
Leave AP joined before.
bool setTCPServerTimeout(uint32_t timeout=180)
Set the timeout of TCP Server.
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.
bool startTCPServer(uint32_t port=333)
Start TCP Server(Only in multiple mode).
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.