diff --git a/CHANGES.txt b/CHANGES.txt index e23d5315..2c27d9ca 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,5 @@ +2.9 + * Add ability to use function for callback not just for ESP boards 2.8 * Add setBufferSize() to override MQTT_MAX_PACKET_SIZE * Add setKeepAlive() to override MQTT_KEEPALIVE diff --git a/README.md b/README.md index 2e131718..915de4c8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ +## ThingsBoard note + +This is a fork of the main repository, which was last updated in 2020. +Since we have an SDK based on this client, we decided to continue with this repository. +We also believe that this library provides a lot of opportunities for people who want to build their own IoT devices. +As with our other open source repositories, we appreciate every contribution to this library. + + # Arduino Client for MQTT This library provides a client for doing simple publish/subscribe messaging with @@ -14,13 +22,13 @@ Full API documentation is available here: https://pubsubclient.knolleary.net - It can only publish QoS 0 messages. It can subscribe at QoS 0 or QoS 1. - The maximum message size, including header, is **256 bytes** by default. This - is configurable via `MQTT_MAX_PACKET_SIZE` in `PubSubClient.h` or can be changed - by calling `PubSubClient::setBufferSize(size)`. + is configurable via `MQTT_MAX_PACKET_SIZE` in `TBPubSubClient.h` or can be changed + by calling `TBPubSubClient::setBufferSize(size)`. - The keepalive interval is set to 15 seconds by default. This is configurable - via `MQTT_KEEPALIVE` in `PubSubClient.h` or can be changed by calling - `PubSubClient::setKeepAlive(keepAlive)`. + via `MQTT_KEEPALIVE` in `TBPubSubClient.h` or can be changed by calling + `TBPubSubClient::setKeepAlive(keepAlive)`. - The client uses MQTT 3.1.1 by default. It can be changed to use MQTT 3.1 by - changing value of `MQTT_VERSION` in `PubSubClient.h`. + changing value of `MQTT_VERSION` in `TBPubSubClient.h`. ## Compatible Hardware @@ -34,7 +42,7 @@ boards and shields, including: - Arduino YUN – use the included `YunClient` in place of `EthernetClient`, and be sure to do a `Bridge.begin()` first - Arduino WiFi Shield - if you want to send packets > 90 bytes with this shield, - enable the `MQTT_MAX_TRANSFER_SIZE` define in `PubSubClient.h`. + enable the `MQTT_MAX_TRANSFER_SIZE` define in `TBPubSubClient.h`. - Sparkfun WiFly Shield – [library](https://github.com/dpslwk/WiFly) - TI CC3000 WiFi - [library](https://github.com/sparkfun/SFE_CC3000_Library) - Intel Galileo/Edison diff --git a/examples/mqtt_auth/mqtt_auth.ino b/examples/mqtt_auth/mqtt_auth.ino index 04bd7bb2..93bfb5d1 100755 --- a/examples/mqtt_auth/mqtt_auth.ino +++ b/examples/mqtt_auth/mqtt_auth.ino @@ -9,7 +9,7 @@ #include <SPI.h> #include <Ethernet.h> -#include <PubSubClient.h> +#include <TBPubSubClient.h> // Update these with values suitable for your network. byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; diff --git a/examples/mqtt_basic/mqtt_basic.ino b/examples/mqtt_basic/mqtt_basic.ino index f545adef..a62f9b7a 100755 --- a/examples/mqtt_basic/mqtt_basic.ino +++ b/examples/mqtt_basic/mqtt_basic.ino @@ -15,7 +15,7 @@ #include <SPI.h> #include <Ethernet.h> -#include <PubSubClient.h> +#include <TBPubSubClient.h> // Update these with values suitable for your network. byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; diff --git a/examples/mqtt_esp8266/mqtt_esp8266.ino b/examples/mqtt_esp8266/mqtt_esp8266.ino index 7e6effd2..979995cc 100644 --- a/examples/mqtt_esp8266/mqtt_esp8266.ino +++ b/examples/mqtt_esp8266/mqtt_esp8266.ino @@ -19,7 +19,7 @@ */ #include <ESP8266WiFi.h> -#include <PubSubClient.h> +#include <TBPubSubClient.h> // Update these with values suitable for your network. diff --git a/examples/mqtt_large_message/mqtt_large_message.ino b/examples/mqtt_large_message/mqtt_large_message.ino index e048c3ed..5bbe8e0f 100644 --- a/examples/mqtt_large_message/mqtt_large_message.ino +++ b/examples/mqtt_large_message/mqtt_large_message.ino @@ -25,7 +25,7 @@ */ #include <ESP8266WiFi.h> -#include <PubSubClient.h> +#include <TBPubSubClient.h> // Update these with values suitable for your network. diff --git a/examples/mqtt_publish_in_callback/mqtt_publish_in_callback.ino b/examples/mqtt_publish_in_callback/mqtt_publish_in_callback.ino index 42afb2a3..12feac86 100644 --- a/examples/mqtt_publish_in_callback/mqtt_publish_in_callback.ino +++ b/examples/mqtt_publish_in_callback/mqtt_publish_in_callback.ino @@ -16,7 +16,7 @@ #include <SPI.h> #include <Ethernet.h> -#include <PubSubClient.h> +#include <TBPubSubClient.h> // Update these with values suitable for your network. byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; diff --git a/examples/mqtt_reconnect_nonblocking/mqtt_reconnect_nonblocking.ino b/examples/mqtt_reconnect_nonblocking/mqtt_reconnect_nonblocking.ino index 080b7391..1b57ba89 100644 --- a/examples/mqtt_reconnect_nonblocking/mqtt_reconnect_nonblocking.ino +++ b/examples/mqtt_reconnect_nonblocking/mqtt_reconnect_nonblocking.ino @@ -10,7 +10,7 @@ #include <SPI.h> #include <Ethernet.h> -#include <PubSubClient.h> +#include <TBPubSubClient.h> // Update these with values suitable for your hardware/network. byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; diff --git a/examples/mqtt_stream/mqtt_stream.ino b/examples/mqtt_stream/mqtt_stream.ino index 67c22872..ab271c0d 100644 --- a/examples/mqtt_stream/mqtt_stream.ino +++ b/examples/mqtt_stream/mqtt_stream.ino @@ -11,7 +11,7 @@ #include <SPI.h> #include <Ethernet.h> -#include <PubSubClient.h> +#include <TBPubSubClient.h> #include <SRAM.h> // Update these with values suitable for your network. diff --git a/library.json b/library.json index c0d7bae2..82628fad 100644 --- a/library.json +++ b/library.json @@ -1,18 +1,19 @@ { - "name": "PubSubClient", - "keywords": "ethernet, mqtt, m2m, iot", + "name": "TBPubSubClient", + "keywords": "ethernet, mqtt, m2m, iot, thingsboard, messages", "description": "A client library for MQTT messaging. MQTT is a lightweight messaging protocol ideal for small devices. This library allows you to send and receive MQTT messages. It supports the latest MQTT 3.1.1 protocol and can be configured to use the older MQTT 3.1 if needed. It supports all Arduino Ethernet Client compatible hardware, including the Intel Galileo/Edison, ESP8266 and TI CC3000.", "repository": { "type": "git", - "url": "https://github.com/knolleary/pubsubclient.git" + "url": "https://github.com/thingsboard/pubsubclient.git" }, - "version": "2.8", + "version": "2.9.1", "exclude": "tests", "examples": "examples/*/*.ino", "frameworks": "arduino", "platforms": [ "atmelavr", "espressif8266", - "espressif32" + "espressif32", + "rp2040" ] } diff --git a/library.properties b/library.properties index e47ffe92..1125c05f 100644 --- a/library.properties +++ b/library.properties @@ -1,7 +1,7 @@ -name=PubSubClient -version=2.8 +name=TBPubSubClient +version=2.9.1 author=Nick O'Leary <nick.oleary@gmail.com> -maintainer=Nick O'Leary <nick.oleary@gmail.com> +maintainer=ThingsBoard Team sentence=A client library for MQTT messaging. paragraph=MQTT is a lightweight messaging protocol ideal for small devices. This library allows you to send and receive MQTT messages. It supports the latest MQTT 3.1.1 protocol and can be configured to use the older MQTT 3.1 if needed. It supports all Arduino Ethernet Client compatible hardware, including the Intel Galileo/Edison, ESP8266 and TI CC3000. category=Communication diff --git a/src/PubSubClient.cpp b/src/TBPubSubClient.cpp similarity index 99% rename from src/PubSubClient.cpp rename to src/TBPubSubClient.cpp index 2b48d2b6..7b8b949d 100755 --- a/src/PubSubClient.cpp +++ b/src/TBPubSubClient.cpp @@ -5,7 +5,7 @@ http://knolleary.net */ -#include "PubSubClient.h" +#include "TBPubSubClient.h" #include "Arduino.h" PubSubClient::PubSubClient() { diff --git a/src/PubSubClient.h b/src/TBPubSubClient.h similarity index 98% rename from src/PubSubClient.h rename to src/TBPubSubClient.h index 24740540..ad74802c 100755 --- a/src/PubSubClient.h +++ b/src/TBPubSubClient.h @@ -1,11 +1,11 @@ /* - PubSubClient.h - A simple client for MQTT. + TBPubSubClient.h - A simple client for MQTT. Nick O'Leary http://knolleary.net */ -#ifndef PubSubClient_h -#define PubSubClient_h +#ifndef TBPubSubClient_h +#define TBPubSubClient_h #include <Arduino.h> #include "IPAddress.h" diff --git a/tests/src/connect_spec.cpp b/tests/src/connect_spec.cpp index e8545c49..774e60db 100644 --- a/tests/src/connect_spec.cpp +++ b/tests/src/connect_spec.cpp @@ -1,4 +1,4 @@ -#include "PubSubClient.h" +#include "TBPubSubClient.h" #include "ShimClient.h" #include "Buffer.h" #include "BDDTest.h" diff --git a/tests/src/keepalive_spec.cpp b/tests/src/keepalive_spec.cpp index ea643cf1..f09c6ede 100644 --- a/tests/src/keepalive_spec.cpp +++ b/tests/src/keepalive_spec.cpp @@ -1,4 +1,4 @@ -#include "PubSubClient.h" +#include "TBPubSubClient.h" #include "ShimClient.h" #include "Buffer.h" #include "BDDTest.h" diff --git a/tests/src/publish_spec.cpp b/tests/src/publish_spec.cpp index ee3d3bed..6ae55832 100644 --- a/tests/src/publish_spec.cpp +++ b/tests/src/publish_spec.cpp @@ -1,4 +1,4 @@ -#include "PubSubClient.h" +#include "TBPubSubClient.h" #include "ShimClient.h" #include "Buffer.h" #include "BDDTest.h" diff --git a/tests/src/receive_spec.cpp b/tests/src/receive_spec.cpp index 93e909ae..546ad4a1 100644 --- a/tests/src/receive_spec.cpp +++ b/tests/src/receive_spec.cpp @@ -1,4 +1,4 @@ -#include "PubSubClient.h" +#include "TBPubSubClient.h" #include "ShimClient.h" #include "Buffer.h" #include "BDDTest.h" diff --git a/tests/src/subscribe_spec.cpp b/tests/src/subscribe_spec.cpp index 22dc8a44..10d98e02 100644 --- a/tests/src/subscribe_spec.cpp +++ b/tests/src/subscribe_spec.cpp @@ -1,4 +1,4 @@ -#include "PubSubClient.h" +#include "TBPubSubClient.h" #include "ShimClient.h" #include "Buffer.h" #include "BDDTest.h"