Browse Source

Only use CME_Error if debug

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
v_master
Sara Damiano 5 years ago
parent
commit
a483b288b6
13 changed files with 244 additions and 52 deletions
  1. +18
    -2
      src/TinyGsmClientA6.h
  2. +19
    -3
      src/TinyGsmClientBG96.h
  3. +1
    -1
      src/TinyGsmClientESP8266.h
  4. +18
    -2
      src/TinyGsmClientM590.h
  5. +20
    -4
      src/TinyGsmClientM95.h
  6. +20
    -4
      src/TinyGsmClientMC60.h
  7. +22
    -6
      src/TinyGsmClientSIM5360.h
  8. +22
    -6
      src/TinyGsmClientSIM7000.h
  9. +22
    -6
      src/TinyGsmClientSIM7600.h
  10. +22
    -6
      src/TinyGsmClientSIM800.h
  11. +20
    -4
      src/TinyGsmClientSaraR4.h
  12. +20
    -4
      src/TinyGsmClientSequansMonarch.h
  13. +20
    -4
      src/TinyGsmClientUBLOX.h

+ 18
- 2
src/TinyGsmClientA6.h View File

@ -24,9 +24,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -455,7 +457,11 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim();
@ -480,9 +486,11 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -530,7 +538,11 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
String data;
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
@ -538,7 +550,11 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5);
}


+ 19
- 3
src/TinyGsmClientBG96.h View File

@ -24,9 +24,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -328,7 +330,7 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
for (int i = 0; i < len; i++) { moveCharFromStreamToFifo(mux); }
waitResponse();
DBG("### READ:", len, "from", mux);
// DBG("### READ:", len, "from", mux);
sockets[mux]->sock_available = modemGetAvailable(mux);
return len;
}
@ -374,7 +376,11 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim();
@ -399,9 +405,11 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -446,7 +454,11 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
String data;
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
@ -454,7 +466,11 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5);
}


+ 1
- 1
src/TinyGsmClientESP8266.h View File

@ -384,7 +384,7 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
DBG("### Buffer overflow: ", len, "received vs",
sockets[mux]->rx.free(), "available");
} else {
DBG("### Got Data: ", len, "on", mux);
// DBG("### Got Data: ", len, "on", mux);
}
while (len--) { moveCharFromStreamToFifo(mux); }
// TODO(SRGDamia1): deal with buffer overflow/missed characters


+ 18
- 2
src/TinyGsmClientM590.h View File

@ -22,9 +22,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -342,7 +344,11 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim();
@ -367,9 +373,11 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -418,7 +426,11 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
String data;
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
@ -426,7 +438,11 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5);
}


+ 20
- 4
src/TinyGsmClientM95.h View File

@ -26,9 +26,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -467,7 +469,7 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
// FIFO
}
waitResponse(); // ends with an OK
DBG("### READ:", len, "from", mux);
// DBG("### READ:", len, "from", mux);
return len;
} else {
sockets[mux]->sock_available = 0;
@ -506,7 +508,11 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim();
@ -531,9 +537,11 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -546,7 +554,7 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
streamSkipUntil(','); // Skip the context
streamSkipUntil(','); // Skip the role
int8_t mux = streamGetIntBefore('\n');
DBG("### Got Data:", mux);
// 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
// we set the value to 1500, the maximum possible size.
@ -578,7 +586,11 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
String data;
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
@ -586,7 +598,11 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5);
}


+ 20
- 4
src/TinyGsmClientMC60.h View File

