Extra braces

This commit is contained in:
Sara Damiano
2019-08-28 19:36:53 -04:00
parent bf9bd36080
commit a55dbaa7db
5 changed files with 37 additions and 23 deletions

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!"); if (ssl) {
int rsp; 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) {

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,

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 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!");
}
int rsp; int rsp;
uint32_t timeout_ms = ((uint32_t)timeout_s)*1000; uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000;
sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port); sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","),
rsp = waitResponse(timeout_ms, port);
GF("CONNECT OK" GSM_NL), rsp = waitResponse(
GF("CONNECT FAIL" GSM_NL), timeout_ms, GF("CONNECT OK" GSM_NL), GF("CONNECT FAIL" GSM_NL),
GF("ALREADY CONNECT" GSM_NL), GF("ALREADY CONNECT" GSM_NL), GF("ERROR" GSM_NL),
GF("ERROR" GSM_NL), GF("CLOSE OK" GSM_NL) // Happens when HTTPS handshake fails
GF("CLOSE OK" GSM_NL) // Happens when HTTPS handshake fails );
); return (1 == rsp);
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) {

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) {

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();