Browse Source

Fixes around cmee

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
v_master
Sara Damiano 5 years ago
parent
commit
24a57d7fd3
14 changed files with 43 additions and 21 deletions
  1. +3
    -0
      src/TinyGsmClientA6.h
  2. +3
    -0
      src/TinyGsmClientBG96.h
  3. +6
    -10
      src/TinyGsmClientESP8266.h
  4. +3
    -0
      src/TinyGsmClientM590.h
  5. +3
    -0
      src/TinyGsmClientM95.h
  6. +3
    -0
      src/TinyGsmClientMC60.h
  7. +3
    -0
      src/TinyGsmClientSIM5360.h
  8. +3
    -0
      src/TinyGsmClientSIM7000.h
  9. +3
    -0
      src/TinyGsmClientSIM7600.h
  10. +3
    -0
      src/TinyGsmClientSIM800.h
  11. +1
    -1
      src/TinyGsmClientSaraR4.h
  12. +3
    -0
      src/TinyGsmClientSequansMonarch.h
  13. +1
    -1
      src/TinyGsmClientUBLOX.h
  14. +5
    -9
      src/TinyGsmClientXBee.h

+ 3
- 0
src/TinyGsmClientA6.h View File

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


+ 3
- 0
src/TinyGsmClientBG96.h View File

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


+ 6
- 10
src/TinyGsmClientESP8266.h View File

@ -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_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 // <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 r3 = GFP(GSM_CME_ERROR),
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
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 r3 = GFP(GSM_CME_ERROR),
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
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 r3 = GFP(GSM_CME_ERROR),
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
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);
} }


+ 3
- 0
src/TinyGsmClientM590.h View File

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


+ 3
- 0
src/TinyGsmClientM95.h View File

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


+ 3
- 0
src/TinyGsmClientMC60.h View File

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


+ 3
- 0
src/TinyGsmClientSIM5360.h View File

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


+ 3
- 0
src/TinyGsmClientSIM7000.h View File

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


+ 3
- 0
src/TinyGsmClientSIM7600.h View File

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


+ 3
- 0
src/TinyGsmClientSIM800.h View File

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


+ 1
- 1
src/TinyGsmClientSaraR4.h View File

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


+ 3
- 0
src/TinyGsmClientSequansMonarch.h View File

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


+ 1
- 1
src/TinyGsmClientUBLOX.h View File

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


+ 5
- 9
src/TinyGsmClientXBee.h View File

@ -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_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. // 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 r3 = GFP(GSM_CME_ERROR),
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
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 r3 = GFP(GSM_CME_ERROR),
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
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 r3 = GFP(GSM_CME_ERROR),
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
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);
} }


Loading…
Cancel
Save