From e47e3e387980bf515c37a5561a6b6a953ceaa055 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 15 Apr 2020 08:57:41 -0400 Subject: [PATCH 1/2] Fix some extra whitespace that crept in Signed-off-by: Sara Damiano --- src/TinyGsmClientSequansMonarch.h | 39 +++++++++++++++++-------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/TinyGsmClientSequansMonarch.h b/src/TinyGsmClientSequansMonarch.h index d9bd918..8f85edd 100644 --- a/src/TinyGsmClientSequansMonarch.h +++ b/src/TinyGsmClientSequansMonarch.h @@ -601,20 +601,20 @@ class TinyGsmSequansMonarch return sockets[mux % TINY_GSM_MUX_COUNT]->sock_connected; } - /* - * Utilities - */ - public: - // TODO(vshymanskyy): Optimize this! - int8_t waitResponse(uint32_t timeout_ms, String & data, - GsmConstStr r1 = GFP(GSM_OK), - GsmConstStr r2 = GFP(GSM_ERROR), + /* + * Utilities + */ + public: + // TODO(vshymanskyy): Optimize this! + 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), + GsmConstStr r3 = GFP(GSM_CME_ERROR), #else - GsmConstStr r3 = NULL, + GsmConstStr r3 = NULL, #endif - GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) { + GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) { /*String r1s(r1); r1s.trim(); String r2s(r2); r2s.trim(); String r3s(r3); r3s.trim(); @@ -622,7 +622,7 @@ class TinyGsmSequansMonarch String r5s(r5); r5s.trim(); DBG("### ..:", r1s, ",", r2s, ",", r3s, ",", r4s, ",", r5s);*/ data.reserve(64); - uint8_t index = 0; + uint8_t index = 0; uint32_t startMillis = millis(); do { TINY_GSM_YIELD(); @@ -652,11 +652,11 @@ class TinyGsmSequansMonarch index = 5; goto finish; } else if (data.endsWith(GF(GSM_NL "+SQNSRING:"))) { - int8_t mux = streamGetIntBefore(','); + int8_t mux = streamGetIntBefore(','); int16_t len = streamGetIntBefore('\n'); if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux % TINY_GSM_MUX_COUNT]) { - sockets[mux % TINY_GSM_MUX_COUNT]->got_data = true; + sockets[mux % TINY_GSM_MUX_COUNT]->got_data = true; sockets[mux % TINY_GSM_MUX_COUNT]->sock_available = len; } data = ""; @@ -675,7 +675,9 @@ class TinyGsmSequansMonarch finish: if (!index) { data.trim(); - if (data.length()) { DBG("### Unhandled:", data); } + if (data.length()) { + DBG("### Unhandled:", data); + } data = ""; } // data.replace(GSM_NL, "/"); @@ -707,10 +709,11 @@ class TinyGsmSequansMonarch } public: - Stream& stream; + Stream& stream; + protected: GsmClientSequansMonarch* sockets[TINY_GSM_MUX_COUNT]; - const char* gsmNL = GSM_NL; - }; + const char* gsmNL = GSM_NL; +}; #endif // SRC_TINYGSMCLIENTSEQUANSMONARCH_H_ From 335c2e8e6377a2f2b5809a10014e9536ce5f469a Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 15 Apr 2020 09:16:56 -0400 Subject: [PATCH 2/2] Fix CCID for SIM800, fixes #336 Signed-off-by: Sara Damiano --- .github/ISSUE_TEMPLATE.md | 2 +- library.json | 2 +- library.properties | 2 +- src/TinyGsmClientSIM800.h | 14 +++++++++++++- src/TinyGsmCommon.h | 2 +- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 98b342b..75e2d06 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -22,7 +22,7 @@ with your board before submitting any issues. Main processor board: Modem: -TinyGSM version: +TinyGSM version: Code: ### Scenario, steps to reproduce diff --git a/library.json b/library.json index d9f01fe..3fe8855 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TinyGSM", - "version": "0.10.2", + "version": "0.10.3", "description": "A small Arduino library for GPRS modules, that just works. Includes examples for Blynk, MQTT, File Download, and Web Client. Supports many GSM, LTE, and WiFi modules with AT command interfaces.", "keywords": "GSM, AT commands, AT, SIM800, SIM900, A6, A7, M590, ESP8266, SIM7000, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900A, SIM900D, SIM908, SIM968, M95, MC60, MC60E, BG96, ublox, Quectel, SIMCOM, AI Thinker, LTE, LTE-M", "authors": diff --git a/library.properties b/library.properties index 8b1fd67..d84e1d2 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TinyGSM -version=0.10.2 +version=0.10.3 author=Volodymyr Shymanskyy maintainer=Volodymyr Shymanskyy sentence=A small Arduino library for GPRS modules, that just works. diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index 4878afa..4c47d38 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -392,7 +392,19 @@ class TinyGsmSim800 : public TinyGsmModem, * SIM card functions */ protected: - // Able to follow all SIM card functions as inherited from the template + // May not return the "+CCID" before the number + String getSimCCIDImpl() { + sendAT(GF("+CCID")); + if (waitResponse(GF(GSM_NL)) != 1) { + return ""; + } + String res = stream.readStringUntil('\n'); + waitResponse(); + // Trim out the CCID header in case it is there + res.replace("CCID:", ""); + res.trim(); + return res; + } /* * Phone Call functions diff --git a/src/TinyGsmCommon.h b/src/TinyGsmCommon.h index 00679f1..f24dca3 100644 --- a/src/TinyGsmCommon.h +++ b/src/TinyGsmCommon.h @@ -10,7 +10,7 @@ #define SRC_TINYGSMCOMMON_H_ // The current library version number -#define TINYGSM_VERSION "0.10.2" +#define TINYGSM_VERSION "0.10.3" #if defined(SPARK) || defined(PARTICLE) #include "Particle.h"