From a55dbaa7dbedba28aa51d48dd43e2c96ed420ed8 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 28 Aug 2019 19:36:53 -0400 Subject: [PATCH] Extra braces --- src/TinyGsmClientBG96.h | 12 ++++++++---- src/TinyGsmClientM95.h | 6 ++++-- src/TinyGsmClientSIM7000.h | 31 ++++++++++++++++--------------- src/TinyGsmClientSIM7600.h | 5 ++++- src/TinyGsmClientXBee.h | 8 ++++++-- 5 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/TinyGsmClientBG96.h b/src/TinyGsmClientBG96.h index 5964e64..521e5db 100644 --- a/src/TinyGsmClientBG96.h +++ b/src/TinyGsmClientBG96.h @@ -509,10 +509,12 @@ TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED() 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) { - 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; // (1-16), (0-11),"TCP/UDP/TCP LISTENER/UDP SERVICE", @@ -570,7 +572,9 @@ protected: streamSkipUntil(','); // Skip total received streamSkipUntil(','); // Skip have read result = stream.readStringUntil('\n').toInt(); - if (result) DBG("### DATA AVAILABLE:", result, "on", mux); + if (result) { + DBG("### DATA AVAILABLE:", result, "on", mux); + } waitResponse(); } if (!result) { diff --git a/src/TinyGsmClientM95.h b/src/TinyGsmClientM95.h index 7e9bf93..4d47b8d 100644 --- a/src/TinyGsmClientM95.h +++ b/src/TinyGsmClientM95.h @@ -572,9 +572,11 @@ TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED() 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) { - 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; sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port); int rsp = waitResponse(timeout_ms, diff --git a/src/TinyGsmClientSIM7000.h b/src/TinyGsmClientSIM7000.h index 90602db..ac4bc29 100644 --- a/src/TinyGsmClientSIM7000.h +++ b/src/TinyGsmClientSIM7000.h @@ -813,21 +813,22 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() 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) { diff --git a/src/TinyGsmClientSIM7600.h b/src/TinyGsmClientSIM7600.h index 0a344ed..649c6dc 100644 --- a/src/TinyGsmClientSIM7600.h +++ b/src/TinyGsmClientSIM7600.h @@ -655,9 +655,12 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() */ protected: + bool modemConnect(const char* host, uint16_t port, uint8_t mux, 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 sendAT(GF("+CIPRXGET=1")); if (waitResponse() != 1) { diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index 5d14c96..ed9a8f2 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -925,7 +925,9 @@ public: bool ssl = false, int timeout_s = 75) { 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 savedOperatingIP = IPAddress(0, 0, 0, 0); @@ -974,7 +976,9 @@ public: } 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.flush();