Browse Source

Removed recursive calls to maitain (shouldn't I have leared)

v_master
Sara Damiano 5 years ago
parent
commit
99a5b3938c
6 changed files with 21 additions and 39 deletions
  1. +0
    -4
      src/TinyGsmClientBG96.h
  2. +0
    -4
      src/TinyGsmClientM95.h
  3. +0
    -4
      src/TinyGsmClientMC60.h
  4. +0
    -4
      src/TinyGsmClientSIM7000.h
  5. +0
    -4
      src/TinyGsmClientSIM800.h
  6. +21
    -19
      src/TinyGsmClientUBLOX.h

+ 0
- 4
src/TinyGsmClientBG96.h View File

@ -656,7 +656,6 @@ protected:
return 0;
}
// TODO: Wait for ACK? AT+QISEND=id,0
maintain(); // look for a very quick response from the remote
return len;
}
@ -675,7 +674,6 @@ protected:
}
waitResponse();
DBG("### READ:", len, "from", mux);
maintain(); // Listen for a close or other URC
return len;
}
@ -692,7 +690,6 @@ protected:
if (!result) {
sockets[mux]->sock_connected = modemGetConnected(mux);
}
maintain(); // Listen for a close or other URC
return result;
}
@ -711,7 +708,6 @@ protected:
int res = stream.readStringUntil(',').toInt(); // socket state
waitResponse();
maintain(); // Listen for a close or other URC
// 0 Initial, 1 Opening, 2 Connected, 3 Listening, 4 Closing
return 2 == res;


+ 0
- 4
src/TinyGsmClientM95.h View File

@ -708,7 +708,6 @@ protected:
}
}
waitResponse(5000L);
maintain(); // look for a very quick response from the remote
// streamSkipUntil(','); // Skip mux
// return stream.readStringUntil('\n').toInt();
@ -730,7 +729,6 @@ protected:
}
waitResponse();
DBG("### READ:", len, "from", mux);
maintain(); // Listen for a close or other URC
return len;
}
@ -747,7 +745,6 @@ protected:
if (!result) {
sockets[mux]->sock_connected = modemGetConnected(mux);
}
maintain(); // Listen for a close or other URC
return result;
}
@ -766,7 +763,6 @@ protected:
int res = stream.readStringUntil(',').toInt(); // socket state
waitResponse();
maintain(); // Listen for a close or other URC
// 0 Initial, 1 Opening, 2 Connected, 3 Listening, 4 Closing
return 2 == res;


+ 0
- 4
src/TinyGsmClientMC60.h View File

@ -740,7 +740,6 @@ protected:
// streamSkipUntil(','); // Skip mux
// return stream.readStringUntil('\n').toInt();
maintain(); // look for a very quick response from the remote
return len; // TODO
}
@ -759,7 +758,6 @@ protected:
}
waitResponse();
DBG("### READ:", len, "from", mux);
maintain(); // Listen for a close or other URC
return len;
}
@ -776,7 +774,6 @@ protected:
if (!result) {
sockets[mux]->sock_connected = modemGetConnected(mux);
}
maintain(); // Listen for a close or other URC
return result;
}
@ -795,7 +792,6 @@ protected:
int res = stream.readStringUntil(',').toInt(); // socket state
waitResponse();
maintain(); // Listen for a close or other URC
// 0 Initial, 1 Opening, 2 Connected, 3 Listening, 4 Closing
return 2 == res;


+ 0
- 4
src/TinyGsmClientSIM7000.h View File

@ -960,7 +960,6 @@ protected:
return 0;
}
streamSkipUntil(','); // Skip mux
maintain(); // look for a very quick response from the remote
return stream.readStringUntil('\n').toInt();
}
@ -1003,7 +1002,6 @@ protected:
}
waitResponse();
DBG("### READ:", len_confirmed, "from", mux);
maintain(); // Listen for a close or other URC
return len_confirmed;
}
@ -1019,7 +1017,6 @@ protected:
if (!result) {
sockets[mux]->sock_connected = modemGetConnected(mux);
}
maintain(); // Listen for a close or other URC
return result;
}
@ -1027,7 +1024,6 @@ protected:
sendAT(GF("+CIPSTATUS="), mux);
int res = waitResponse(GF(",\"CONNECTED\""), GF(",\"CLOSED\""), GF(",\"CLOSING\""), GF(",\"INITIAL\""));
waitResponse();
maintain(); // Listen for a close or other URC
return 1 == res;
}


