diff --git a/src/TinyGsmClientBG96.h b/src/TinyGsmClientBG96.h index 991450b..02a8269 100644 --- a/src/TinyGsmClientBG96.h +++ b/src/TinyGsmClientBG96.h @@ -638,6 +638,7 @@ protected: return 0; } // TODO: Wait for ACK? AT+QISEND=id,0 + maintain(); // look for a very quick response from the remote return len; } @@ -656,6 +657,7 @@ protected: } waitResponse(); DBG("### READ:", len, "from", mux); + maintain(); // Listen for a close or other URC return len; } @@ -672,6 +674,7 @@ protected: if (!result) { sockets[mux]->sock_connected = modemGetConnected(mux); } + maintain(); // Listen for a close or other URC return result; } @@ -690,6 +693,7 @@ protected: int res = stream.readStringUntil(',').toInt(); // socket state waitResponse(); + maintain(); // Listen for a close or other URC // 0 Initial, 1 Opening, 2 Connected, 3 Listening, 4 Closing return 2 == res; diff --git a/src/TinyGsmClientM95.h b/src/TinyGsmClientM95.h index c1a7be2..39022a9 100644 --- a/src/TinyGsmClientM95.h +++ b/src/TinyGsmClientM95.h @@ -690,10 +690,11 @@ protected: } } waitResponse(5000L); + maintain(); // look for a very quick response from the remote // streamSkipUntil(','); // Skip mux // return stream.readStringUntil('\n').toInt(); - return 1; + return len; // TODO } size_t modemRead(size_t size, uint8_t mux) { @@ -711,6 +712,7 @@ protected: } waitResponse(); DBG("### READ:", len, "from", mux); + maintain(); // Listen for a close or other URC return len; } @@ -727,6 +729,7 @@ protected: if (!result) { sockets[mux]->sock_connected = modemGetConnected(mux); } + maintain(); // Listen for a close or other URC return result; } @@ -745,6 +748,7 @@ protected: int res = stream.readStringUntil(',').toInt(); // socket state waitResponse(); + maintain(); // Listen for a close or other URC // 0 Initial, 1 Opening, 2 Connected, 3 Listening, 4 Closing return 2 == res; diff --git a/src/TinyGsmClientMC60.h b/src/TinyGsmClientMC60.h index 8843b4a..8b6e021 100644 --- a/src/TinyGsmClientMC60.h +++ b/src/TinyGsmClientMC60.h @@ -721,7 +721,9 @@ protected: // streamSkipUntil(','); // Skip mux // return stream.readStringUntil('\n').toInt(); - return 1; + + maintain(); // look for a very quick response from the remote + return len; // TODO } size_t modemRead(size_t size, uint8_t mux) { @@ -739,6 +741,7 @@ protected: } waitResponse(); DBG("### READ:", len, "from", mux); + maintain(); // Listen for a close or other URC return len; } @@ -755,6 +758,7 @@ protected: if (!result) { sockets[mux]->sock_connected = modemGetConnected(mux); } + maintain(); // Listen for a close or other URC return result; } @@ -773,6 +777,7 @@ protected: int res = stream.readStringUntil(',').toInt(); // socket state waitResponse(); + maintain(); // Listen for a close or other URC // 0 Initial, 1 Opening, 2 Connected, 3 Listening, 4 Closing return 2 == res; diff --git a/src/TinyGsmClientSIM7000.h b/src/TinyGsmClientSIM7000.h index 82eae4d..90634aa 100644 --- a/src/TinyGsmClientSIM7000.h +++ b/src/TinyGsmClientSIM7000.h @@ -942,6 +942,7 @@ protected: return 0; } streamSkipUntil(','); // Skip mux + maintain(); // look for a very quick response from the remote return stream.readStringUntil('\n').toInt(); } @@ -984,6 +985,7 @@ protected: } waitResponse(); DBG("### READ:", len_confirmed, "from", mux); + maintain(); // Listen for a close or other URC return len_confirmed; } @@ -999,6 +1001,7 @@ protected: if (!result) { sockets[mux]->sock_connected = modemGetConnected(mux); } + maintain(); // Listen for a close or other URC return result; } @@ -1006,6 +1009,7 @@ protected: sendAT(GF("+CIPSTATUS="), mux); int res = waitResponse(GF(",\"CONNECTED\""), GF(",\"CLOSED\""), GF(",\"CLOSING\""), GF(",\"INITIAL\"")); waitResponse(); + maintain(); // Listen for a close or other URC return 1 == res; } diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index 76b9b34..13b94b4 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -864,6 +864,7 @@ protected: return 0; } streamSkipUntil(','); // Skip mux + maintain(); // look for a very quick response from the remote return stream.readStringUntil('\n').toInt(); } @@ -906,6 +907,7 @@ protected: } waitResponse(); DBG("### READ:", len_confirmed, "from", mux); + maintain(); // Listen for a close or other URC return len_confirmed; } @@ -921,6 +923,7 @@ protected: if (!result) { sockets[mux]->sock_connected = modemGetConnected(mux); } + maintain(); // Listen for a close or other URC return result; } @@ -928,6 +931,7 @@ protected: sendAT(GF("+CIPSTATUS="), mux); int res = waitResponse(GF(",\"CONNECTED\""), GF(",\"CLOSED\""), GF(",\"CLOSING\""), GF(",\"INITIAL\"")); waitResponse(); + maintain(); // Listen for a close or other URC return 1 == res; } diff --git a/src/TinyGsmClientUBLOX.h b/src/TinyGsmClientUBLOX.h index 1b08d24..98d6937 100644 --- a/src/TinyGsmClientUBLOX.h +++ b/src/TinyGsmClientUBLOX.h @@ -808,7 +808,7 @@ protected: streamSkipUntil(','); // Skip mux int sent = stream.readStringUntil('\n').toInt(); waitResponse(); - maintain(); // look for a very quick response + maintain(); // look for a very quick response from the remote return sent; } @@ -830,6 +830,7 @@ protected: streamSkipUntil('\"'); waitResponse(); DBG("### READ:", len, "from", mux); + maintain(); // Listen for a close or other URC return len; } @@ -848,6 +849,7 @@ protected: if (!result && res != 2 && res != 3) { // Don't check modemGetConnected after an error sockets[mux]->sock_connected = modemGetConnected(mux); } + maintain(); // Listen for a close or other URC return result; } @@ -873,6 +875,7 @@ protected: // 9: the socket is in LAST_ACK status // 10: the socket is in TIME_WAIT status waitResponse(); + maintain(); // Listen for a close or other URC return (result != 0); }