Tijl Goens
/
EpaperdisplayII
tempcommit 13/05
Diff: Esp8266.cpp
- Revision:
- 2:048e163245b7
- Parent:
- 1:63664175e603
--- a/Esp8266.cpp Mon May 13 13:59:19 2019 +0000 +++ b/Esp8266.cpp Wed May 15 13:39:22 2019 +0000 @@ -41,7 +41,7 @@ while(processed == false); } -string Esp8266::getRequest(const char* TCPorUDP, const char* Server, int Port, const char* ConnectionString) { +string Esp8266::getRequest(const char* TCPorUDP, const char* Server, int Port, const char* ConnectionString, bool stayAlive) { bool processed = false; do { processed = parser->send("AT+CIPSTART=\"%s\",\"%s\",%d", TCPorUDP, Server, Port) && parser->recv("OK"); @@ -60,8 +60,9 @@ while(processed == false); parser->send("%s", con.c_str()); - - closeConnection(); + if(!stayAlive) { + closeConnection(); + } return getJsonString(); } @@ -82,7 +83,7 @@ while(1) { presentChar = (char)parser->getc(); - + if(presentChar == '{' && previousChar == '[') { startOfJSON = true; }