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)
Branch:
api-changes
Revision:
38:eb1e46561a19
Parent:
34:9c26a3dcdc1f
Child:
39:7e85bf8003fa
--- a/ESP8266Interface.cpp	Tue Feb 23 01:31:42 2016 -0600
+++ b/ESP8266Interface.cpp	Tue Feb 23 04:02:07 2016 -0600
@@ -26,10 +26,9 @@
 int32_t ESP8266Interface::connect(
     const char *ap, 
     const char *pass_phrase, 
-    wifi_security_t, 
-    uint32_t timeout_ms)
+    wifi_security_t)
 {
-    _esp.setTimeout(timeout_ms);
+    _esp.setTimeout(getTimeout());
 
     if (!_esp.startup(3)) return -1;
     if (!_esp.dhcp(true, 1)) return -1;
@@ -59,6 +58,12 @@
     return _mac_address;
 }
 
+void ESP8266Interface::setTimeout(uint32_t timeout)
+{
+    NetworkInterface::setTimeout(timeout);
+    _esp.setTimeout(timeout);
+}
+
 SocketInterface *ESP8266Interface::createSocket(socket_protocol_t proto)
 {
     // Look for an unused socket