Fixes around cmee
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
		@@ -507,6 +507,9 @@ class TinyGsmA6
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          index = 3;
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -422,6 +422,9 @@ class TinyGsmBG96
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          index = 3;
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,10 +17,9 @@
 | 
				
			|||||||
#include "TinyGsmCommon.h"
 | 
					#include "TinyGsmCommon.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define GSM_NL "\r\n"
 | 
					#define GSM_NL "\r\n"
 | 
				
			||||||
static const char GSM_OK[] TINY_GSM_PROGMEM        = "OK" GSM_NL;
 | 
					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_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;
 | 
				
			||||||
static unsigned   TINY_GSM_TCP_KEEP_ALIVE          = 120;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// <stat> status of ESP8266 station interface
 | 
					// <stat> status of ESP8266 station interface
 | 
				
			||||||
// 2 : ESP8266 station connected to an AP and has obtained IP
 | 
					// 2 : ESP8266 station connected to an AP and has obtained IP
 | 
				
			||||||
@@ -421,8 +420,7 @@ class TinyGsmESP8266
 | 
				
			|||||||
  // TODO(vshymanskyy): Optimize this!
 | 
					  // TODO(vshymanskyy): Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1 = GFP(GSM_OK),
 | 
					                       GsmConstStr r1 = GFP(GSM_OK),
 | 
				
			||||||
                       GsmConstStr r2 = GFP(GSM_ERROR),
 | 
					                       GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
 | 
				
			||||||
                       GsmConstStr r3 = GFP(GSM_CME_ERROR),
 | 
					 | 
				
			||||||
                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
					                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
				
			||||||
    /*String r1s(r1); r1s.trim();
 | 
					    /*String r1s(r1); r1s.trim();
 | 
				
			||||||
    String r2s(r2); r2s.trim();
 | 
					    String r2s(r2); r2s.trim();
 | 
				
			||||||
@@ -497,16 +495,14 @@ class TinyGsmESP8266
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
 | 
				
			||||||
                       GsmConstStr r2 = GFP(GSM_ERROR),
 | 
					                       GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
 | 
				
			||||||
                       GsmConstStr r3 = GFP(GSM_CME_ERROR),
 | 
					 | 
				
			||||||
                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
					                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
 | 
					  uint8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
 | 
				
			||||||
                       GsmConstStr r2 = GFP(GSM_ERROR),
 | 
					                       GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
 | 
				
			||||||
                       GsmConstStr r3 = GFP(GSM_CME_ERROR),
 | 
					 | 
				
			||||||
                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
					                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
				
			||||||
    return waitResponse(1000, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(1000, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -417,6 +417,9 @@ class TinyGsmM590
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          index = 3;
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -541,6 +541,9 @@ class TinyGsmM95
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          index = 3;
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -523,6 +523,9 @@ class TinyGsmMC60
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          index = 3;
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -616,6 +616,9 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360, READ_AND_CHECK_SIZE,
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          index = 3;
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -644,6 +644,9 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000, READ_AND_CHECK_SIZE,
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          index = 3;
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -618,6 +618,9 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600, READ_AND_CHECK_SIZE,
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          index = 3;
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -595,6 +595,9 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800, READ_AND_CHECK_SIZE,
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          index = 3;
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -653,10 +653,10 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4, READ_AND_CHECK_SIZE,
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
          index = 3;
 | 
					 | 
				
			||||||
          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
            streamSkipUntil('\n');  // Read out the error
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
          index = 4;
 | 
					          index = 4;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -611,6 +611,9 @@ class TinyGsmSequansMonarch
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          index = 3;
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -580,10 +580,10 @@ class TinyGsmUBLOX
 | 
				
			|||||||
          index = 2;
 | 
					          index = 2;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r3 && data.endsWith(r3)) {
 | 
					        } else if (r3 && data.endsWith(r3)) {
 | 
				
			||||||
          index = 3;
 | 
					 | 
				
			||||||
          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
					          if (r3 == GFP(GSM_CME_ERROR)) {
 | 
				
			||||||
            streamSkipUntil('\n');  // Read out the error
 | 
					            streamSkipUntil('\n');  // Read out the error
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					          index = 3;
 | 
				
			||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        } else if (r4 && data.endsWith(r4)) {
 | 
					        } else if (r4 && data.endsWith(r4)) {
 | 
				
			||||||
          index = 4;
 | 
					          index = 4;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,9 +23,8 @@
 | 
				
			|||||||
#include "TinyGsmCommon.h"
 | 
					#include "TinyGsmCommon.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define GSM_NL "\r"
 | 
					#define GSM_NL "\r"
 | 
				
			||||||
static const char GSM_OK[] TINY_GSM_PROGMEM        = "OK" GSM_NL;
 | 
					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_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.
 | 
					// 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
 | 
					// 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.
 | 
					  // (URC's) when in command mode.
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1 = GFP(GSM_OK),
 | 
					                       GsmConstStr r1 = GFP(GSM_OK),
 | 
				
			||||||
                       GsmConstStr r2 = GFP(GSM_ERROR),
 | 
					                       GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
 | 
				
			||||||
                       GsmConstStr r3 = GFP(GSM_CME_ERROR),
 | 
					 | 
				
			||||||
                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
					                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
				
			||||||
    /*String r1s(r1); r1s.trim();
 | 
					    /*String r1s(r1); r1s.trim();
 | 
				
			||||||
    String r2s(r2); r2s.trim();
 | 
					    String r2s(r2); r2s.trim();
 | 
				
			||||||
@@ -1327,16 +1325,14 @@ class TinyGsmXBee
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
 | 
				
			||||||
                       GsmConstStr r2 = GFP(GSM_ERROR),
 | 
					                       GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
 | 
				
			||||||
                       GsmConstStr r3 = GFP(GSM_CME_ERROR),
 | 
					 | 
				
			||||||
                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
					                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
 | 
					  uint8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
 | 
				
			||||||
                       GsmConstStr r2 = GFP(GSM_ERROR),
 | 
					                       GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
 | 
				
			||||||
                       GsmConstStr r3 = GFP(GSM_CME_ERROR),
 | 
					 | 
				
			||||||
                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
					                       GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
 | 
				
			||||||
    return waitResponse(1000, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(1000, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user