+ 0
- 4
src/TinyGsmClientSIM800.h View File

@ -883,7 +883,6 @@ protected:
return 0;
}
streamSkipUntil(','); // Skip mux
maintain(); // look for a very quick response from the remote
return stream.readStringUntil('\n').toInt();
}
@ -926,7 +925,6 @@ protected:
}
waitResponse();
DBG("### READ:", len_confirmed, "from", mux);
maintain(); // Listen for a close or other URC
return len_confirmed;
}
@ -942,7 +940,6 @@ protected:
if (!result) {
sockets[mux]->sock_connected = modemGetConnected(mux);
}
maintain(); // Listen for a close or other URC
return result;
}
@ -950,7 +947,6 @@ protected:
sendAT(GF("+CIPSTATUS="), mux);
int res = waitResponse(GF(",\"CONNECTED\""), GF(",\"CLOSED\""), GF(",\"CLOSING\""), GF(",\"INITIAL\""));
waitResponse();
maintain(); // Listen for a close or other URC
return 1 == res;
}


+ 21
- 19
src/TinyGsmClientUBLOX.h View File

@ -62,8 +62,8 @@ public:
sock_connected = false;
got_data = false;
// Don't attach the socket here because we won't know the mux channel number
// until the u-blox assigns it upon opening the socket
at->sockets[mux] = this;
return true;
}
@ -88,11 +88,14 @@ public:
}
TINY_GSM_YIELD();
rx.clear();
// sock_connected = at->modemConnect(host, port, mux);
uint8_t oldMux = mux;
sock_connected = at->modemConnect(host, port, &mux);
if (mux != oldMux) {
DBG("WARNING: Mux number changed from", oldMux, "to", mux);
at->sockets[oldMux] = NULL;
}
at->sockets[mux] = this;
// Attach the socket after attempting connection because u-blox will assign
// whatever mux number is next regardless of the number requested.
at->maintain();
return sock_connected;
}
@ -276,15 +279,8 @@ public:
#endif
waitResponse();
String name = getModemName();
DBG(GF("### Modem:"), name);
if (name.startsWith("u-blox SARA-R4") or name.startsWith("u-blox SARA-N4")) {
DBG(GF("### This is an LTE-M modem!"), name);
isCatM = true;
}
else if (name.startsWith("u-blox SARA-N2")) {
DBG(GF("### SARA N2 NB-IoT modems not supported!"), name);
}
getModemName();
int ret = getSimStatus();
// if the sim isn't ready and a pin has been provided, try to unlock the sim
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
@ -317,8 +313,18 @@ public:
}
res2.replace(GSM_NL "OK" GSM_NL, "");
res2.trim();
String name = res1 + String(' ') + res2;
DBG("### Modem:", name);
if (name.startsWith("u-blox SARA-R4") or name.startsWith("u-blox SARA-N4")) {
DBG("### This is an LTE-M modem!");
isCatM = true;
}
else if (name.startsWith("u-blox SARA-N2")) {
DBG("### SARA N2 NB-IoT modems not supported!");
}
return res1 + String(' ') + res2;
return name;
}
void setBaud(unsigned long baud) {
@ -835,7 +841,6 @@ protected:
streamSkipUntil(','); // Skip mux
int sent = stream.readStringUntil('\n').toInt();
waitResponse(); // sends back OK after the confirmation of number sent
maintain(); // look for a very quick response from the remote
return sent;
}
@ -857,7 +862,6 @@ protected:
streamSkipUntil('\"');
waitResponse();
DBG("### READ:", len, "from", mux);
maintain(); // Listen for a close or other URC
return len;
}
@ -876,7 +880,6 @@ protected:
if (!result && res != 2 && res != 3) { // Don't check modemGetConnected after an error
sockets[mux]->sock_connected = modemGetConnected(mux);
}
maintain(); // Listen for a close or other URC
return result;
}
@ -902,7 +905,6 @@ protected:
// 9: the socket is in LAST_ACK status
// 10: the socket is in TIME_WAIT status
waitResponse();
maintain(); // Listen for a close or other URC
return (result != 0);
}


Loading…
Cancel
Save