Fix getSimCCID, getModemInfo

This commit is contained in:
Volodymyr Shymanskyy
2017-09-11 19:21:56 +03:00
parent 1b5884dcb7
commit 36568bb595

View File

@@ -221,6 +221,16 @@ public:
return waitResponse() == 1; return waitResponse() == 1;
} }
String getModemInfo() {
sendAT(GF("I"));
String res;
if (waitResponse(1000L, res) != 1) {
return "";
}
res.trim();
return res;
}
/* /*
* Power functions * Power functions
*/ */
@@ -250,7 +260,7 @@ public:
String getSimCCID() { String getSimCCID() {
sendAT(GF("+CCID")); sendAT(GF("+CCID"));
if (waitResponse(GF(GSM_NL "+ICCID:")) != 1) { if (waitResponse(GF(GSM_NL "+SCID: SIM Card ID:")) != 1) {
return ""; return "";
} }
String res = stream.readStringUntil('\n'); String res = stream.readStringUntil('\n');
@@ -641,7 +651,9 @@ public:
data = ""; data = "";
} else if (data.endsWith(GF("+TCPCLOSED:"))) { } else if (data.endsWith(GF("+TCPCLOSED:"))) {
int mux = stream.readStringUntil('\n').toInt(); 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 = ""; data = "";
DBG("### Closed: ", mux); DBG("### Closed: ", mux);
} }