sim7000 syntax fix

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
Sara Damiano
2021-04-29 15:43:21 -04:00
parent 9128baeb27
commit 93fc96d9ec

View File

@@ -189,10 +189,7 @@ public:
* Constructor
*/
public:
explicit TinyGsmSim7000(Stream& stream):
stream(stream),
certificates()
{
explicit TinyGsmSim7000(Stream& stream) : stream(stream), certificates() {
memset(sockets, 0, sizeof(sockets));
}
@@ -625,9 +622,9 @@ public:
sendAT(GF("+CSSLCFG=\"ctxindex\",0"));
if (waitResponse() != 1) return false;
if (certificates[mux] != "")
{
sendAT(GF("+CASSLCFG="), mux, ",CACERT,\"", certificates[mux].c_str(),"\"");
if (certificates[mux] != "") {
sendAT(GF("+CASSLCFG="), mux, ",CACERT,\"", certificates[mux].c_str(),
"\"");
if (waitResponse() != 1) return false;
}
}
@@ -654,20 +651,14 @@ public:
int16_t modemSend(const void* buff, size_t len, uint8_t mux) {
sendAT(GF("+CASEND="), mux, ',', (uint16_t)len);
if (waitResponse(GF(">")) != 1) {
return 0;
}
if (waitResponse(GF(">")) != 1) { return 0; }
stream.write(reinterpret_cast<const uint8_t*>(buff), len);
stream.flush();
if (waitResponse(GF(GSM_NL "+CASEND:")) != 1) {
return 0;
}
if (waitResponse(GF(GSM_NL "+CASEND:")) != 1) { return 0; }
streamSkipUntil(','); // Skip mux
if (streamGetIntBefore(',') != 0) {
return 0;
} // If result != success
if (streamGetIntBefore(',') != 0) { return 0; } // If result != success
return streamGetIntBefore('\n');
}
@@ -742,9 +733,7 @@ public:
sendAT(GF("+CASTATE?"));
int8_t readMux = -1;
while (readMux != mux) {
if (waitResponse(3000, GF("+CASTATE:"),GF(GSM_OK)) != 1) {
return 0;
}
if (waitResponse(3000, GF("+CASTATE:"), GFP(GSM_OK)) != 1) { return 0; }
readMux = streamGetIntBefore(',');
}
int8_t res = streamGetIntBefore('\n');
@@ -857,8 +846,7 @@ public:
int8_t mux = streamGetIntBefore(',');
int8_t state = streamGetIntBefore('\n');
if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) {
if (state != 1)
{
if (state != 1) {
sockets[mux]->sock_connected = false;
DBG("### Closed: ", mux);
}