mirror of
				https://github.com/KevinMidboe/TinyGSM.git
				synced 2025-10-29 18:00:18 +00:00 
			
		
		
		
	Rename so *I* don't screw them up
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
		| @@ -55,7 +55,7 @@ class TinyGsmBattery { | ||||
|     thisModem().streamSkipUntil(',');  // Skip battery charge status | ||||
|     thisModem().streamSkipUntil(',');  // Skip battery charge level | ||||
|     // return voltage in mV | ||||
|     uint16_t res = thisModem().streamGetInt(','); | ||||
|     uint16_t res = thisModem().streamGetIntBefore(','); | ||||
|     // Wait for final OK | ||||
|     thisModem().waitResponse(); | ||||
|     return res; | ||||
| @@ -66,7 +66,7 @@ class TinyGsmBattery { | ||||
|     if (thisModem().waitResponse(GF("+CBC:")) != 1) { return false; } | ||||
|     thisModem().streamSkipUntil(',');  // Skip battery charge status | ||||
|     // Read battery charge level | ||||
|     int8_t res = thisModem().streamGetInt(','); | ||||
|     int8_t res = thisModem().streamGetIntBefore(','); | ||||
|     // Wait for final OK | ||||
|     thisModem().waitResponse(); | ||||
|     return res; | ||||
| @@ -76,7 +76,7 @@ class TinyGsmBattery { | ||||
|     thisModem().sendAT(GF("+CBC")); | ||||
|     if (thisModem().waitResponse(GF("+CBC:")) != 1) { return false; } | ||||
|     // Read battery charge status | ||||
|     int8_t res = thisModem().streamGetInt(','); | ||||
|     int8_t res = thisModem().streamGetIntBefore(','); | ||||
|     // Wait for final OK | ||||
|     thisModem().waitResponse(); | ||||
|     return res; | ||||
| @@ -86,9 +86,9 @@ class TinyGsmBattery { | ||||
|                         uint16_t& milliVolts) { | ||||
|     thisModem().sendAT(GF("+CBC")); | ||||
|     if (thisModem().waitResponse(GF("+CBC:")) != 1) { return false; } | ||||
|     chargeState = thisModem().streamGetInt(','); | ||||
|     percent     = thisModem().streamGetInt(','); | ||||
|     milliVolts  = thisModem().streamGetInt('\n'); | ||||
|     chargeState = thisModem().streamGetIntBefore(','); | ||||
|     percent     = thisModem().streamGetIntBefore(','); | ||||
|     milliVolts  = thisModem().streamGetIntBefore('\n'); | ||||
|     // Wait for final OK | ||||
|     thisModem().waitResponse(); | ||||
|     return true; | ||||
|   | ||||
| @@ -359,7 +359,7 @@ class TinyGsmA6 | ||||
|     streamSkipUntil('"'); | ||||
|     String hex = stream.readStringUntil('"'); | ||||
|     streamSkipUntil(','); | ||||
|     int8_t dcs = streamGetInt('\n'); | ||||
|     int8_t dcs = streamGetIntBefore('\n'); | ||||
|  | ||||
|     if (dcs == 15) { | ||||
|       return TinyGsmDecodeHex7bit(hex); | ||||
| @@ -389,7 +389,7 @@ class TinyGsmA6 | ||||
|     if (waitResponse(GF(GSM_NL "+CBC:")) != 1) { return false; } | ||||
|     streamSkipUntil(',');  // Skip battery charge status | ||||
|     // Read battery charge level | ||||
|     int8_t res = streamGetInt('\n'); | ||||
|     int8_t res = streamGetIntBefore('\n'); | ||||
|     // Wait for final OK | ||||
|     waitResponse(); | ||||
|     return res; | ||||
| @@ -400,8 +400,8 @@ class TinyGsmA6 | ||||
|                         uint16_t& milliVolts) { | ||||
|     sendAT(GF("+CBC?")); | ||||
|     if (waitResponse(GF(GSM_NL "+CBC:")) != 1) { return false; } | ||||
|     chargeState = streamGetInt(','); | ||||
|     percent     = streamGetInt('\n'); | ||||
|     chargeState = streamGetIntBefore(','); | ||||
|     percent     = streamGetIntBefore('\n'); | ||||
|     milliVolts  = 0; | ||||
|     // Wait for final OK | ||||
|     waitResponse(); | ||||
| @@ -419,7 +419,7 @@ class TinyGsmA6 | ||||
|  | ||||
|     sendAT(GF("+CIPSTART="), GF("\"TCP"), GF("\",\""), host, GF("\","), port); | ||||
|     if (waitResponse(timeout_ms, GF(GSM_NL "+CIPNUM:")) != 1) { return false; } | ||||
|     int8_t newMux = streamGetInt('\n'); | ||||
|     int8_t newMux = streamGetIntBefore('\n'); | ||||
|  | ||||
|     int8_t rsp = waitResponse( | ||||
|         (timeout_ms - (millis() - startMillis)), GF("CONNECT OK" GSM_NL), | ||||
| @@ -499,8 +499,8 @@ class TinyGsmA6 | ||||
|           index = 5; | ||||
|           goto finish; | ||||
|         } else if (data.endsWith(GF("+CIPRCV:"))) { | ||||
|           int8_t  mux      = streamGetInt(','); | ||||
|           int16_t len      = streamGetInt(','); | ||||
|           int8_t  mux      = streamGetIntBefore(','); | ||||
|           int16_t len      = streamGetIntBefore(','); | ||||
|           int16_t len_orig = len; | ||||
|           if (len > sockets[mux]->rx.free()) { | ||||
|             DBG("### Buffer overflow: ", len, "->", sockets[mux]->rx.free()); | ||||
| @@ -515,7 +515,7 @@ class TinyGsmA6 | ||||
|           } | ||||
|           data = ""; | ||||
|         } else if (data.endsWith(GF("+TCPCLOSED:"))) { | ||||
|           int8_t mux = streamGetInt('\n'); | ||||
|           int8_t mux = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT) { | ||||
|             sockets[mux]->sock_connected = false; | ||||
|           } | ||||
|   | ||||
| @@ -306,9 +306,9 @@ class TinyGsmBG96 | ||||
|  | ||||
|     if (waitResponse(timeout_ms, GF(GSM_NL "+QIOPEN:")) != 1) { return false; } | ||||
|  | ||||
|     if (streamGetInt(',') != mux) { return false; } | ||||
|     if (streamGetIntBefore(',') != mux) { return false; } | ||||
|     // Read status | ||||
|     return (0 == streamGetInt('\n')); | ||||
|     return (0 == streamGetIntBefore('\n')); | ||||
|   } | ||||
|  | ||||
|   int16_t modemSend(const void* buff, size_t len, uint8_t mux) { | ||||
| @@ -324,7 +324,7 @@ class TinyGsmBG96 | ||||
|   size_t modemRead(size_t size, uint8_t mux) { | ||||
|     sendAT(GF("+QIRD="), mux, ',', (uint16_t)size); | ||||
|     if (waitResponse(GF("+QIRD:")) != 1) { return 0; } | ||||
|     int16_t len = streamGetInt('\n'); | ||||
|     int16_t len = streamGetIntBefore('\n'); | ||||
|  | ||||
|     for (int i = 0; i < len; i++) { moveCharFromStreamToFifo(mux); } | ||||
|     waitResponse(); | ||||
| @@ -339,7 +339,7 @@ class TinyGsmBG96 | ||||
|     if (waitResponse(GF("+QIRD:")) == 1) { | ||||
|       streamSkipUntil(',');  // Skip total received | ||||
|       streamSkipUntil(',');  // Skip have read | ||||
|       result = streamGetInt('\n'); | ||||
|       result = streamGetIntBefore('\n'); | ||||
|       if (result) { DBG("### DATA AVAILABLE:", result, "on", mux); } | ||||
|       waitResponse(); | ||||
|     } | ||||
| @@ -353,12 +353,12 @@ class TinyGsmBG96 | ||||
|  | ||||
|     if (waitResponse(GF("+QISTATE:")) != 1) { return false; } | ||||
|  | ||||
|     streamSkipUntil(',');            // Skip mux | ||||
|     streamSkipUntil(',');            // Skip socket type | ||||
|     streamSkipUntil(',');            // Skip remote ip | ||||
|     streamSkipUntil(',');            // Skip remote port | ||||
|     streamSkipUntil(',');            // Skip local port | ||||
|     int8_t res = streamGetInt(',');  // socket state | ||||
|     streamSkipUntil(',');                  // Skip mux | ||||
|     streamSkipUntil(',');                  // Skip socket type | ||||
|     streamSkipUntil(',');                  // Skip remote ip | ||||
|     streamSkipUntil(',');                  // Skip remote port | ||||
|     streamSkipUntil(',');                  // Skip local port | ||||
|     int8_t res = streamGetIntBefore(',');  // socket state | ||||
|  | ||||
|     waitResponse(); | ||||
|  | ||||
| @@ -415,13 +415,13 @@ class TinyGsmBG96 | ||||
|           String urc = stream.readStringUntil('\"'); | ||||
|           streamSkipUntil(','); | ||||
|           if (urc == "recv") { | ||||
|             int8_t mux = streamGetInt('\n'); | ||||
|             int8_t mux = streamGetIntBefore('\n'); | ||||
|             DBG("### URC RECV:", mux); | ||||
|             if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|               sockets[mux]->got_data = true; | ||||
|             } | ||||
|           } else if (urc == "closed") { | ||||
|             int8_t mux = streamGetInt('\n'); | ||||
|             int8_t mux = streamGetIntBefore('\n'); | ||||
|             DBG("### URC CLOSE:", mux); | ||||
|             if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|               sockets[mux]->sock_connected = false; | ||||
|   | ||||
| @@ -326,7 +326,7 @@ class TinyGsmESP8266 | ||||
|       uint8_t has_status = waitResponse(GF("+CIPSTATUS:"), GFP(GSM_OK), | ||||
|                                         GFP(GSM_ERROR)); | ||||
|       if (has_status == 1) { | ||||
|         int8_t returned_mux = streamGetInt(','); | ||||
|         int8_t returned_mux = streamGetIntBefore(','); | ||||
|         streamSkipUntil(',');   // Skip mux | ||||
|         streamSkipUntil(',');   // Skip type | ||||
|         streamSkipUntil(',');   // Skip remote IP | ||||
| @@ -384,8 +384,8 @@ class TinyGsmESP8266 | ||||
|           index = 5; | ||||
|           goto finish; | ||||
|         } else if (data.endsWith(GF("+IPD,"))) { | ||||
|           int8_t  mux      = streamGetInt(','); | ||||
|           int16_t len      = streamGetInt(':'); | ||||
|           int8_t  mux      = streamGetIntBefore(','); | ||||
|           int16_t len      = streamGetIntBefore(':'); | ||||
|           int16_t len_orig = len; | ||||
|           if (len > sockets[mux]->rx.free()) { | ||||
|             DBG("### Buffer overflow: ", len, "received vs", | ||||
|   | ||||
| @@ -257,7 +257,7 @@ class TinyGsmM590 | ||||
|   bool isGprsConnectedImpl() { | ||||
|     sendAT(GF("+XIIC?")); | ||||
|     if (waitResponse(GF(GSM_NL "+XIIC:")) != 1) { return false; } | ||||
|     int8_t res = streamGetInt(','); | ||||
|     int8_t res = streamGetIntBefore(','); | ||||
|     waitResponse(); | ||||
|     return res == 1; | ||||
|   } | ||||
| @@ -386,8 +386,8 @@ class TinyGsmM590 | ||||
|           index = 5; | ||||
|           goto finish; | ||||
|         } else if (data.endsWith(GF("+TCPRECV:"))) { | ||||
|           int8_t  mux      = streamGetInt(','); | ||||
|           int16_t len      = streamGetInt(','); | ||||
|           int8_t  mux      = streamGetIntBefore(','); | ||||
|           int16_t len      = streamGetIntBefore(','); | ||||
|           int16_t len_orig = len; | ||||
|           if (len > sockets[mux]->rx.free()) { | ||||
|             DBG("### Buffer overflow: ", len, "->", sockets[mux]->rx.free()); | ||||
| @@ -402,7 +402,7 @@ class TinyGsmM590 | ||||
|           } | ||||
|           data = ""; | ||||
|         } else if (data.endsWith(GF("+TCPCLOSE:"))) { | ||||
|           int8_t mux = streamGetInt(','); | ||||
|           int8_t mux = streamGetIntBefore(','); | ||||
|           streamSkipUntil('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT) { | ||||
|             sockets[mux]->sock_connected = false; | ||||
|   | ||||
| @@ -386,9 +386,9 @@ class TinyGsmM95 | ||||
|     } | ||||
|     streamSkipUntil(',');  // Skip mode | ||||
|     // Read charge of thermistor | ||||
|     // milliVolts = streamGetInt(','); | ||||
|     // milliVolts = streamGetIntBefore(','); | ||||
|     streamSkipUntil(',');  // Skip thermistor charge | ||||
|     float temp = streamGetFloat('\n'); | ||||
|     float temp = streamGetFloatBefore('\n'); | ||||
|     // Wait for final OK | ||||
|     waitResponse(); | ||||
|     return temp; | ||||
| @@ -427,7 +427,7 @@ class TinyGsmM95 | ||||
|     //     streamSkipUntil(',');  // Skip total length sent on connection | ||||
|     //     streamSkipUntil(',');  // Skip length already acknowledged by remote | ||||
|     //     // Make sure the total length un-acknowledged is 0 | ||||
|     //     if ( streamGetInt('\n') == 0 ) { | ||||
|     //     if ( streamGetIntBefore('\n') == 0 ) { | ||||
|     //       allAcknowledged = true; | ||||
|     //     } | ||||
|     //   } | ||||
| @@ -453,7 +453,7 @@ class TinyGsmM95 | ||||
|       streamSkipUntil(',');  // skip port | ||||
|       streamSkipUntil(',');  // skip connection type (TCP/UDP) | ||||
|       // read the real length of the retrieved data | ||||
|       uint16_t len = streamGetInt('\n'); | ||||
|       uint16_t len = streamGetIntBefore('\n'); | ||||
|       // We have no way of knowing in advance how much data will be in the | ||||
|       // buffer so when data is received we always assume the buffer is | ||||
|       // completely full. Chances are, this is not true and there's really not | ||||
| @@ -485,12 +485,12 @@ class TinyGsmM95 | ||||
|  | ||||
|     if (waitResponse(GF("+QISTATE:")) != 1) { return false; } | ||||
|  | ||||
|     streamSkipUntil(',');            // Skip mux | ||||
|     streamSkipUntil(',');            // Skip socket type | ||||
|     streamSkipUntil(',');            // Skip remote ip | ||||
|     streamSkipUntil(',');            // Skip remote port | ||||
|     streamSkipUntil(',');            // Skip local port | ||||
|     int8_t res = streamGetInt(',');  // socket state | ||||
|     streamSkipUntil(',');                  // Skip mux | ||||
|     streamSkipUntil(',');                  // Skip socket type | ||||
|     streamSkipUntil(',');                  // Skip remote ip | ||||
|     streamSkipUntil(',');                  // Skip remote port | ||||
|     streamSkipUntil(',');                  // Skip local port | ||||
|     int8_t res = streamGetIntBefore(',');  // socket state | ||||
|  | ||||
|     waitResponse(); | ||||
|  | ||||
| @@ -545,7 +545,7 @@ class TinyGsmM95 | ||||
|         } else if (data.endsWith(GF(GSM_NL "+QIRDI:"))) { | ||||
|           streamSkipUntil(',');  // Skip the context | ||||
|           streamSkipUntil(',');  // Skip the role | ||||
|           int8_t mux = streamGetInt('\n'); | ||||
|           int8_t mux = streamGetIntBefore('\n'); | ||||
|           DBG("### Got Data:", mux); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             // We have no way of knowing how much data actually came in, so | ||||
|   | ||||
| @@ -386,13 +386,13 @@ class TinyGsmMC60 | ||||
|       } else { | ||||
|         streamSkipUntil(','); /** Skip total */ | ||||
|         streamSkipUntil(','); /** Skip acknowledged data size */ | ||||
|         if (streamGetInt('\n') == 0) { allAcknowledged = true; } | ||||
|         if (streamGetIntBefore('\n') == 0) { allAcknowledged = true; } | ||||
|       } | ||||
|     } | ||||
|     waitResponse(5000L); | ||||
|  | ||||
|     // streamSkipUntil(','); // Skip mux | ||||
|     // return streamGetInt('\n'); | ||||
|     // return streamGetIntBefore('\n'); | ||||
|  | ||||
|     return len;  // TODO(?): verify len/ack | ||||
|   } | ||||
| @@ -413,7 +413,7 @@ class TinyGsmMC60 | ||||
|       streamSkipUntil(',');  // skip port | ||||
|       streamSkipUntil(',');  // skip connection type (TCP/UDP) | ||||
|       // read the real length of the retrieved data | ||||
|       uint16_t len = streamGetInt('\n'); | ||||
|       uint16_t len = streamGetIntBefore('\n'); | ||||
|       // It's possible that the real length available is less than expected | ||||
|       // This is quite likely if the buffer is broken into packets - which may | ||||
|       // be different sizes. | ||||
| @@ -444,12 +444,12 @@ class TinyGsmMC60 | ||||
|  | ||||
|     if (waitResponse(GF("+QISTATE:")) != 1) { return false; } | ||||
|  | ||||
|     streamSkipUntil(',');            // Skip mux | ||||
|     streamSkipUntil(',');            // Skip socket type | ||||
|     streamSkipUntil(',');            // Skip remote ip | ||||
|     streamSkipUntil(',');            // Skip remote port | ||||
|     streamSkipUntil(',');            // Skip local port | ||||
|     int8_t res = streamGetInt(',');  // socket state | ||||
|     streamSkipUntil(',');                  // Skip mux | ||||
|     streamSkipUntil(',');                  // Skip socket type | ||||
|     streamSkipUntil(',');                  // Skip remote ip | ||||
|     streamSkipUntil(',');                  // Skip remote port | ||||
|     streamSkipUntil(',');                  // Skip local port | ||||
|     int8_t res = streamGetIntBefore(',');  // socket state | ||||
|  | ||||
|     waitResponse(); | ||||
|  | ||||
| @@ -512,11 +512,11 @@ class TinyGsmMC60 | ||||
|           streamSkipUntil(',');  // Skip the context | ||||
|           streamSkipUntil(',');  // Skip the role | ||||
|           // read the connection id | ||||
|           int8_t mux = streamGetInt(','); | ||||
|           int8_t mux = streamGetIntBefore(','); | ||||
|           // read the number of packets in the buffer | ||||
|           int8_t num_packets = streamGetInt(','); | ||||
|           int8_t num_packets = streamGetIntBefore(','); | ||||
|           // read the length of the current packet | ||||
|           int16_t len_packet = streamGetInt('\n'); | ||||
|           int16_t len_packet = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             sockets[mux]->sock_available = len_packet * num_packets; | ||||
|           } | ||||
|   | ||||
| @@ -428,7 +428,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>, | ||||
|     streamSkipUntil(',');  // Skip battery charge status | ||||
|     streamSkipUntil(',');  // Skip battery charge level | ||||
|     // get voltage in VOLTS | ||||
|     float voltage = streamGetFloat('\n'); | ||||
|     float voltage = streamGetFloatBefore('\n'); | ||||
|     // Wait for final OK | ||||
|     waitResponse(); | ||||
|     // Return millivolts | ||||
| @@ -441,10 +441,10 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>, | ||||
|                         uint16_t& milliVolts) { | ||||
|     sendAT(GF("+CBC")); | ||||
|     if (waitResponse(GF(GSM_NL "+CBC:")) != 1) { return false; } | ||||
|     chargeState = streamGetInt(','); | ||||
|     percent     = streamGetInt(','); | ||||
|     chargeState = streamGetIntBefore(','); | ||||
|     percent     = streamGetIntBefore(','); | ||||
|     // get voltage in VOLTS | ||||
|     float voltage = streamGetFloat('\n'); | ||||
|     float voltage = streamGetFloatBefore('\n'); | ||||
|     milliVolts    = voltage * 1000; | ||||
|     // Wait for final OK | ||||
|     waitResponse(); | ||||
| @@ -463,7 +463,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>, | ||||
|     // Get Temparature Value | ||||
|     sendAT(GF("+CMTE?")); | ||||
|     if (waitResponse(GF(GSM_NL "+CMTE:")) != 1) { return false; } | ||||
|     float res = streamGetFloat('\n'); | ||||
|     float res = streamGetFloatBefore('\n'); | ||||
|     // Wait for final OK | ||||
|     waitResponse(); | ||||
|     return res; | ||||
| @@ -498,7 +498,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>, | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     streamSkipUntil(',');  // Skip requested bytes to send | ||||
|     // TODO(?):  make sure requested and confirmed bytes match | ||||
|     return streamGetInt('\n'); | ||||
|     return streamGetIntBefore('\n'); | ||||
|   } | ||||
|  | ||||
|   size_t modemRead(size_t size, uint8_t mux) { | ||||
| @@ -511,9 +511,9 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>, | ||||
| #endif | ||||
|     streamSkipUntil(',');  // Skip Rx mode 2/normal or 3/HEX | ||||
|     streamSkipUntil(',');  // Skip mux/cid (connecion id) | ||||
|     int16_t len_requested = streamGetInt(','); | ||||
|     int16_t len_requested = streamGetIntBefore(','); | ||||
|     //  ^^ Requested number of data bytes (1-1460 bytes)to be read | ||||
|     int16_t len_confirmed = streamGetInt('\n'); | ||||
|     int16_t len_confirmed = streamGetIntBefore('\n'); | ||||
|     // ^^ The data length which not read in the buffer | ||||
|     for (int i = 0; i < len_requested; i++) { | ||||
|       uint32_t startMillis = millis(); | ||||
| @@ -550,7 +550,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>, | ||||
|     if (waitResponse(GF("+CIPRXGET:")) == 1) { | ||||
|       streamSkipUntil(',');  // Skip mode 4 | ||||
|       streamSkipUntil(',');  // Skip mux | ||||
|       result = streamGetInt('\n'); | ||||
|       result = streamGetIntBefore('\n'); | ||||
|       waitResponse(); | ||||
|     } | ||||
|     DBG("### Available:", result, "on", mux); | ||||
| @@ -615,9 +615,9 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>, | ||||
|           index = 5; | ||||
|           goto finish; | ||||
|         } else if (data.endsWith(GF(GSM_NL "+CIPRXGET:"))) { | ||||
|           int8_t mode = streamGetInt(','); | ||||
|           int8_t mode = streamGetIntBefore(','); | ||||
|           if (mode == 1) { | ||||
|             int8_t mux = streamGetInt('\n'); | ||||
|             int8_t mux = streamGetIntBefore('\n'); | ||||
|             if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|               sockets[mux]->got_data = true; | ||||
|             } | ||||
| @@ -627,8 +627,8 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>, | ||||
|             data += mode; | ||||
|           } | ||||
|         } else if (data.endsWith(GF(GSM_NL "+RECEIVE:"))) { | ||||
|           int8_t  mux = streamGetInt(','); | ||||
|           int16_t len = streamGetInt('\n'); | ||||
|           int8_t  mux = streamGetIntBefore(','); | ||||
|           int16_t len = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             sockets[mux]->got_data       = true; | ||||
|             sockets[mux]->sock_available = len; | ||||
| @@ -636,7 +636,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>, | ||||
|           data = ""; | ||||
|           DBG("### Got Data:", len, "on", mux); | ||||
|         } else if (data.endsWith(GF("+IPCLOSE:"))) { | ||||
|           int8_t mux = streamGetInt(','); | ||||
|           int8_t mux = streamGetIntBefore(','); | ||||
|           streamSkipUntil('\n');  // Skip the reason code | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             sockets[mux]->sock_connected = false; | ||||
|   | ||||
| @@ -425,8 +425,8 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, | ||||
|     sendAT(GF("+CGNSINF")); | ||||
|     if (waitResponse(10000L, GF(GSM_NL "+CGNSINF:")) != 1) { return false; } | ||||
|  | ||||
|     streamSkipUntil(',');          // GNSS run status | ||||
|     if (streamGetInt(',') == 1) {  // fix status | ||||
|     streamSkipUntil(',');                // GNSS run status | ||||
|     if (streamGetIntBefore(',') == 1) {  // fix status | ||||
|       // init variables | ||||
|       float ilat         = 0; | ||||
|       float ilon         = 0; | ||||
| @@ -443,31 +443,32 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, | ||||
|       float secondWithSS = 0; | ||||
|  | ||||
|       // UTC date & Time | ||||
|       iyear        = streamGetInt(static_cast<int8_t>(4));  // Four digit year | ||||
|       imonth       = streamGetInt(static_cast<int8_t>(2));  // Two digit month | ||||
|       iday         = streamGetInt(static_cast<int8_t>(2));  // Two digit day | ||||
|       ihour        = streamGetInt(static_cast<int8_t>(2));  // Two digit hour | ||||
|       imin         = streamGetInt(static_cast<int8_t>(2));  // Two digit minute | ||||
|       secondWithSS = streamGetFloat(',');  // 6 digit second with subseconds | ||||
|       iyear  = streamGetIntLength(4);  // Four digit year | ||||
|       imonth = streamGetIntLength(2);  // Two digit month | ||||
|       iday   = streamGetIntLength(2);  // Two digit day | ||||
|       ihour  = streamGetIntLength(2);  // Two digit hour | ||||
|       imin   = streamGetIntLength(2);  // Two digit minute | ||||
|       secondWithSS = | ||||
|           streamGetFloatBefore(',');  // 6 digit second with subseconds | ||||
|  | ||||
|       ilat   = streamGetFloat(',');     // Latitude | ||||
|       ilon   = streamGetFloat(',');     // Longitude | ||||
|       ialt   = streamGetFloat(',');     // MSL Altitude. Unit is meters | ||||
|       ispeed = streamGetFloat(',');     // Speed Over Ground. Unit is knots. | ||||
|       streamSkipUntil(',');             // Course Over Ground. Degrees. | ||||
|       streamSkipUntil(',');             // Fix Mode | ||||
|       streamSkipUntil(',');             // Reserved1 | ||||
|       streamSkipUntil(',');             // Horizontal Dilution Of Precision | ||||
|       iaccuracy = streamGetFloat(',');  // Position Dilution Of Precision | ||||
|       streamSkipUntil(',');             // Vertical Dilution Of Precision | ||||
|       streamSkipUntil(',');             // Reserved2 | ||||
|       ivsat = streamGetInt(',');        // GNSS Satellites in View | ||||
|       iusat = streamGetInt(',');        // GNSS Satellites Used | ||||
|       streamSkipUntil(',');             // GLONASS Satellites Used | ||||
|       streamSkipUntil(',');             // Reserved3 | ||||
|       streamSkipUntil(',');             // C/N0 max | ||||
|       streamSkipUntil(',');             // HPA | ||||
|       streamSkipUntil('\n');            // VPA | ||||
|       ilat   = streamGetFloatBefore(',');  // Latitude | ||||
|       ilon   = streamGetFloatBefore(',');  // Longitude | ||||
|       ialt   = streamGetFloatBefore(',');  // MSL Altitude. Unit is meters | ||||
|       ispeed = streamGetFloatBefore(',');  // Speed Over Ground. Unit is knots. | ||||
|       streamSkipUntil(',');                // Course Over Ground. Degrees. | ||||
|       streamSkipUntil(',');                // Fix Mode | ||||
|       streamSkipUntil(',');                // Reserved1 | ||||
|       streamSkipUntil(',');                // Horizontal Dilution Of Precision | ||||
|       iaccuracy = streamGetFloatBefore(',');  // Position Dilution Of Precision | ||||
|       streamSkipUntil(',');                   // Vertical Dilution Of Precision | ||||
|       streamSkipUntil(',');                   // Reserved2 | ||||
|       ivsat = streamGetIntBefore(',');        // GNSS Satellites in View | ||||
|       iusat = streamGetIntBefore(',');        // GNSS Satellites Used | ||||
|       streamSkipUntil(',');                   // GLONASS Satellites Used | ||||
|       streamSkipUntil(',');                   // Reserved3 | ||||
|       streamSkipUntil(',');                   // C/N0 max | ||||
|       streamSkipUntil(',');                   // HPA | ||||
|       streamSkipUntil('\n');                  // VPA | ||||
|  | ||||
|       // Set pointers | ||||
|       if (lat != NULL) *lat = ilat; | ||||
| @@ -530,7 +531,7 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, | ||||
|     stream.flush(); | ||||
|     if (waitResponse(GF(GSM_NL "DATA ACCEPT:")) != 1) { return 0; } | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     return streamGetInt('\n'); | ||||
|     return streamGetIntBefore('\n'); | ||||
|   } | ||||
|  | ||||
|   size_t modemRead(size_t size, uint8_t mux) { | ||||
| @@ -543,9 +544,9 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, | ||||
| #endif | ||||
|     streamSkipUntil(',');  // Skip Rx mode 2/normal or 3/HEX | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     int16_t len_requested = streamGetInt(','); | ||||
|     int16_t len_requested = streamGetIntBefore(','); | ||||
|     //  ^^ Requested number of data bytes (1-1460 bytes)to be read | ||||
|     int16_t len_confirmed = streamGetInt('\n'); | ||||
|     int16_t len_confirmed = streamGetIntBefore('\n'); | ||||
|     // ^^ Confirmed number of data bytes to be read, which may be less than | ||||
|     // requested. 0 indicates that no data can be read. This is actually be the | ||||
|     // number of bytes that will be remaining after the read | ||||
| @@ -584,7 +585,7 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, | ||||
|     if (waitResponse(GF("+CIPRXGET:")) == 1) { | ||||
|       streamSkipUntil(',');  // Skip mode 4 | ||||
|       streamSkipUntil(',');  // Skip mux | ||||
|       result = streamGetInt('\n'); | ||||
|       result = streamGetIntBefore('\n'); | ||||
|       waitResponse(); | ||||
|     } | ||||
|     DBG("### Available:", result, "on", mux); | ||||
| @@ -645,9 +646,9 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, | ||||
|           index = 5; | ||||
|           goto finish; | ||||
|         } else if (data.endsWith(GF(GSM_NL "+CIPRXGET:"))) { | ||||
|           int8_t mode = streamGetInt(','); | ||||
|           int8_t mode = streamGetIntBefore(','); | ||||
|           if (mode == 1) { | ||||
|             int8_t mux = streamGetInt('\n'); | ||||
|             int8_t mux = streamGetIntBefore('\n'); | ||||
|             if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|               sockets[mux]->got_data = true; | ||||
|             } | ||||
| @@ -657,8 +658,8 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, | ||||
|             data += mode; | ||||
|           } | ||||
|         } else if (data.endsWith(GF(GSM_NL "+RECEIVE:"))) { | ||||
|           int8_t  mux = streamGetInt(','); | ||||
|           int16_t len = streamGetInt('\n'); | ||||
|           int8_t  mux = streamGetIntBefore(','); | ||||
|           int16_t len = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             sockets[mux]->got_data       = true; | ||||
|             sockets[mux]->sock_available = len; | ||||
|   | ||||
| @@ -436,8 +436,8 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
|     sendAT(GF("+CGNSSINFO")); | ||||
|     if (waitResponse(GF(GSM_NL "+CGNSSINFO:")) != 1) { return false; } | ||||
|  | ||||
|     uint8_t fixMode = streamGetInt(',');  // mode 2=2D Fix or 3=3DFix | ||||
|                                           // TODO(?) Can 1 be returned | ||||
|     uint8_t fixMode = streamGetIntBefore(',');  // mode 2=2D Fix or 3=3DFix | ||||
|                                                 // TODO(?) Can 1 be returned | ||||
|     if (fixMode == 1 || fixMode == 2 || fixMode == 3) { | ||||
|       // init variables | ||||
|       float ilat         = 0; | ||||
| @@ -454,32 +454,33 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
|       int   imin         = 0; | ||||
|       float secondWithSS = 0; | ||||
|  | ||||
|       streamSkipUntil(',');        // GPS satellite valid numbers | ||||
|       streamSkipUntil(',');        // GLONASS satellite valid numbers | ||||
|       streamSkipUntil(',');        // BEIDOU satellite valid numbers | ||||
|       ilat = streamGetFloat(',');  // Latitude | ||||
|       streamSkipUntil(',');        // N/S Indicator, N=north or S=south | ||||
|       ilon = streamGetFloat(',');  // Longitude | ||||
|       streamSkipUntil(',');        // E/W Indicator, E=east or W=west | ||||
|       streamSkipUntil(',');              // GPS satellite valid numbers | ||||
|       streamSkipUntil(',');              // GLONASS satellite valid numbers | ||||
|       streamSkipUntil(',');              // BEIDOU satellite valid numbers | ||||
|       ilat = streamGetFloatBefore(',');  // Latitude | ||||
|       streamSkipUntil(',');              // N/S Indicator, N=north or S=south | ||||
|       ilon = streamGetFloatBefore(',');  // Longitude | ||||
|       streamSkipUntil(',');              // E/W Indicator, E=east or W=west | ||||
|  | ||||
|       // Date. Output format is ddmmyy | ||||
|       iday   = streamGetInt(static_cast<int8_t>(2));  // Two digit day | ||||
|       imonth = streamGetInt(static_cast<int8_t>(2));  // Two digit month | ||||
|       iyear  = streamGetInt(',');                     // Two digit year | ||||
|       iday   = streamGetIntLength(2);    // Two digit day | ||||
|       imonth = streamGetIntLength(2);    // Two digit month | ||||
|       iyear  = streamGetIntBefore(',');  // Two digit year | ||||
|  | ||||
|       // UTC Time. Output format is hhmmss.s | ||||
|       ihour        = streamGetInt(static_cast<int8_t>(2));  // Two digit hour | ||||
|       imin         = streamGetInt(static_cast<int8_t>(2));  // Two digit minute | ||||
|       secondWithSS = streamGetFloat(',');  // 4 digit second with subseconds | ||||
|       ihour = streamGetIntLength(2);  // Two digit hour | ||||
|       imin  = streamGetIntLength(2);  // Two digit minute | ||||
|       secondWithSS = | ||||
|           streamGetFloatBefore(',');  // 4 digit second with subseconds | ||||
|  | ||||
|       ialt   = streamGetFloat(',');  // MSL Altitude. Unit is meters | ||||
|       ispeed = streamGetFloat(',');  // Speed Over Ground. Unit is knots. | ||||
|       streamSkipUntil(',');          // Course Over Ground. Degrees. | ||||
|       ialt   = streamGetFloatBefore(',');  // MSL Altitude. Unit is meters | ||||
|       ispeed = streamGetFloatBefore(',');  // Speed Over Ground. Unit is knots. | ||||
|       streamSkipUntil(',');                // Course Over Ground. Degrees. | ||||
|       streamSkipUntil(',');  // After set, will report GPS every x seconds | ||||
|       iaccuracy = streamGetFloat(',');  // Position Dilution Of Precision | ||||
|       streamSkipUntil(',');             // Horizontal Dilution Of Precision | ||||
|       streamSkipUntil(',');             // Vertical Dilution Of Precision | ||||
|       streamSkipUntil('\n');            // TODO(?) is one more field reported?? | ||||
|       iaccuracy = streamGetFloatBefore(',');  // Position Dilution Of Precision | ||||
|       streamSkipUntil(',');   // Horizontal Dilution Of Precision | ||||
|       streamSkipUntil(',');   // Vertical Dilution Of Precision | ||||
|       streamSkipUntil('\n');  // TODO(?) is one more field reported?? | ||||
|  | ||||
|       // Set pointers | ||||
|       if (lat != NULL) *lat = ilat; | ||||
| @@ -521,7 +522,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
|     if (waitResponse(GF(GSM_NL "+CBC:")) != 1) { return 0; } | ||||
|  | ||||
|     // get voltage in VOLTS | ||||
|     float voltage = streamGetFloat('\n'); | ||||
|     float voltage = streamGetFloatBefore('\n'); | ||||
|     // Wait for final OK | ||||
|     waitResponse(); | ||||
|     // Return millivolts | ||||
| @@ -550,7 +551,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
|     sendAT(GF("+CPMUTEMP")); | ||||
|     if (waitResponse(GF(GSM_NL "+CPMUTEMP:")) != 1) { return 0; } | ||||
|     // return temperature in C | ||||
|     uint16_t res = streamGetInt('\n'); | ||||
|     uint16_t res = streamGetIntBefore('\n'); | ||||
|     // Wait for final OK | ||||
|     waitResponse(); | ||||
|     return res; | ||||
| @@ -585,7 +586,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     streamSkipUntil(',');  // Skip requested bytes to send | ||||
|     // TODO(?):  make sure requested and confirmed bytes match | ||||
|     return streamGetInt('\n'); | ||||
|     return streamGetIntBefore('\n'); | ||||
|   } | ||||
|  | ||||
|   size_t modemRead(size_t size, uint8_t mux) { | ||||
| @@ -598,9 +599,9 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
| #endif | ||||
|     streamSkipUntil(',');  // Skip Rx mode 2/normal or 3/HEX | ||||
|     streamSkipUntil(',');  // Skip mux/cid (connecion id) | ||||
|     int16_t len_requested = streamGetInt(','); | ||||
|     int16_t len_requested = streamGetIntBefore(','); | ||||
|     //  ^^ Requested number of data bytes (1-1460 bytes)to be read | ||||
|     int16_t len_confirmed = streamGetInt('\n'); | ||||
|     int16_t len_confirmed = streamGetIntBefore('\n'); | ||||
|     // ^^ The data length which not read in the buffer | ||||
|     for (int i = 0; i < len_requested; i++) { | ||||
|       uint32_t startMillis = millis(); | ||||
| @@ -637,7 +638,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
|     if (waitResponse(GF("+CIPRXGET:")) == 1) { | ||||
|       streamSkipUntil(',');  // Skip mode 4 | ||||
|       streamSkipUntil(',');  // Skip mux | ||||
|       result = streamGetInt('\n'); | ||||
|       result = streamGetIntBefore('\n'); | ||||
|       waitResponse(); | ||||
|     } | ||||
|     DBG("### Available:", result, "on", mux); | ||||
| @@ -704,9 +705,9 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
|           index = 5; | ||||
|           goto finish; | ||||
|         } else if (data.endsWith(GF(GSM_NL "+CIPRXGET:"))) { | ||||
|           int8_t mode = streamGetInt(','); | ||||
|           int8_t mode = streamGetIntBefore(','); | ||||
|           if (mode == 1) { | ||||
|             int8_t mux = streamGetInt('\n'); | ||||
|             int8_t mux = streamGetIntBefore('\n'); | ||||
|             if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|               sockets[mux]->got_data = true; | ||||
|             } | ||||
| @@ -716,8 +717,8 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
|             data += mode; | ||||
|           } | ||||
|         } else if (data.endsWith(GF(GSM_NL "+RECEIVE:"))) { | ||||
|           int8_t  mux = streamGetInt(','); | ||||
|           int16_t len = streamGetInt('\n'); | ||||
|           int8_t  mux = streamGetIntBefore(','); | ||||
|           int16_t len = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             sockets[mux]->got_data       = true; | ||||
|             sockets[mux]->sock_available = len; | ||||
| @@ -725,7 +726,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
|           data = ""; | ||||
|           DBG("### Got Data:", len, "on", mux); | ||||
|         } else if (data.endsWith(GF("+IPCLOSE:"))) { | ||||
|           int8_t mux = streamGetInt(','); | ||||
|           int8_t mux = streamGetIntBefore(','); | ||||
|           streamSkipUntil('\n');  // Skip the reason code | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             sockets[mux]->sock_connected = false; | ||||
|   | ||||
| @@ -503,7 +503,7 @@ class TinyGsmSim800 | ||||
|     stream.flush(); | ||||
|     if (waitResponse(GF(GSM_NL "DATA ACCEPT:")) != 1) { return 0; } | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     return streamGetInt('\n'); | ||||
|     return streamGetIntBefore('\n'); | ||||
|   } | ||||
|  | ||||
|   size_t modemRead(size_t size, uint8_t mux) { | ||||
| @@ -516,9 +516,9 @@ class TinyGsmSim800 | ||||
| #endif | ||||
|     streamSkipUntil(',');  // Skip Rx mode 2/normal or 3/HEX | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     int16_t len_requested = streamGetInt(','); | ||||
|     int16_t len_requested = streamGetIntBefore(','); | ||||
|     //  ^^ Requested number of data bytes (1-1460 bytes)to be read | ||||
|     int16_t len_confirmed = streamGetInt('\n'); | ||||
|     int16_t len_confirmed = streamGetIntBefore('\n'); | ||||
|     // ^^ Confirmed number of data bytes to be read, which may be less than | ||||
|     // requested. 0 indicates that no data can be read. This is actually be the | ||||
|     // number of bytes that will be remaining after the read | ||||
| @@ -557,7 +557,7 @@ class TinyGsmSim800 | ||||
|     if (waitResponse(GF("+CIPRXGET:")) == 1) { | ||||
|       streamSkipUntil(',');  // Skip mode 4 | ||||
|       streamSkipUntil(',');  // Skip mux | ||||
|       result = streamGetInt('\n'); | ||||
|       result = streamGetIntBefore('\n'); | ||||
|       waitResponse(); | ||||
|     } | ||||
|     DBG("### Available:", result, "on", mux); | ||||
| @@ -620,9 +620,9 @@ class TinyGsmSim800 | ||||
|           index = 5; | ||||
|           goto finish; | ||||
|         } else if (data.endsWith(GF(GSM_NL "+CIPRXGET:"))) { | ||||
|           int8_t mode = streamGetInt(','); | ||||
|           int8_t mode = streamGetIntBefore(','); | ||||
|           if (mode == 1) { | ||||
|             int8_t mux = streamGetInt('\n'); | ||||
|             int8_t mux = streamGetIntBefore('\n'); | ||||
|             if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|               sockets[mux]->got_data = true; | ||||
|             } | ||||
| @@ -632,8 +632,8 @@ class TinyGsmSim800 | ||||
|             data += mode; | ||||
|           } | ||||
|         } else if (data.endsWith(GF(GSM_NL "+RECEIVE:"))) { | ||||
|           int8_t  mux = streamGetInt(','); | ||||
|           int16_t len = streamGetInt('\n'); | ||||
|           int8_t  mux = streamGetIntBefore(','); | ||||
|           int16_t len = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             sockets[mux]->got_data       = true; | ||||
|             sockets[mux]->sock_available = len; | ||||
|   | ||||
| @@ -57,8 +57,8 @@ class TinyGsmSim808 : public TinyGsmSim800, public TinyGsmGPS<TinyGsmSim808> { | ||||
|     sendAT(GF("+CGNSINF")); | ||||
|     if (waitResponse(10000L, GF(GSM_NL "+CGNSINF:")) != 1) { return false; } | ||||
|  | ||||
|     streamSkipUntil(',');          // GNSS run status | ||||
|     if (streamGetInt(',') == 1) {  // fix status | ||||
|     streamSkipUntil(',');                // GNSS run status | ||||
|     if (streamGetIntBefore(',') == 1) {  // fix status | ||||
|       // init variables | ||||
|       float ilat         = 0; | ||||
|       float ilon         = 0; | ||||
| @@ -75,31 +75,32 @@ class TinyGsmSim808 : public TinyGsmSim800, public TinyGsmGPS<TinyGsmSim808> { | ||||
|       float secondWithSS = 0; | ||||
|  | ||||
|       // UTC date & Time | ||||
|       iyear        = streamGetInt(static_cast<int8_t>(4));  // Four digit year | ||||
|       imonth       = streamGetInt(static_cast<int8_t>(2));  // Two digit month | ||||
|       iday         = streamGetInt(static_cast<int8_t>(2));  // Two digit day | ||||
|       ihour        = streamGetInt(static_cast<int8_t>(2));  // Two digit hour | ||||
|       imin         = streamGetInt(static_cast<int8_t>(2));  // Two digit minute | ||||
|       secondWithSS = streamGetFloat(',');  // 6 digit second with subseconds | ||||
|       iyear  = streamGetIntLength(4);  // Four digit year | ||||
|       imonth = streamGetIntLength(2);  // Two digit month | ||||
|       iday   = streamGetIntLength(2);  // Two digit day | ||||
|       ihour  = streamGetIntLength(2);  // Two digit hour | ||||
|       imin   = streamGetIntLength(2);  // Two digit minute | ||||
|       secondWithSS = | ||||
|           streamGetFloatBefore(',');  // 6 digit second with subseconds | ||||
|  | ||||
|       ilat   = streamGetFloat(',');     // Latitude | ||||
|       ilon   = streamGetFloat(',');     // Longitude | ||||
|       ialt   = streamGetFloat(',');     // MSL Altitude. Unit is meters | ||||
|       ispeed = streamGetFloat(',');     // Speed Over Ground. Unit is knots. | ||||
|       streamSkipUntil(',');             // Course Over Ground. Degrees. | ||||
|       streamSkipUntil(',');             // Fix Mode | ||||
|       streamSkipUntil(',');             // Reserved1 | ||||
|       streamSkipUntil(',');             // Horizontal Dilution Of Precision | ||||
|       iaccuracy = streamGetFloat(',');  // Position Dilution Of Precision | ||||
|       streamSkipUntil(',');             // Vertical Dilution Of Precision | ||||
|       streamSkipUntil(',');             // Reserved2 | ||||
|       ivsat = streamGetInt(',');        // GNSS Satellites in View | ||||
|       iusat = streamGetInt(',');        // GNSS Satellites Used | ||||
|       streamSkipUntil(',');             // GLONASS Satellites Used | ||||
|       streamSkipUntil(',');             // Reserved3 | ||||
|       streamSkipUntil(',');             // C/N0 max | ||||
|       streamSkipUntil(',');             // HPA | ||||
|       streamSkipUntil('\n');            // VPA | ||||
|       ilat   = streamGetFloatBefore(',');  // Latitude | ||||
|       ilon   = streamGetFloatBefore(',');  // Longitude | ||||
|       ialt   = streamGetFloatBefore(',');  // MSL Altitude. Unit is meters | ||||
|       ispeed = streamGetFloatBefore(',');  // Speed Over Ground. Unit is knots. | ||||
|       streamSkipUntil(',');                // Course Over Ground. Degrees. | ||||
|       streamSkipUntil(',');                // Fix Mode | ||||
|       streamSkipUntil(',');                // Reserved1 | ||||
|       streamSkipUntil(',');                // Horizontal Dilution Of Precision | ||||
|       iaccuracy = streamGetFloatBefore(',');  // Position Dilution Of Precision | ||||
|       streamSkipUntil(',');                   // Vertical Dilution Of Precision | ||||
|       streamSkipUntil(',');                   // Reserved2 | ||||
|       ivsat = streamGetIntBefore(',');        // GNSS Satellites in View | ||||
|       iusat = streamGetIntBefore(',');        // GNSS Satellites Used | ||||
|       streamSkipUntil(',');                   // GLONASS Satellites Used | ||||
|       streamSkipUntil(',');                   // Reserved3 | ||||
|       streamSkipUntil(',');                   // C/N0 max | ||||
|       streamSkipUntil(',');                   // HPA | ||||
|       streamSkipUntil('\n');                  // VPA | ||||
|  | ||||
|       // Set pointers | ||||
|       if (lat != NULL) *lat = ilat; | ||||
|   | ||||
| @@ -314,7 +314,7 @@ class TinyGsmSaraR4 | ||||
|     sendAT(GF("+CEREG?")); | ||||
|     if (waitResponse(GF(GSM_NL "+CEREG:")) != 1) { return REG_UNKNOWN; } | ||||
|     streamSkipUntil(','); /* Skip format (0) */ | ||||
|     int status = streamGetInt('\n'); | ||||
|     int status = streamGetIntBefore('\n'); | ||||
|     waitResponse(); | ||||
|  | ||||
|     // If we're connected on EPS, great! | ||||
| @@ -326,7 +326,7 @@ class TinyGsmSaraR4 | ||||
|       sendAT(GF("+CREG?")); | ||||
|       if (waitResponse(GF(GSM_NL "+CREG:")) != 1) { return REG_UNKNOWN; } | ||||
|       streamSkipUntil(','); /* Skip format (0) */ | ||||
|       status = streamGetInt('\n'); | ||||
|       status = streamGetIntBefore('\n'); | ||||
|       waitResponse(); | ||||
|       return (RegStatus)status; | ||||
|     } | ||||
| @@ -520,28 +520,31 @@ class TinyGsmSaraR4 | ||||
|     float secondWithSS = 0; | ||||
|  | ||||
|     // Date & Time | ||||
|     iday         = streamGetInt('/');    // Two digit day | ||||
|     imonth       = streamGetInt('/');    // Two digit month | ||||
|     iyear        = streamGetInt(',');    // Four digit year | ||||
|     ihour        = streamGetInt(':');    // Two digit hour | ||||
|     imin         = streamGetInt(':');    // Two digit minute | ||||
|     secondWithSS = streamGetFloat(',');  // 6 digit second with subseconds | ||||
|     iday         = streamGetIntBefore('/');    // Two digit day | ||||
|     imonth       = streamGetIntBefore('/');    // Two digit month | ||||
|     iyear        = streamGetIntBefore(',');    // Four digit year | ||||
|     ihour        = streamGetIntBefore(':');    // Two digit hour | ||||
|     imin         = streamGetIntBefore(':');    // Two digit minute | ||||
|     secondWithSS = streamGetFloatBefore(',');  // 6 digit second with subseconds | ||||
|  | ||||
|     ilat = streamGetFloat(',');  // Estimated latitude, in degrees | ||||
|     ilon = streamGetFloat(',');  // Estimated longitude, in degrees | ||||
|     ialt = streamGetFloat(',');  // Estimated altitude, in meters - only forGNSS | ||||
|                                  // positioning, 0 in case of CellLocate | ||||
|     if (ialt != 0) {             // values not returned for CellLocate | ||||
|       iaccuracy = streamGetFloat(',');  // Maximum possible error, in meters | ||||
|       ispeed    = streamGetFloat(',');  // Speed over ground m/s3 | ||||
|     ilat = streamGetFloatBefore(',');  // Estimated latitude, in degrees | ||||
|     ilon = streamGetFloatBefore(',');  // Estimated longitude, in degrees | ||||
|     ialt = streamGetFloatBefore( | ||||
|         ',');         // Estimated altitude, in meters - only forGNSS | ||||
|                       // positioning, 0 in case of CellLocate | ||||
|     if (ialt != 0) {  // values not returned for CellLocate | ||||
|       iaccuracy = | ||||
|           streamGetFloatBefore(',');       // Maximum possible error, in meters | ||||
|       ispeed = streamGetFloatBefore(',');  // Speed over ground m/s3 | ||||
|       streamSkipUntil(',');  // Course over ground in degree (0 deg - 360 deg) | ||||
|       streamSkipUntil(',');  // Vertical accuracy, in meters | ||||
|       streamSkipUntil(',');  // Sensor used for the position calculation | ||||
|       iusat = streamGetInt(',');  // Number of satellite used | ||||
|       streamSkipUntil(',');       // Antenna status | ||||
|       streamSkipUntil('\n');      // Jamming status | ||||
|       iusat = streamGetIntBefore(',');  // Number of satellite used | ||||
|       streamSkipUntil(',');             // Antenna status | ||||
|       streamSkipUntil('\n');            // Jamming status | ||||
|     } else { | ||||
|       iaccuracy = streamGetFloat('\n');  // Maximum possible error, in meters | ||||
|       iaccuracy = | ||||
|           streamGetFloatBefore('\n');  // Maximum possible error, in meters | ||||
|     } | ||||
|  | ||||
|     // Set pointers | ||||
| @@ -594,7 +597,7 @@ class TinyGsmSaraR4 | ||||
|     sendAT(GF("+CIND?")); | ||||
|     if (waitResponse(GF(GSM_NL "+CIND:")) != 1) { return 0; } | ||||
|  | ||||
|     int8_t res     = streamGetInt(','); | ||||
|     int8_t res     = streamGetIntBefore(','); | ||||
|     int8_t percent = res * 20;  // return is 0-5 | ||||
|     // Wait for final OK | ||||
|     waitResponse(); | ||||
| @@ -623,7 +626,7 @@ class TinyGsmSaraR4 | ||||
|     if (waitResponse(GF(GSM_NL "+UTEMP:")) != 1) { | ||||
|       return static_cast<float>(-9999); | ||||
|     } | ||||
|     int16_t res  = streamGetInt('\n'); | ||||
|     int16_t res  = streamGetIntBefore('\n'); | ||||
|     float   temp = -9999; | ||||
|     if (res != -1) { temp = (static_cast<float>(res)) / 10; } | ||||
|     return temp; | ||||
| @@ -642,7 +645,7 @@ class TinyGsmSaraR4 | ||||
|     sendAT(GF("+USOCR=6")); | ||||
|     // reply is +USOCR: ## of socket created | ||||
|     if (waitResponse(GF(GSM_NL "+USOCR:")) != 1) { return false; } | ||||
|     *mux = streamGetInt('\n'); | ||||
|     *mux = streamGetIntBefore('\n'); | ||||
|     waitResponse(); | ||||
|  | ||||
|     if (ssl) { | ||||
| @@ -676,8 +679,8 @@ class TinyGsmSaraR4 | ||||
|       sendAT(GF("+USOCO="), *mux, ",\"", host, "\",", port, ",1"); | ||||
|       if (waitResponse(timeout_ms - (millis() - startMillis), | ||||
|                        GF(GSM_NL "+UUSOCO:")) == 1) { | ||||
|         streamGetInt(',');  // skip repeated mux | ||||
|         int8_t connection_status = streamGetInt('\n'); | ||||
|         streamGetIntBefore(',');  // skip repeated mux | ||||
|         int8_t connection_status = streamGetIntBefore('\n'); | ||||
|         DBG("### Waited", millis() - startMillis, "ms for socket to open"); | ||||
|         return (0 == connection_status); | ||||
|       } else { | ||||
| @@ -702,7 +705,7 @@ class TinyGsmSaraR4 | ||||
|     stream.flush(); | ||||
|     if (waitResponse(GF(GSM_NL "+USOWR:")) != 1) { return 0; } | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     int16_t sent = streamGetInt('\n'); | ||||
|     int16_t sent = streamGetIntBefore('\n'); | ||||
|     waitResponse();  // sends back OK after the confirmation of number sent | ||||
|     return sent; | ||||
|   } | ||||
| @@ -711,7 +714,7 @@ class TinyGsmSaraR4 | ||||
|     sendAT(GF("+USORD="), mux, ',', (uint16_t)size); | ||||
|     if (waitResponse(GF(GSM_NL "+USORD:")) != 1) { return 0; } | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     int16_t len = streamGetInt(','); | ||||
|     int16_t len = streamGetIntBefore(','); | ||||
|     streamSkipUntil('\"'); | ||||
|  | ||||
|     for (int i = 0; i < len; i++) { moveCharFromStreamToFifo(mux); } | ||||
| @@ -731,7 +734,7 @@ class TinyGsmSaraR4 | ||||
|     // that you have already told to close | ||||
|     if (res == 1) { | ||||
|       streamSkipUntil(',');  // Skip mux | ||||
|       result = streamGetInt('\n'); | ||||
|       result = streamGetIntBefore('\n'); | ||||
|       // if (result) DBG("### DATA AVAILABLE:", result, "on", mux); | ||||
|       waitResponse(); | ||||
|     } | ||||
| @@ -748,7 +751,7 @@ class TinyGsmSaraR4 | ||||
|  | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     streamSkipUntil(',');  // Skip type | ||||
|     int8_t result = streamGetInt('\n'); | ||||
|     int8_t result = streamGetIntBefore('\n'); | ||||
|     // 0: the socket is in INACTIVE status (it corresponds to CLOSED status | ||||
|     // defined in RFC793 "TCP Protocol Specification" [112]) | ||||
|     // 1: the socket is in LISTEN status | ||||
| @@ -810,8 +813,8 @@ class TinyGsmSaraR4 | ||||
|           index = 5; | ||||
|           goto finish; | ||||
|         } else if (data.endsWith(GF("+UUSORD:"))) { | ||||
|           int8_t  mux = streamGetInt(','); | ||||
|           int16_t len = streamGetInt('\n'); | ||||
|           int8_t  mux = streamGetIntBefore(','); | ||||
|           int16_t len = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             sockets[mux]->got_data       = true; | ||||
|             sockets[mux]->sock_available = len; | ||||
| @@ -819,15 +822,15 @@ class TinyGsmSaraR4 | ||||
|           data = ""; | ||||
|           DBG("### URC Data Received:", len, "on", mux); | ||||
|         } else if (data.endsWith(GF("+UUSOCL:"))) { | ||||
|           int8_t mux = streamGetInt('\n'); | ||||
|           int8_t mux = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             sockets[mux]->sock_connected = false; | ||||
|           } | ||||
|           data = ""; | ||||
|           DBG("### URC Sock Closed: ", mux); | ||||
|         } else if (data.endsWith(GF("+UUSOCO:"))) { | ||||
|           int8_t mux          = streamGetInt('\n'); | ||||
|           int8_t socket_error = streamGetInt('\n'); | ||||
|           int8_t mux          = streamGetIntBefore('\n'); | ||||
|           int8_t socket_error = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux] && | ||||
|               socket_error == 0) { | ||||
|             sockets[mux]->sock_connected = true; | ||||
|   | ||||
| @@ -496,7 +496,7 @@ class TinyGsmSequansMonarch | ||||
|     sendAT(GF("+SQNSRECV="), mux, ',', (uint16_t)size); | ||||
|     if (waitResponse(GF("+SQNSRECV: ")) != 1) { return 0; } | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     int16_t len = streamGetInt('\n'); | ||||
|     int16_t len = streamGetIntBefore('\n'); | ||||
|     for (int i = 0; i < len; i++) { | ||||
|       uint32_t startMillis = millis(); | ||||
|       while (!stream.available() && | ||||
| @@ -517,10 +517,10 @@ class TinyGsmSequansMonarch | ||||
|     sendAT(GF("+SQNSI="), mux); | ||||
|     size_t result = 0; | ||||
|     if (waitResponse(GF("+SQNSI:")) == 1) { | ||||
|       streamSkipUntil(',');        // Skip mux | ||||
|       streamSkipUntil(',');        // Skip total sent | ||||
|       streamSkipUntil(',');        // Skip total received | ||||
|       result = streamGetInt(',');  // keep data not yet read | ||||
|       streamSkipUntil(',');              // Skip mux | ||||
|       streamSkipUntil(',');              // Skip total sent | ||||
|       streamSkipUntil(',');              // Skip total received | ||||
|       result = streamGetIntBefore(',');  // keep data not yet read | ||||
|       waitResponse(); | ||||
|     } | ||||
|     DBG("### Available:", result, "on", mux); | ||||
| @@ -534,7 +534,7 @@ class TinyGsmSequansMonarch | ||||
|     for (int muxNo = 1; muxNo <= TINY_GSM_MUX_COUNT; muxNo++) { | ||||
|       if (waitResponse(GFP(GSM_OK), GF(GSM_NL "+SQNSS: ")) != 2) { break; } | ||||
|       uint8_t status = 0; | ||||
|       // if (streamGetInt(',') != muxNo) { // check the mux no | ||||
|       // if (streamGetIntBefore(',') != muxNo) { // check the mux no | ||||
|       //   DBG("### Warning: misaligned mux numbers!"); | ||||
|       // } | ||||
|       streamSkipUntil(',');        // skip mux [use muxNo] | ||||
| @@ -602,8 +602,8 @@ class TinyGsmSequansMonarch | ||||
|           index = 5; | ||||
|           goto finish; | ||||
|         } else if (data.endsWith(GF(GSM_NL "+SQNSRING:"))) { | ||||
|           int8_t  mux = streamGetInt(','); | ||||
|           int16_t len = streamGetInt('\n'); | ||||
|           int8_t  mux = streamGetIntBefore(','); | ||||
|           int16_t len = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && | ||||
|               sockets[mux % TINY_GSM_MUX_COUNT]) { | ||||
|             sockets[mux % TINY_GSM_MUX_COUNT]->got_data       = true; | ||||
| @@ -612,7 +612,7 @@ class TinyGsmSequansMonarch | ||||
|           data = ""; | ||||
|           DBG("### URC Data Received:", len, "on", mux); | ||||
|         } else if (data.endsWith(GF("SQNSH: "))) { | ||||
|           int8_t mux = streamGetInt('\n'); | ||||
|           int8_t mux = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && | ||||
|               sockets[mux % TINY_GSM_MUX_COUNT]) { | ||||
|             sockets[mux % TINY_GSM_MUX_COUNT]->sock_connected = false; | ||||
|   | ||||
| @@ -487,28 +487,31 @@ class TinyGsmUBLOX | ||||
|     float secondWithSS = 0; | ||||
|  | ||||
|     // Date & Time | ||||
|     iday         = streamGetInt('/');    // Two digit day | ||||
|     imonth       = streamGetInt('/');    // Two digit month | ||||
|     iyear        = streamGetInt(',');    // Four digit year | ||||
|     ihour        = streamGetInt(':');    // Two digit hour | ||||
|     imin         = streamGetInt(':');    // Two digit minute | ||||
|     secondWithSS = streamGetFloat(',');  // 6 digit second with subseconds | ||||
|     iday         = streamGetIntBefore('/');    // Two digit day | ||||
|     imonth       = streamGetIntBefore('/');    // Two digit month | ||||
|     iyear        = streamGetIntBefore(',');    // Four digit year | ||||
|     ihour        = streamGetIntBefore(':');    // Two digit hour | ||||
|     imin         = streamGetIntBefore(':');    // Two digit minute | ||||
|     secondWithSS = streamGetFloatBefore(',');  // 6 digit second with subseconds | ||||
|  | ||||
|     ilat = streamGetFloat(',');  // Estimated latitude, in degrees | ||||
|     ilon = streamGetFloat(',');  // Estimated longitude, in degrees | ||||
|     ialt = streamGetFloat(',');  // Estimated altitude, in meters - only forGNSS | ||||
|                                  // positioning, 0 in case of CellLocate | ||||
|     if (ialt != 0) {             // values not returned for CellLocate | ||||
|       iaccuracy = streamGetFloat(',');  // Maximum possible error, in meters | ||||
|       ispeed    = streamGetFloat(',');  // Speed over ground m/s3 | ||||
|     ilat = streamGetFloatBefore(',');  // Estimated latitude, in degrees | ||||
|     ilon = streamGetFloatBefore(',');  // Estimated longitude, in degrees | ||||
|     ialt = streamGetFloatBefore( | ||||
|         ',');         // Estimated altitude, in meters - only forGNSS | ||||
|                       // positioning, 0 in case of CellLocate | ||||
|     if (ialt != 0) {  // values not returned for CellLocate | ||||
|       iaccuracy = | ||||
|           streamGetFloatBefore(',');       // Maximum possible error, in meters | ||||
|       ispeed = streamGetFloatBefore(',');  // Speed over ground m/s3 | ||||
|       streamSkipUntil(',');  // Course over ground in degree (0 deg - 360 deg) | ||||
|       streamSkipUntil(',');  // Vertical accuracy, in meters | ||||
|       streamSkipUntil(',');  // Sensor used for the position calculation | ||||
|       iusat = streamGetInt(',');  // Number of satellite used | ||||
|       streamSkipUntil(',');       // Antenna status | ||||
|       streamSkipUntil('\n');      // Jamming status | ||||
|       iusat = streamGetIntBefore(',');  // Number of satellite used | ||||
|       streamSkipUntil(',');             // Antenna status | ||||
|       streamSkipUntil('\n');            // Jamming status | ||||
|     } else { | ||||
|       iaccuracy = streamGetFloat('\n');  // Maximum possible error, in meters | ||||
|       iaccuracy = | ||||
|           streamGetFloatBefore('\n');  // Maximum possible error, in meters | ||||
|     } | ||||
|  | ||||
|     // Set pointers | ||||
| @@ -561,7 +564,7 @@ class TinyGsmUBLOX | ||||
|     sendAT(GF("+CIND?")); | ||||
|     if (waitResponse(GF(GSM_NL "+CIND:")) != 1) { return 0; } | ||||
|  | ||||
|     int8_t res     = streamGetInt(','); | ||||
|     int8_t res     = streamGetIntBefore(','); | ||||
|     int8_t percent = res * 20;  // return is 0-5 | ||||
|     // Wait for final OK | ||||
|     waitResponse(); | ||||
| @@ -599,7 +602,7 @@ class TinyGsmUBLOX | ||||
|     sendAT(GF("+USOCR=6")); | ||||
|     // reply is +USOCR: ## of socket created | ||||
|     if (waitResponse(GF(GSM_NL "+USOCR:")) != 1) { return false; } | ||||
|     *mux = streamGetInt('\n'); | ||||
|     *mux = streamGetIntBefore('\n'); | ||||
|     waitResponse(); | ||||
|  | ||||
|     if (ssl) { | ||||
| @@ -634,7 +637,7 @@ class TinyGsmUBLOX | ||||
|     stream.flush(); | ||||
|     if (waitResponse(GF(GSM_NL "+USOWR:")) != 1) { return 0; } | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     int16_t sent = streamGetInt('\n'); | ||||
|     int16_t sent = streamGetIntBefore('\n'); | ||||
|     waitResponse();  // sends back OK after the confirmation of number sent | ||||
|     return sent; | ||||
|   } | ||||
| @@ -643,7 +646,7 @@ class TinyGsmUBLOX | ||||
|     sendAT(GF("+USORD="), mux, ',', (uint16_t)size); | ||||
|     if (waitResponse(GF(GSM_NL "+USORD:")) != 1) { return 0; } | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     int16_t len = streamGetInt(','); | ||||
|     int16_t len = streamGetIntBefore(','); | ||||
|     streamSkipUntil('\"'); | ||||
|  | ||||
|     for (int i = 0; i < len; i++) { moveCharFromStreamToFifo(mux); } | ||||
| @@ -663,7 +666,7 @@ class TinyGsmUBLOX | ||||
|     // that you have already told to close | ||||
|     if (res == 1) { | ||||
|       streamSkipUntil(',');  // Skip mux | ||||
|       result = streamGetInt('\n'); | ||||
|       result = streamGetIntBefore('\n'); | ||||
|       // if (result) DBG("### DATA AVAILABLE:", result, "on", mux); | ||||
|       waitResponse(); | ||||
|     } | ||||
| @@ -680,7 +683,7 @@ class TinyGsmUBLOX | ||||
|  | ||||
|     streamSkipUntil(',');  // Skip mux | ||||
|     streamSkipUntil(',');  // Skip type | ||||
|     int8_t result = streamGetInt('\n'); | ||||
|     int8_t result = streamGetIntBefore('\n'); | ||||
|     // 0: the socket is in INACTIVE status (it corresponds to CLOSED status | ||||
|     // defined in RFC793 "TCP Protocol Specification" [112]) | ||||
|     // 1: the socket is in LISTEN status | ||||
| @@ -742,8 +745,8 @@ class TinyGsmUBLOX | ||||
|           index = 5; | ||||
|           goto finish; | ||||
|         } else if (data.endsWith(GF("+UUSORD:"))) { | ||||
|           int8_t  mux = streamGetInt(','); | ||||
|           int16_t len = streamGetInt('\n'); | ||||
|           int8_t  mux = streamGetIntBefore(','); | ||||
|           int16_t len = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             sockets[mux]->got_data       = true; | ||||
|             sockets[mux]->sock_available = len; | ||||
| @@ -751,7 +754,7 @@ class TinyGsmUBLOX | ||||
|           data = ""; | ||||
|           DBG("### URC Data Received:", len, "on", mux); | ||||
|         } else if (data.endsWith(GF("+UUSOCL:"))) { | ||||
|           int8_t mux = streamGetInt('\n'); | ||||
|           int8_t mux = streamGetIntBefore('\n'); | ||||
|           if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { | ||||
|             sockets[mux]->sock_connected = false; | ||||
|           } | ||||
|   | ||||
| @@ -153,7 +153,7 @@ class TinyGsmGPRS { | ||||
|   bool isGprsConnectedImpl() { | ||||
|     thisModem().sendAT(GF("+CGATT?")); | ||||
|     if (thisModem().waitResponse(GF("+CGATT:")) != 1) { return false; } | ||||
|     int8_t res = thisModem().streamGetInt('\n'); | ||||
|     int8_t res = thisModem().streamGetIntBefore('\n'); | ||||
|     thisModem().waitResponse(); | ||||
|     if (res != 1) { return false; } | ||||
|  | ||||
|   | ||||
| @@ -105,17 +105,17 @@ class TinyGsmGSMLocation { | ||||
|     int   imin      = 0; | ||||
|     int   isec      = 0; | ||||
|  | ||||
|     ilat      = thisModem().streamGetFloat(',');  // Latitude | ||||
|     ilon      = thisModem().streamGetFloat(',');  // Longitude | ||||
|     iaccuracy = thisModem().streamGetInt(',');    // Positioning accuracy | ||||
|     ilat      = thisModem().streamGetFloatBefore(',');  // Latitude | ||||
|     ilon      = thisModem().streamGetFloatBefore(',');  // Longitude | ||||
|     iaccuracy = thisModem().streamGetIntBefore(',');    // Positioning accuracy | ||||
|  | ||||
|     // Date & Time | ||||
|     iyear  = thisModem().streamGetInt('/'); | ||||
|     imonth = thisModem().streamGetInt('/'); | ||||
|     iday   = thisModem().streamGetInt(','); | ||||
|     ihour  = thisModem().streamGetInt(':'); | ||||
|     imin   = thisModem().streamGetInt(':'); | ||||
|     isec   = thisModem().streamGetInt('\n'); | ||||
|     iyear  = thisModem().streamGetIntBefore('/'); | ||||
|     imonth = thisModem().streamGetIntBefore('/'); | ||||
|     iday   = thisModem().streamGetIntBefore(','); | ||||
|     ihour  = thisModem().streamGetIntBefore(':'); | ||||
|     imin   = thisModem().streamGetIntBefore(':'); | ||||
|     isec   = thisModem().streamGetIntBefore('\n'); | ||||
|  | ||||
|     // Set pointers | ||||
|     if (lat != NULL) *lat = ilat; | ||||
|   | ||||
| @@ -187,7 +187,7 @@ class TinyGsmModem { | ||||
|                                            GF("+CEREG:")); | ||||
|     if (resp != 1 && resp != 2 && resp != 3) { return -1; } | ||||
|     thisModem().streamSkipUntil(','); /* Skip format (0) */ | ||||
|     int status = thisModem().streamGetInt('\n'); | ||||
|     int status = thisModem().streamGetIntBefore('\n'); | ||||
|     thisModem().waitResponse(); | ||||
|     return status; | ||||
|   } | ||||
| @@ -204,7 +204,7 @@ class TinyGsmModem { | ||||
|   int8_t getSignalQualityImpl() { | ||||
|     thisModem().sendAT(GF("+CSQ")); | ||||
|     if (thisModem().waitResponse(GF("+CSQ:")) != 1) { return 99; } | ||||
|     int8_t res = thisModem().streamGetInt(','); | ||||
|     int8_t res = thisModem().streamGetIntBefore(','); | ||||
|     thisModem().waitResponse(); | ||||
|     return res; | ||||
|   } | ||||
| @@ -255,7 +255,7 @@ class TinyGsmModem { | ||||
|     thisModem().streamWrite(tail...); | ||||
|   } | ||||
|  | ||||
|   inline int16_t streamGetInt(int8_t numChars) { | ||||
|   inline int16_t streamGetIntLength(int8_t numChars) { | ||||
|     char   buf[6]; | ||||
|     size_t bytesRead = thisModem().stream.readBytes(buf, numChars); | ||||
|     if (bytesRead) { | ||||
| @@ -267,9 +267,7 @@ class TinyGsmModem { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   template <class T> | ||||
|   // calling with template only to prevent promotion of char to int | ||||
|   inline int16_t streamGetInt(T lastChar) { | ||||
|   inline int16_t streamGetIntBefore(char lastChar) { | ||||
|     char   buf[6]; | ||||
|     size_t bytesRead = thisModem().stream.readBytesUntil( | ||||
|         lastChar, buf, static_cast<size_t>(6)); | ||||
| @@ -282,7 +280,7 @@ class TinyGsmModem { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   inline float streamGetFloat(int8_t numChars) { | ||||
|   inline float streamGetFloatLength(int8_t numChars) { | ||||
|     char   buf[16]; | ||||
|     size_t bytesRead = thisModem().stream.readBytes(buf, numChars); | ||||
|     DBG("### bytesRead:", bytesRead); | ||||
| @@ -295,9 +293,7 @@ class TinyGsmModem { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   template <class T> | ||||
|   // calling with template only to prevent promotion of char to int | ||||
|   inline float streamGetFloat(T lastChar) { | ||||
|   inline float streamGetFloatBefore(char lastChar) { | ||||
|     char   buf[16]; | ||||
|     size_t bytesRead = thisModem().stream.readBytesUntil( | ||||
|         lastChar, buf, static_cast<size_t>(16)); | ||||
|   | ||||
| @@ -125,7 +125,7 @@ class TinyGsmSMS { | ||||
|     thisModem().stream.readStringUntil('"'); | ||||
|     String hex = thisModem().stream.readStringUntil('"'); | ||||
|     thisModem().stream.readStringUntil(','); | ||||
|     int8_t dcs = thisModem().streamGetInt('\n'); | ||||
|     int8_t dcs = thisModem().streamGetIntBefore('\n'); | ||||
|  | ||||
|     if (dcs == 15) { | ||||
|       return TinyGsmDecodeHex8bit(hex); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user