From d06031a89c6a57da888e16c260cd1baa663bef60 Mon Sep 17 00:00:00 2001 From: SRGDamia1 Date: Thu, 4 May 2017 15:54:15 -0400 Subject: [PATCH] Removed everything but cleaning up the debugging --- TinyGsmClientA6.h | 4 +--- TinyGsmClientESP8266.h | 5 ++--- TinyGsmClientSIM800.h | 5 ++--- TinyGsmClientXBee.h | 19 +++++++------------ 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/TinyGsmClientA6.h b/TinyGsmClientA6.h index 79e3680..e7549bf 100644 --- a/TinyGsmClientA6.h +++ b/TinyGsmClientA6.h @@ -539,10 +539,8 @@ public: } private: - int modemConnect(const char* host, uint16_t port, uint8_t* mux, bool isUDP=false) { + int modemConnect(const char* host, uint16_t port, uint8_t* mux) { sendAT(GF("+CIPSTART="), GF("\"TCP"), GF("\",\""), host, GF("\","), port); - if (isUDP) sendAT(GF("+CIPSTART="), GF("\"UDP"), GF("\",\""), host, GF("\","), port); - else sendAT(GF("+CIPSTART="), GF("\"TCP"), GF("\",\""), host, GF("\","), port); if (waitResponse(75000L, GF(GSM_NL "+CIPNUM:")) != 1) { return -1; diff --git a/TinyGsmClientESP8266.h b/TinyGsmClientESP8266.h index 989d8ca..a911f91 100644 --- a/TinyGsmClientESP8266.h +++ b/TinyGsmClientESP8266.h @@ -370,9 +370,8 @@ public: } private: - int modemConnect(const char* host, uint16_t port, uint8_t mux, bool isUDP=false) { - if (isUDP) sendAT(GF("+CIPSTART="), mux, ',', GF("\"UDP"), GF("\",\""), host, GF("\","), port, GF(",120")); - else sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port, GF(",120")); + int modemConnect(const char* host, uint16_t port, uint8_t mux) { + sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port, GF(",120")); int rsp = waitResponse(75000L, GFP(GSM_OK), GFP(GSM_ERROR), diff --git a/TinyGsmClientSIM800.h b/TinyGsmClientSIM800.h index 96276cb..62c0bf9 100644 --- a/TinyGsmClientSIM800.h +++ b/TinyGsmClientSIM800.h @@ -636,9 +636,8 @@ public: } private: - int modemConnect(const char* host, uint16_t port, uint8_t mux, bool isUDP=false) { - if (isUDP) sendAT(GF("+CIPSTART="), mux, ',', GF("\"UDP"), GF("\",\""), host, GF("\","), port); - else sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port); + int modemConnect(const char* host, uint16_t port, uint8_t mux) { + sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port); int rsp = waitResponse(75000L, GF("CONNECT OK" GSM_NL), GF("CONNECT FAIL" GSM_NL), diff --git a/TinyGsmClientXBee.h b/TinyGsmClientXBee.h index 0f89478..5ca7a8b 100644 --- a/TinyGsmClientXBee.h +++ b/TinyGsmClientXBee.h @@ -465,16 +465,16 @@ public: } private: - int modemConnect(const char* host, uint16_t port, uint8_t mux = 1, bool isUDP=false) { + int modemConnect(const char* host, uint16_t port, uint8_t mux = 1) { sendAT(GF("LA"), host); String ipadd; ipadd.reserve(16); ipadd = streamReadUntil('\r'); IPAddress ip; ip.fromString(ipadd); - return modemConnect(ip, port, mux, isUDP); + return modemConnect(ip, port); } - int modemConnect(IPAddress ip, uint16_t port, uint8_t mux = 1, bool isUDP=false) { + int modemConnect(IPAddress ip, uint16_t port, uint8_t mux = 1) { String host; host.reserve(16); host += ip[0]; host += "."; @@ -483,16 +483,11 @@ private: host += ip[2]; host += "."; host += ip[3]; - if (isUDP) { - sendAT(GF("IP"), 0); // Put in UDP mode - waitResponse(); - } else { - sendAT(GF("IP"), 1); // Put in TCP mode - waitResponse(); - } - sendAT(GF("DL"), host); + sendAT(GF("IP"), 1); // Put in TCP mode + waitResponse(); + sendAT(GF("DL"), host); // Set the "Destination Address Low" waitResponse(); - sendAT(GF("DE"), String(port, HEX)); + sendAT(GF("DE"), String(port, HEX)); // Set the destination port int rsp = waitResponse(); return rsp; }