modified by ohneta
Fork of ESP8266 by
Diff: ESP8266.cpp
- Revision:
- 15:1ff5d44d5e30
- Parent:
- 14:71474261a9d7
--- a/ESP8266.cpp Tue Nov 10 14:42:20 2015 +0000 +++ b/ESP8266.cpp Wed Nov 11 03:40:18 2015 +0000 @@ -145,6 +145,18 @@ bool ESP8266::close(int id) { + // if status = Disconnected , port was closed. + { + int status; + atParser.send("AT+CIPSTATUS"); + atParser.recv("STATUS:%d", &status); + atParser.recv("OK"); + if (status == 4) { + return true; + } + } + + //IDs only 0-4 if(id > 4) { return false; @@ -154,7 +166,6 @@ string close_command = "AT+CIPCLOSE="+(string)idstr; string closed_response = (string)idstr + ",CLOSED OK"; - //return (atParser.send(close_command.c_str()) && atParser.recv("OK")); return (atParser.send(close_command.c_str()) && atParser.recv(closed_response.c_str())); }