From ba9a03a41da5dfe66597933d8e7a60b5513db71c Mon Sep 17 00:00:00 2001 From: Frederik Held Date: Sat, 29 Feb 2020 00:21:45 +0100 Subject: [PATCH 1/5] Fixes typo in comment --- examples/mqtt_esp8266/mqtt_esp8266.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/mqtt_esp8266/mqtt_esp8266.ino b/examples/mqtt_esp8266/mqtt_esp8266.ino index a8c3b0e..2310166 100644 --- a/examples/mqtt_esp8266/mqtt_esp8266.ino +++ b/examples/mqtt_esp8266/mqtt_esp8266.ino @@ -35,7 +35,7 @@ // Create an ESP8266 WiFiClient class to connect to the MQTT server. WiFiClient client; -// or... use WiFiFlientSecure for SSL +// or... use WiFiClientSecure for SSL //WiFiClientSecure client; // Setup the MQTT client class by passing in the WiFi client and MQTT server and login details. From c5599bfabc96bb865fc415c00788ca4a220fa3dd Mon Sep 17 00:00:00 2001 From: Chris Mumford Date: Thu, 2 Jul 2020 10:02:15 -0700 Subject: [PATCH 2/5] Corrected client public/private methods. Switched the following four methods from public to protected in Adafruit_MQTT_Client and Adafruit_MQTT_FONA: 1. connectServer 2. disconnectServer 3. readPacket 4. sendPacket When public (previously) they could be called by users of this library, which is not the intent of this API. --- Adafruit_MQTT_Client.h | 13 ++++++++----- Adafruit_MQTT_FONA.h | 20 +++++++++++--------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Adafruit_MQTT_Client.h b/Adafruit_MQTT_Client.h index 5d23e03..6ede1d6 100644 --- a/Adafruit_MQTT_Client.h +++ b/Adafruit_MQTT_Client.h @@ -41,11 +41,14 @@ public: const char *user = "", const char *pass = "") : Adafruit_MQTT(server, port, user, pass), client(client) {} - bool connectServer(); - bool disconnectServer(); - bool connected(); - uint16_t readPacket(uint8_t *buffer, uint16_t maxlen, int16_t timeout); - bool sendPacket(uint8_t *buffer, uint16_t len); + bool connected() override; + +protected: + bool connectServer() override; + bool disconnectServer() override; + uint16_t readPacket(uint8_t *buffer, uint16_t maxlen, + int16_t timeout) override; + bool sendPacket(uint8_t *buffer, uint16_t len) override; private: Client *client; diff --git a/Adafruit_MQTT_FONA.h b/Adafruit_MQTT_FONA.h index 422aa03..52e25ba 100644 --- a/Adafruit_MQTT_FONA.h +++ b/Adafruit_MQTT_FONA.h @@ -42,7 +42,13 @@ public: const char *user = "", const char *pass = "") : Adafruit_MQTT(server, port, user, pass), fona(f) {} - bool connectServer() { + bool connected() { + // Return true if connected, false if not connected. + return fona->TCPconnected(); + } + +protected: + bool connectServer() override { char server[40]; strncpy(server, servername, 40); #ifdef ADAFRUIT_SLEEPYDOG_H @@ -54,14 +60,10 @@ public: return fona->TCPconnect(server, portnum); } - bool disconnectServer() { return fona->TCPclose(); } + bool disconnectServer() override { return fona->TCPclose(); } - bool connected() { - // Return true if connected, false if not connected. - return fona->TCPconnected(); - } - - uint16_t readPacket(uint8_t *buffer, uint16_t maxlen, int16_t timeout) { + uint16_t readPacket(uint8_t *buffer, uint16_t maxlen, + int16_t timeout) override { uint8_t *buffp = buffer; DEBUG_PRINTLN(F("Reading data..")); @@ -114,7 +116,7 @@ public: return len; } - bool sendPacket(uint8_t *buffer, uint16_t len) { + bool sendPacket(uint8_t *buffer, uint16_t len) override { DEBUG_PRINTLN(F("Writing packet")); if (fona->TCPconnected()) { boolean ret = fona->TCPsend((char *)buffer, len); From 4b360f2522bb261b8d993259f40e0ebb5bca6ea0 Mon Sep 17 00:00:00 2001 From: Morgan <7806037+mlwinters@users.noreply.github.com> Date: Wed, 23 Sep 2020 09:51:56 +0100 Subject: [PATCH 3/5] Added support for the MKR1010 Added support for the Arduino MKR1010 --- Adafruit_MQTT.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Adafruit_MQTT.cpp b/Adafruit_MQTT.cpp index f895b58..fa93676 100644 --- a/Adafruit_MQTT.cpp +++ b/Adafruit_MQTT.cpp @@ -21,7 +21,7 @@ // SOFTWARE. #include "Adafruit_MQTT.h" -#if defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || \ +#if defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKR1010) || \ defined(ARDUINO_ARCH_SAMD) static char *dtostrf(double val, signed char width, unsigned char prec, char *sout) { From f1f515651f7ee1bcffe25ede4c9a8dc799e51838 Mon Sep 17 00:00:00 2001 From: Morgan <7806037+mlwinters@users.noreply.github.com> Date: Wed, 23 Sep 2020 10:27:06 +0100 Subject: [PATCH 4/5] Moved defined(ARDUINO_SAMD_MKR1010) to line 25 Move "defined(ARDUINO_SAMD_MKR1010)" from lilne 24 to line 25 --- Adafruit_MQTT.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Adafruit_MQTT.cpp b/Adafruit_MQTT.cpp index fa93676..4e98c4a 100644 --- a/Adafruit_MQTT.cpp +++ b/Adafruit_MQTT.cpp @@ -21,8 +21,8 @@ // SOFTWARE. #include "Adafruit_MQTT.h" -#if defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKR1010) || \ - defined(ARDUINO_ARCH_SAMD) +#if defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || \ + defined(ARDUINO_SAMD_MKR1010) || defined(ARDUINO_ARCH_SAMD) static char *dtostrf(double val, signed char width, unsigned char prec, char *sout) { char fmt[20]; From c7f716cf5d826c83c3a3f654e4fca67a4edae5e6 Mon Sep 17 00:00:00 2001 From: Dylan Herrada <33632497+dherrada@users.noreply.github.com> Date: Wed, 30 Sep 2020 15:21:46 -0400 Subject: [PATCH 5/5] Bump to 2.0.0 --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index b70fdaa..dc4c4ee 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit MQTT Library -version=1.3.0 +version=2.0.0 author=Adafruit maintainer=Adafruit sentence=MQTT library that supports the FONA, ESP8266, Yun, and generic Arduino Client hardware.