mirror of
				https://github.com/KevinMidboe/TinyGSM.git
				synced 2025-10-29 18:00:18 +00:00 
			
		
		
		
	Tacked in some maintains to hopefully reduce missed URC's
This commit is contained in:
		| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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); | ||||
|   } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user