A fork of the original interface for OS/2. Features a correctly-implemented recv (but retains the old behavior via recv2).

Dependencies:   BufferedSerial

Dependents:   weather_clock weather_clock

Files at this revision

API Documentation at this revision

Comitter:
alexhrao
Date:
Fri May 24 23:36:22 2019 +0000
Parent:
52:a5c7a72aa707
Commit message:
Final changes for preliminary new node support

Changed in this revision

ESP8266/ESP8266.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r a5c7a72aa707 -r 4224de23da9e ESP8266/ESP8266.cpp
--- a/ESP8266/ESP8266.cpp	Fri May 24 23:19:03 2019 +0000
+++ b/ESP8266/ESP8266.cpp	Fri May 24 23:36:22 2019 +0000
@@ -42,6 +42,11 @@
 #define ESP8226_NEW_NODE 0
 #endif
 
+#if ESP8226_NEW_NODE == 0
+#define ESP8226_CON_CMD "c=net.createConnection("
+#else
+#define ESP8226_CON_CMD "c=tls.createConnection("
+#endif
 ESP8266 *ESP8266::_inst;
 
 ESP8266::ESP8266(PinName tx, PinName rx, PinName reset, int baud, int timeout) :
@@ -137,7 +142,7 @@
 
 bool ESP8266::open(bool type, char* ip, int port, int id) {
     // Create the actual connection
-    if (!(command("c=net.createConnection(") &&
+    if (!(command(ESP8226_CON_CMD) &&
           command(type ? "net.TCP" : "net.UDP") &&
           command(")") &&
           execute()))