Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate current changes #1

Merged
merged 10 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/mqtt_auth/mqtt_auth.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion examples/mqtt_basic/mqtt_basic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion examples/mqtt_esp8266/mqtt_esp8266.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <TBPubSubClient.h>

// Update these with values suitable for your network.

Expand Down
2 changes: 1 addition & 1 deletion examples/mqtt_large_message/mqtt_large_message.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <TBPubSubClient.h>

// Update these with values suitable for your network.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion examples/mqtt_stream/mqtt_stream.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 6 additions & 5 deletions library.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
6 changes: 3 additions & 3 deletions library.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/PubSubClient.cpp → src/TBPubSubClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
http://knolleary.net
*/

#include "PubSubClient.h"
#include "TBPubSubClient.h"
#include "Arduino.h"

PubSubClient::PubSubClient() {
Expand Down
6 changes: 3 additions & 3 deletions src/PubSubClient.h → src/TBPubSubClient.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/src/connect_spec.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "PubSubClient.h"
#include "TBPubSubClient.h"
#include "ShimClient.h"
#include "Buffer.h"
#include "BDDTest.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/src/keepalive_spec.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "PubSubClient.h"
#include "TBPubSubClient.h"
#include "ShimClient.h"
#include "Buffer.h"
#include "BDDTest.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/src/publish_spec.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "PubSubClient.h"
#include "TBPubSubClient.h"
#include "ShimClient.h"
#include "Buffer.h"
#include "BDDTest.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/src/receive_spec.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "PubSubClient.h"
#include "TBPubSubClient.h"
#include "ShimClient.h"
#include "Buffer.h"
#include "BDDTest.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/src/subscribe_spec.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "PubSubClient.h"
#include "TBPubSubClient.h"
#include "ShimClient.h"
#include "Buffer.h"
#include "BDDTest.h"
Expand Down