From 36568bb595d9878675154f9d85f940a1c9b72c1f Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Mon, 11 Sep 2017 19:21:56 +0300 Subject: [PATCH] Fix getSimCCID, getModemInfo --- TinyGsmClientA6.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/TinyGsmClientA6.h b/TinyGsmClientA6.h index 15e8367..cc0eaac 100644 --- a/TinyGsmClientA6.h +++ b/TinyGsmClientA6.h @@ -221,6 +221,16 @@ public: return waitResponse() == 1; } + String getModemInfo() { + sendAT(GF("I")); + String res; + if (waitResponse(1000L, res) != 1) { + return ""; + } + res.trim(); + return res; + } + /* * Power functions */ @@ -250,7 +260,7 @@ public: String getSimCCID() { sendAT(GF("+CCID")); - if (waitResponse(GF(GSM_NL "+ICCID:")) != 1) { + if (waitResponse(GF(GSM_NL "+SCID: SIM Card ID:")) != 1) { return ""; } String res = stream.readStringUntil('\n'); @@ -641,7 +651,9 @@ public: data = ""; } else if (data.endsWith(GF("+TCPCLOSED:"))) { int mux = stream.readStringUntil('\n').toInt(); - sockets[mux]->sock_connected = false; + if (mux >= 0 && mux < TINY_GSM_MUX_COUNT) { + sockets[mux]->sock_connected = false; + } data = ""; DBG("### Closed: ", mux); }