Browse Source

Extra braces

v_master
Sara Damiano 5 years ago
parent
commit
a55dbaa7db
5 changed files with 38 additions and 24 deletions
  1. +8
    -4
      src/TinyGsmClientBG96.h
  2. +4
    -2
      src/TinyGsmClientM95.h
  3. +16
    -15
      src/TinyGsmClientSIM7000.h
  4. +4
    -1
      src/TinyGsmClientSIM7600.h
  5. +6
    -2
      src/TinyGsmClientXBee.h

+ 8
- 4
src/TinyGsmClientBG96.h View File

@ -509,10 +509,12 @@ TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED()
protected: protected:
bool modemConnect(const char* host, uint16_t port, uint8_t mux,
bool modemConnect(const char* host, uint16_t port, uint8_t mux,
bool ssl = false, int timeout_s = 20) { bool ssl = false, int timeout_s = 20) {
if (ssl) DBG("SSL not yet supported on this module!");
int rsp;
if (ssl) {
DBG("SSL not yet supported on this module!");
}
int rsp;
uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000; uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000;
// <PDPcontextID>(1-16), <connectID>(0-11),"TCP/UDP/TCP LISTENER/UDP SERVICE", // <PDPcontextID>(1-16), <connectID>(0-11),"TCP/UDP/TCP LISTENER/UDP SERVICE",
@ -570,7 +572,9 @@ protected:
streamSkipUntil(','); // Skip total received streamSkipUntil(','); // Skip total received
streamSkipUntil(','); // Skip have read streamSkipUntil(','); // Skip have read
result = stream.readStringUntil('\n').toInt(); result = stream.readStringUntil('\n').toInt();
if (result) DBG("### DATA AVAILABLE:", result, "on", mux);
if (result) {
DBG("### DATA AVAILABLE:", result, "on", mux);
}
waitResponse(); waitResponse();
} }
if (!result) { if (!result) {


+ 4
- 2
src/TinyGsmClientM95.h View File

@ -572,9 +572,11 @@ TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED()
protected: protected:
bool modemConnect(const char* host, uint16_t port, uint8_t mux,
bool modemConnect(const char* host, uint16_t port, uint8_t mux,
bool ssl = false, int timeout_s = 75) { bool ssl = false, int timeout_s = 75) {
if (ssl) DBG("SSL not yet supported on this module!");
if (ssl) {
DBG("SSL not yet supported on this module!");
}
uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000; uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000;
sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port); sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port);
int rsp = waitResponse(timeout_ms, int rsp = waitResponse(timeout_ms,


+ 16
- 15
src/TinyGsmClientSIM7000.h View File

@ -813,21 +813,22 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
protected: protected:
bool modemConnect(const char* host, uint16_t port, uint8_t mux,
bool ssl = false, int timeout_s = 75) {
if (ssl) DBG("SSL not yet supported on this module!");
int rsp;
uint32_t timeout_ms = ((uint32_t)timeout_s)*1000;
sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port);
rsp = waitResponse(timeout_ms,
GF("CONNECT OK" GSM_NL),
GF("CONNECT FAIL" GSM_NL),
GF("ALREADY CONNECT" GSM_NL),
GF("ERROR" GSM_NL),
GF("CLOSE OK" GSM_NL) // Happens when HTTPS handshake fails
);
return (1 == rsp);
bool modemConnect(const char* host, uint16_t port, uint8_t mux,
bool ssl = false, int timeout_s = 75) {
if (ssl) {
DBG("SSL not yet supported on this module!");
}
int rsp;
uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000;
sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","),
port);
rsp = waitResponse(
timeout_ms, GF("CONNECT OK" GSM_NL), GF("CONNECT FAIL" GSM_NL),
GF("ALREADY CONNECT" GSM_NL), GF("ERROR" GSM_NL),
GF("CLOSE OK" GSM_NL) // Happens when HTTPS handshake fails
);
return (1 == rsp);
} }
int16_t modemSend(const void* buff, size_t len, uint8_t mux) { int16_t modemSend(const void* buff, size_t len, uint8_t mux) {


+ 4
- 1
src/TinyGsmClientSIM7600.h View File

@ -655,9 +655,12 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
*/ */
protected: protected:
bool modemConnect(const char* host, uint16_t port, uint8_t mux, bool modemConnect(const char* host, uint16_t port, uint8_t mux,
bool ssl = false, int timeout_s = 15) { bool ssl = false, int timeout_s = 15) {
if (ssl) DBG("SSL not yet supported on this module!");
if (ssl) {
DBG("SSL not yet supported on this module!");
}
// Make sure we'll be getting data manually on this connection // Make sure we'll be getting data manually on this connection
sendAT(GF("+CIPRXGET=1")); sendAT(GF("+CIPRXGET=1"));
if (waitResponse() != 1) { if (waitResponse() != 1) {


+ 6
- 2
src/TinyGsmClientXBee.h View File

@ -925,7 +925,9 @@ public:
bool ssl = false, int timeout_s = 75) { bool ssl = false, int timeout_s = 75) {
bool success = true; bool success = true;
if (timeout_s != 75) DBG("Timeout doesn't apply here.");
if (timeout_s != 75) {
DBG("Timeout doesn't apply here.");
}
// empty the saved currelty-in-use destination address // empty the saved currelty-in-use destination address
savedOperatingIP = IPAddress(0, 0, 0, 0); savedOperatingIP = IPAddress(0, 0, 0, 0);
@ -974,7 +976,9 @@ public:
} }
int16_t modemSend(const void* buff, size_t len, uint8_t mux = 0) { int16_t modemSend(const void* buff, size_t len, uint8_t mux = 0) {
if (mux != 0) DBG("XBee only supports 1 IP channel in transparent mode!");
if (mux != 0) {
DBG("XBee only supports 1 IP channel in transparent mode!");
}
stream.write((uint8_t*)buff, len); stream.write((uint8_t*)buff, len);
stream.flush(); stream.flush();


Loading…
Cancel
Save