Socket interface for ESP8266. Implements the NetworkSocketAPI. Requires device to use the Espressif Firmware.

Dependencies:   ESP8266

Dependents:   ESP8266InterfaceTests HelloESP8266Interface

Fork of ESP8266Interface by NetworkSocketAPI

Note

This library assumes your ESP8266 is running the Espressif Firmware. For instructions on how to update your ESP8266 to use the correct firmware see the Firmware Update Wiki Page.

Currently the ESP8266Interface LIbrary has the following Abilities:

Working

  • TCP Client
  • UDP Client
  • Transparent mode (single connection of 1 type at a time)
  • Station Mode (connects to AP)

To be implimented

  • TCP Server
  • UDP Server
  • Multi Connection Mode (able to have up to 5 sockets at a time)
  • AP Mode (Make ESP Chip act like access point)
  • DNS Support (currently websites must be looked up by IP)
  • Error Recovery

Nice but not necessary

  • colorized text for ESP AT Commands in Command line (easier to differentiate from other text)
Revision:
30:c19f1e61063b
Parent:
29:f2ae8f47729b
Child:
33:276cb279df57
--- a/ESP8266Interface.cpp	Thu Aug 27 14:32:50 2015 +0000
+++ b/ESP8266Interface.cpp	Mon Dec 28 05:39:05 2015 +0000
@@ -16,7 +16,7 @@
 
 #include "ESP8266Interface.h"
 
-ESP8266Interface::ESP8266Interface(PinName tx, PinName rx) : esp8266(tx, rx)
+ESP8266Interface::ESP8266Interface(PinName tx, PinName rx, uint8_t trace) : esp8266(tx, rx, trace)
 {
     uuidCounter = 0;
     std::fill_n(availableID, sizeof(availableID)/sizeof(int), -1);
@@ -66,9 +66,11 @@
     if (!esp8266.disconnect()) {
         return -1;
     }
-    for(int i=0; i<numSockets; i++) {
+    for (int i=0; i<numSockets; i++) {
         SocketInterface *socket = sockets[availableID[i]];
-        deallocateSocket(socket);
+        if (socket) {
+            deallocateSocket(socket);
+        }
     }
     return 0;
 }