Fixes around cmee

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
Sara Damiano
2020-02-07 14:12:25 -05:00
parent efb6450045
commit 24a57d7fd3
14 changed files with 43 additions and 21 deletions

View File

@@ -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)) {

View File

@@ -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)) {

View File

@@ -17,10 +17,9 @@
#include "TinyGsmCommon.h"
#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;
static const char GSM_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
static unsigned TINY_GSM_TCP_KEEP_ALIVE = 120;
// <stat> status of ESP8266 station interface
// 2 : ESP8266 station connected to an AP and has obtained IP
@@ -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);
}

View File

@@ -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)) {

View File

@@ -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)) {

View File

@@ -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)) {

View File

@@ -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)) {

View File

@@ -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)) {

View File

@@ -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)) {

View File

@@ -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)) {

View File

@@ -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;

View File

@@ -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)) {

View File

@@ -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;

View File

@@ -23,9 +23,8 @@
#include "TinyGsmCommon.h"
#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:";
static const char GSM_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
// 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);
}