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:
22:312453862371
Parent:
20:5d0762aa4680
Child:
23:fd0f3197c30b
--- a/ESP8266Interface.h	Tue Jul 21 20:18:55 2015 +0000
+++ b/ESP8266Interface.h	Wed Jul 22 20:53:09 2015 +0000
@@ -43,10 +43,10 @@
     virtual int32_t send(const void *data, uint32_t amount, uint32_t timeout_ms = 15000) ;
     virtual uint32_t recv(void *data, uint32_t amount, uint32_t timeout_ms = 15000) ;
     virtual int32_t close() const;
+    uint32_t getHandle() const;
     uint8_t getID();
     void handleRecieve();
 protected:
-    uint32_t _handle;
     uint8_t _id;    
 private:
     ATParser *atParser;
@@ -64,7 +64,7 @@
     virtual int32_t init(const char *ip, const char *mask, const char *gateway);
     virtual int32_t connect(uint32_t timeout_ms) ;
     virtual int32_t connect(const char *ap, const char *pass_phrase = 0, wifi_security_t security = WI_NONE, uint32_t timeout_ms = 15000);
-    virtual int32_t disconnect(void) const;
+    virtual int32_t disconnect(void) ;
     virtual char *getIPAddress(void) ;
     virtual char *getGateway(void) const;
     virtual char *getNetworkMask(void) const;
@@ -76,7 +76,8 @@
 private:
     BufferedSerial serial;
     ATParser atParser;
-    int *availableID;
+    const int numSockets = 5;
+    int availableID[numSockets];
     char ip[100];
 };