@ -27,9 +27,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -426,7 +428,7 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
// FIFO
}
waitResponse(); // ends with an OK
DBG("### READ:", len, "from", mux);
// DBG("### READ:", len, "from", mux);
return len;
} else {
sockets[mux]->sock_available = 0;
@ -465,7 +467,11 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL,
GsmConstStr r6 = NULL) {
/*String r1s(r1); r1s.trim();
@ -492,9 +498,11 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -521,7 +529,7 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
sockets[mux]->sock_available = len_packet * num_packets;
}
data = "";
DBG("### Got Data:", len_packet * num_packets, "on", mux);
// DBG("### Got Data:", len_packet * num_packets, "on", mux);
} else if (data.endsWith(GF("CLOSED" GSM_NL))) {
int8_t nl = data.lastIndexOf(GSM_NL, data.length() - 8);
int8_t coma = data.indexOf(',', nl + 2);
@ -547,7 +555,11 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL,
GsmConstStr r6 = NULL) {
String data;
@ -556,7 +568,11 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL,
GsmConstStr r6 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5, r6);


+ 22
- 6
src/TinyGsmClientSIM5360.h View File

@ -25,9 +25,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -536,7 +538,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
#endif
sockets[mux]->rx.put(c);
}
DBG("### READ:", len_requested, "from", mux);
// DBG("### READ:", len_requested, "from", mux);
// sockets[mux]->sock_available = modemGetAvailable(mux);
sockets[mux]->sock_available = len_confirmed;
waitResponse();
@ -552,7 +554,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
result = streamGetIntBefore('\n');
waitResponse();
}
DBG("### Available:", result, "on", mux);
// DBG("### Available:", result, "on", mux);
if (!result) { sockets[mux]->sock_connected = modemGetConnected(mux); }
return result;
}
@ -577,7 +579,11 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim();
@ -602,9 +608,11 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -621,7 +629,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
sockets[mux]->got_data = true;
}
data = "";
DBG("### Got Data:", mux);
// DBG("### Got Data:", mux);
} else {
data += mode;
}
@ -633,7 +641,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
sockets[mux]->sock_available = len;
}
data = "";
DBG("### Got Data:", len, "on", mux);
// DBG("### Got Data:", len, "on", mux);
} else if (data.endsWith(GF("+IPCLOSE:"))) {
int8_t mux = streamGetIntBefore(',');
streamSkipUntil('\n'); // Skip the reason code
@ -664,7 +672,11 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
String data;
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
@ -672,7 +684,11 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5);
}


+ 22
- 6
src/TinyGsmClientSIM7000.h View File

@ -24,9 +24,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -573,7 +575,7 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
#endif
sockets[mux]->rx.put(c);
}
DBG("### READ:", len_requested, "from", mux);
// DBG("### READ:", len_requested, "from", mux);
// sockets[mux]->sock_available = modemGetAvailable(mux);
sockets[mux]->sock_available = len_confirmed;
waitResponse();
@ -589,7 +591,7 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
result = streamGetIntBefore('\n');
waitResponse();
}
DBG("### Available:", result, "on", mux);
// DBG("### Available:", result, "on", mux);
if (!result) { sockets[mux]->sock_connected = modemGetConnected(mux); }
return result;
}
@ -610,7 +612,11 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim();
@ -635,9 +641,11 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -654,7 +662,7 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
sockets[mux]->got_data = true;
}
data = "";
DBG("### Got Data:", mux);
// DBG("### Got Data:", mux);
} else {
data += mode;
}
@ -666,7 +674,7 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
sockets[mux]->sock_available = len;
}
data = "";
DBG("### Got Data:", len, "on", mux);
// DBG("### Got Data:", len, "on", mux);
} else if (data.endsWith(GF("CLOSED" GSM_NL))) {
int8_t nl = data.lastIndexOf(GSM_NL, data.length() - 8);
int8_t coma = data.indexOf(',', nl + 2);
@ -692,7 +700,11 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
String data;
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
@ -700,7 +712,11 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5);
}


+ 22
- 6
src/TinyGsmClientSIM7600.h View File

@ -26,9 +26,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -624,7 +626,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
#endif
sockets[mux]->rx.put(c);
}
DBG("### READ:", len_requested, "from", mux);
// DBG("### READ:", len_requested, "from", mux);
// sockets[mux]->sock_available = modemGetAvailable(mux);
sockets[mux]->sock_available = len_confirmed;
waitResponse();
@ -640,7 +642,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
result = streamGetIntBefore('\n');
waitResponse();
}
DBG("### Available:", result, "on", mux);
// DBG("### Available:", result, "on", mux);
if (!result) { sockets[mux]->sock_connected = modemGetConnected(mux); }
return result;
}
@ -667,7 +669,11 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim();
@ -692,9 +698,11 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -711,7 +719,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
sockets[mux]->got_data = true;
}
data = "";
DBG("### Got Data:", mux);
// DBG("### Got Data:", mux);
} else {
data += mode;
}
@ -723,7 +731,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
sockets[mux]->sock_available = len;
}
data = "";
DBG("### Got Data:", len, "on", mux);
// DBG("### Got Data:", len, "on", mux);
} else if (data.endsWith(GF("+IPCLOSE:"))) {
int8_t mux = streamGetIntBefore(',');
streamSkipUntil('\n'); // Skip the reason code
@ -754,7 +762,11 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
String data;
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
@ -762,7 +774,11 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5);
}


+ 22
- 6
src/TinyGsmClientSIM800.h View File

@ -27,9 +27,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -548,7 +550,7 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
#endif
sockets[mux]->rx.put(c);
}
DBG("### READ:", len_requested, "from", mux);
// DBG("### READ:", len_requested, "from", mux);
// sockets[mux]->sock_available = modemGetAvailable(mux);
sockets[mux]->sock_available = len_confirmed;
waitResponse();
@ -564,7 +566,7 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
result = streamGetIntBefore('\n');
waitResponse();
}
DBG("### Available:", result, "on", mux);
// DBG("### Available:", result, "on", mux);
if (!result) { sockets[mux]->sock_connected = modemGetConnected(mux); }
return result;
}
@ -587,7 +589,11 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim();
@ -612,9 +618,11 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -631,7 +639,7 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
sockets[mux]->got_data = true;
}
data = "";
DBG("### Got Data:", mux);
// DBG("### Got Data:", mux);
} else {
data += mode;
}
@ -643,7 +651,7 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
sockets[mux]->sock_available = len;
}
data = "";
DBG("### Got Data:", len, "on", mux);
// DBG("### Got Data:", len, "on", mux);
} else if (data.endsWith(GF("CLOSED" GSM_NL))) {
int8_t nl = data.lastIndexOf(GSM_NL, data.length() - 8);
int8_t coma = data.indexOf(',', nl + 2);
@ -669,7 +677,11 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
String data;
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
@ -677,7 +689,11 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5);
}


+ 20
- 4
src/TinyGsmClientSaraR4.h View File

@ -27,9 +27,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -719,7 +721,7 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
for (int i = 0; i < len; i++) { moveCharFromStreamToFifo(mux); }
streamSkipUntil('\"');
waitResponse();
DBG("### READ:", len, "from", mux);
// DBG("### READ:", len, "from", mux);
sockets[mux]->sock_available = modemGetAvailable(mux);
return len;
}
@ -738,7 +740,7 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
waitResponse();
}
if (!result) { sockets[mux]->sock_connected = modemGetConnected(mux); }
DBG("### AVAILABLE:", result, "on", mux);
// DBG("### AvailablE:", result, "on", mux);
return result;
}
@ -775,7 +777,11 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim();
@ -800,9 +806,11 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -852,7 +860,11 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
String data;
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
@ -860,7 +872,11 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5);
}


+ 20
- 4
src/TinyGsmClientSequansMonarch.h View File

@ -24,9 +24,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -506,7 +508,7 @@ class TinyGsmSequansMonarch
char c = stream.read();
sockets[mux % TINY_GSM_MUX_COUNT]->rx.put(c);
}
DBG("### Read:", len, "from", mux);
// DBG("### READ:", len, "from", mux);
waitResponse();
sockets[mux % TINY_GSM_MUX_COUNT]->sock_available = modemGetAvailable(mux);
return len;
@ -522,7 +524,7 @@ class TinyGsmSequansMonarch
result = streamGetIntBefore(','); // keep data not yet read
waitResponse();
}
DBG("### Available:", result, "on", mux);
// DBG("### Available:", result, "on", mux);
return result;
}
@ -564,7 +566,11 @@ class TinyGsmSequansMonarch
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim();
@ -589,9 +595,11 @@ class TinyGsmSequansMonarch
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -634,7 +642,11 @@ class TinyGsmSequansMonarch
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
String data;
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
@ -642,7 +654,11 @@ class TinyGsmSequansMonarch
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5);
}


+ 20
- 4
src/TinyGsmClientUBLOX.h View File

@ -27,9 +27,11 @@
#include "TinyGsmTime.tpp"
#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_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
#if defined TINY_GSM_DEBUG
static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:";
#endif
enum RegStatus {
REG_NO_RESULT = -1,
@ -651,7 +653,7 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
for (int i = 0; i < len; i++) { moveCharFromStreamToFifo(mux); }
streamSkipUntil('\"');
waitResponse();
DBG("### READ:", len, "from", mux);
// DBG("### READ:", len, "from", mux);
sockets[mux]->sock_available = modemGetAvailable(mux);
return len;
}
@ -670,7 +672,7 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
waitResponse();
}
if (!result) { sockets[mux]->sock_connected = modemGetConnected(mux); }
DBG("### AVAILABLE:", result, "on", mux);
// DBG("### AvailablE:", result, "on", mux);
return result;
}
@ -707,7 +709,11 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim();
@ -732,9 +738,11 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
index = 2;
goto finish;
} else if (r3 && data.endsWith(r3)) {
#if defined TINY_GSM_DEBUG
if (r3 == GFP(GSM_CME_ERROR)) {
streamSkipUntil('\n'); // Read out the error
}
#endif
index = 3;
goto finish;
} else if (r4 && data.endsWith(r4)) {
@ -775,7 +783,11 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
String data;
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
@ -783,7 +795,11 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else
GsmConstStr r3 = NULL,
#endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
return waitResponse(1000, r1, r2, r3, r4, r5);
}


Loading…
Cancel
Save