Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ArduinoAPI
Fork of WeeESP8266 by
Revision 7:d54995c9e1d4, committed 2015-02-06
- Comitter:
- itead
- Date:
- Fri Feb 06 13:11:45 2015 +0000
- Parent:
- 6:18eb2d9fb2ac
- Child:
- 8:60d15efb4a1f
- Commit message:
- All AT Command Done.
Changed in this revision
| ESP8266.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/ESP8266.cpp Fri Feb 06 12:25:40 2015 +0000
+++ b/ESP8266.cpp Fri Feb 06 13:11:45 2015 +0000
@@ -321,7 +321,12 @@
m_puart->flush();
m_puart->print("AT+CWMODE=");
m_puart->println(mode);
- return recvFind("OK");
+
+ data = recvString("OK", "no change");
+ if (data.indexOf("OK") != -1 || data.indexOf("no change") != -1) {
+ return true;
+ }
+ return false;
}
bool ESP8266::sATCWJAP(String ssid, String pwd)
@@ -429,33 +434,95 @@
}
bool ESP8266::sATCIPSENDSingle(uint8_t *buffer, uint32_t len)
{
+ m_puart->flush();
+ m_puart->print("AT+CIPSEND=");
+ m_puart->println(len);
+ if (recvFind(">")) {
+ m_puart->flush();
+ for (uint32_t i = 0; i < len; i++) {
+ m_puart->write(buffer[i]);
+ }
+ return recvFind("SEND OK", 5000);
+ }
return false;
}
bool ESP8266::sATCIPSENDMultiple(uint8_t mux_id, uint8_t *buffer, uint32_t len)
{
+ m_puart->flush();
+ m_puart->print("AT+CIPSEND=");
+ m_puart->print(mux_id);
+ m_puart->print(",");
+ m_puart->println(len);
+ if (recvFind(">")) {
+ m_puart->flush();
+ for (uint32_t i = 0; i < len; i++) {
+ m_puart->write(buffer[i]);
+ }
+ return recvFind("SEND OK", 5000);
+ }
return false;
}
bool ESP8266::sATCIPCLOSEMulitple(uint8_t mux_id)
{
+ String data;
+ m_puart->flush();
+ m_puart->print("AT+CIPCLOSE=");
+ m_puart->println(mux_id);
+
+ data = recvString("OK", "Link is not", 3000);
+ if (data.indexOf("OK") != -1 || data.indexOf("Link is not") != -1) {
+ return true;
+ }
return false;
}
bool ESP8266::eATCIPCLOSESingle(void)
{
- return false;
+ m_puart->flush();
+ m_puart->println("AT+CIPCLOSE");
+ return recvFind("OK", 3000);
}
bool ESP8266::eATCIFSR(String &list)
{
- return false;
+ m_puart->flush();
+ m_puart->println("AT+CIFSR");
+ return recvFindAndFilter("OK", "\r\r\n", "\r\n\r\nOK", list);
}
bool ESP8266::sATCIPMUX(uint8_t mode)
{
+ String data;
+ m_puart->flush();
+ m_puart->print("AT+CIPMUX=");
+ m_puart->println(mode);
+
+ data = recvString("OK", "Link is builded");
+ if (data.indexOf("OK") != -1) {
+ return true;
+ }
return false;
}
bool ESP8266::sATCIPSERVER(uint8_t mode, uint32_t port)
{
- return false;
+ String data;
+ if (mode) {
+ m_puart->flush();
+ m_puart->print("AT+CIPSERVER=1,");
+ m_puart->println(port);
+
+ data = recvString("OK", "no change");
+ if (data.indexOf("OK") != -1 || data.indexOf("no change") != -1) {
+ return true;
+ }
+ return false;
+ } else {
+ m_puart->flush();
+ m_puart->println("AT+CIPSERVER=0");
+ return true;
+ }
}
bool ESP8266::sATCIPSTO(uint32_t timeout)
{
- return false;
+ m_puart->flush();
+ m_puart->print("AT+CIPSTO=");
+ m_puart->println(timeout);
+ return recvFind("OK");
}
