mirror of
				https://github.com/KevinMidboe/TinyGSM.git
				synced 2025-10-29 18:00:18 +00:00 
			
		
		
		
	Fixes around cmee
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
		| @@ -507,6 +507,9 @@ class TinyGsmA6 | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|   | ||||
| @@ -422,6 +422,9 @@ class TinyGsmBG96 | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|   | ||||
| @@ -19,7 +19,6 @@ | ||||
| #define GSM_NL "\r\n" | ||||
| static const char GSM_OK[] TINY_GSM_PROGMEM    = "OK" GSM_NL; | ||||
| static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL; | ||||
| static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:"; | ||||
| static unsigned   TINY_GSM_TCP_KEEP_ALIVE      = 120; | ||||
|  | ||||
| // <stat> status of ESP8266 station interface | ||||
| @@ -421,8 +420,7 @@ class TinyGsmESP8266 | ||||
|   // TODO(vshymanskyy): Optimize this! | ||||
|   uint8_t waitResponse(uint32_t timeout_ms, String& data, | ||||
|                        GsmConstStr r1 = GFP(GSM_OK), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), | ||||
|                        GsmConstStr r3 = GFP(GSM_CME_ERROR), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL, | ||||
|                        GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) { | ||||
|     /*String r1s(r1); r1s.trim(); | ||||
|     String r2s(r2); r2s.trim(); | ||||
| @@ -497,16 +495,14 @@ class TinyGsmESP8266 | ||||
|   } | ||||
|  | ||||
|   uint8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), | ||||
|                        GsmConstStr r3 = GFP(GSM_CME_ERROR), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL, | ||||
|                        GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) { | ||||
|     String data; | ||||
|     return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5); | ||||
|   } | ||||
|  | ||||
|   uint8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), | ||||
|                        GsmConstStr r3 = GFP(GSM_CME_ERROR), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL, | ||||
|                        GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) { | ||||
|     return waitResponse(1000, r1, r2, r3, r4, r5); | ||||
|   } | ||||
|   | ||||
| @@ -417,6 +417,9 @@ class TinyGsmM590 | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|   | ||||
| @@ -541,6 +541,9 @@ class TinyGsmM95 | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|   | ||||
| @@ -523,6 +523,9 @@ class TinyGsmMC60 | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|   | ||||
| @@ -616,6 +616,9 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360, READ_AND_CHECK_SIZE, | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|   | ||||
| @@ -644,6 +644,9 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000, READ_AND_CHECK_SIZE, | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|   | ||||
| @@ -618,6 +618,9 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600, READ_AND_CHECK_SIZE, | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|   | ||||
| @@ -595,6 +595,9 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800, READ_AND_CHECK_SIZE, | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|   | ||||
| @@ -653,10 +653,10 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4, READ_AND_CHECK_SIZE, | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           index = 3; | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|           index = 4; | ||||
|   | ||||
| @@ -611,6 +611,9 @@ class TinyGsmSequansMonarch | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|   | ||||
| @@ -580,10 +580,10 @@ class TinyGsmUBLOX | ||||
|           index = 2; | ||||
|           goto finish; | ||||
|         } else if (r3 && data.endsWith(r3)) { | ||||
|           index = 3; | ||||
|           if (r3 == GFP(GSM_CME_ERROR)) { | ||||
|             streamSkipUntil('\n');  // Read out the error | ||||
|           } | ||||
|           index = 3; | ||||
|           goto finish; | ||||
|         } else if (r4 && data.endsWith(r4)) { | ||||
|           index = 4; | ||||
|   | ||||
| @@ -25,7 +25,6 @@ | ||||
| #define GSM_NL "\r" | ||||
| static const char GSM_OK[] TINY_GSM_PROGMEM    = "OK" GSM_NL; | ||||
| static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL; | ||||
| static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:"; | ||||
|  | ||||
| // Use this to avoid too many entrances and exits from command mode. | ||||
| // The cellular Bee's often freeze up and won't respond when attempting | ||||
| @@ -1269,8 +1268,7 @@ class TinyGsmXBee | ||||
|   // (URC's) when in command mode. | ||||
|   uint8_t waitResponse(uint32_t timeout_ms, String& data, | ||||
|                        GsmConstStr r1 = GFP(GSM_OK), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), | ||||
|                        GsmConstStr r3 = GFP(GSM_CME_ERROR), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL, | ||||
|                        GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) { | ||||
|     /*String r1s(r1); r1s.trim(); | ||||
|     String r2s(r2); r2s.trim(); | ||||
| @@ -1327,16 +1325,14 @@ class TinyGsmXBee | ||||
|   } | ||||
|  | ||||
|   uint8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), | ||||
|                        GsmConstStr r3 = GFP(GSM_CME_ERROR), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL, | ||||
|                        GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) { | ||||
|     String data; | ||||
|     return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5); | ||||
|   } | ||||
|  | ||||
|   uint8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), | ||||
|                        GsmConstStr r3 = GFP(GSM_CME_ERROR), | ||||
|                        GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL, | ||||
|                        GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) { | ||||
|     return waitResponse(1000, r1, r2, r3, r4, r5); | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user