Skip to content

Commit 7f1e4a4

Browse files
committed
updated arduino mqtt from 2.3.1 to 2.3.3
1 parent 101b4dc commit 7f1e4a4

File tree

39 files changed

+256
-2568
lines changed

39 files changed

+256
-2568
lines changed

libraries/arduino-mqtt-2.3.1/src/lwmqtt/packet.c

-742
This file was deleted.

libraries/arduino-mqtt-2.3.1/src/lwmqtt/packet.h

-185
This file was deleted.

libraries/arduino-mqtt-2.3.1/.travis.yml renamed to libraries/arduino-mqtt-2.3.3/.travis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ env:
44
- IDE_VERSION=1.8.5
55
matrix:
66
- EXAMPLE="AdafruitHuzzahESP8266" BOARD="esp8266:esp8266:huzzah:FlashSize=4M3M,CpuFrequency=80"
7-
- EXAMPLE="AdafruitHuzzahESP8266_SSL" BOARD="esp8266:esp8266:huzzah:FlashSize=4M3M,CpuFrequency=80"
7+
- EXAMPLE="AdafruitHuzzahESP8266Secure" BOARD="esp8266:esp8266:huzzah:FlashSize=4M3M,CpuFrequency=80"
88
- EXAMPLE="ArduinoEthernetShield" BOARD="arduino:avr:uno"
99
- EXAMPLE="ArduinoMKRGSM1400" BOARD="arduino:samd:mkrgsm1400"
10-
- EXAMPLE="ArduinoMKRGSM1400_SSL" BOARD="arduino:samd:mkrgsm1400"
11-
- EXAMPLE="ArduinoWiFi101_SSL" BOARD="arduino:avr:uno"
10+
- EXAMPLE="ArduinoMKRGSM1400Secure" BOARD="arduino:samd:mkrgsm1400"
11+
- EXAMPLE="ArduinoWiFi101Secure" BOARD="arduino:avr:uno"
1212
- EXAMPLE="ArduinoWiFiShield" BOARD="arduino:avr:uno"
1313
- EXAMPLE="ArduinoYun" BOARD="arduino:avr:yun"
14-
- EXAMPLE="ArduinoYun_SSL" BOARD="arduino:avr:yun"
14+
- EXAMPLE="ArduinoYunSecure" BOARD="arduino:avr:yun"
1515
- EXAMPLE="ESP32DevelopmentBoard" BOARD="espressif:esp32:esp32:FlashFreq=80"
16-
- EXAMPLE="ESP32DevelopmentBoard_SSL" BOARD="espressif:esp32:esp32:FlashFreq=80"
16+
- EXAMPLE="ESP32DevelopmentBoardSecure" BOARD="espressif:esp32:esp32:FlashFreq=80"
1717
before_install:
1818
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
1919
- sleep 3

libraries/arduino-mqtt-2.3.1/CMakeLists.txt renamed to libraries/arduino-mqtt-2.3.3/CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
2020

2121
set(SOURCE_FILES
2222
examples/AdafruitHuzzahESP8266/AdafruitHuzzahESP8266.ino
23-
examples/AdafruitHuzzahESP8266_SSL/AdafruitHuzzahESP8266_SSL.ino
23+
examples/AdafruitHuzzahESP8266Secure/AdafruitHuzzahESP8266Secure.ino
2424
examples/ArduinoEthernetShield/ArduinoEthernetShield.ino
2525
examples/ArduinoMKRGSM1400/ArduinoMKRGSM1400.ino
26-
examples/ArduinoMKRGSM1400_SSL/ArduinoMKRGSM1400_SSL.ino
26+
examples/ArduinoMKRGSM1400Secure/ArduinoMKRGSM1400Secure.ino
2727
examples/ArduinoWiFi101/ArduinoWiFi101.ino
28-
examples/ArduinoWiFi101_SSL/ArduinoWiFi101_SSL.ino
28+
examples/ArduinoWiFi101Secure/ArduinoWiFi101Secure.ino
2929
examples/ArduinoWiFiShield/ArduinoWiFiShield.ino
3030
examples/ArduinoYun/ArduinoYun.ino
31-
examples/ArduinoYun_SSL/ArduinoYun_SSL.ino
31+
examples/ArduinoYunSecure/ArduinoYunSecure.ino
3232
examples/ESP32DevelopmentBoard/ESP32DevelopmentBoard.ino
33-
examples/ESP32DevelopmentBoard_SSL/ESP32DevelopmentBoard_SSL.ino
33+
examples/ESP32DevelopmentBoardSecure/ESP32DevelopmentBoardSecure.ino
3434
src/lwmqtt
3535
src/MQTT.h
3636
src/MQTTClient.h

libraries/arduino-mqtt-2.3.1/Makefile renamed to libraries/arduino-mqtt-2.3.3/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ fmt:
55

66
update:
77
rm -rf ./lwmqtt
8-
git clone --branch v0.5.6 https://github.com/256dpi/lwmqtt.git ./lwmqtt
8+
git clone --branch v0.6.1 https://github.com/256dpi/lwmqtt.git ./lwmqtt
99
mkdir -p ./src/lwmqtt
1010
cp -r ./lwmqtt/src/*.c ./src/lwmqtt/
1111
cp -r ./lwmqtt/src/*.h ./src/lwmqtt/

libraries/arduino-mqtt-2.3.1/README.md renamed to libraries/arduino-mqtt-2.3.3/README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ The library is also available on [PlatformIO](https://platformio.org/lib/show/61
1313

1414
The following examples show how you can use the library with various Arduino compatible hardware:
1515

16-
- [Arduino Yun & Yun-Shield](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoYun/ArduinoYun.ino) ([SSL](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoYun_SSL/ArduinoYun_SSL.ino))
16+
- [Arduino Yun & Yun-Shield](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoYun/ArduinoYun.ino) ([Secure](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoYunSecure/ArduinoYunSecure.ino))
1717
- [Arduino Ethernet Shield](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoEthernetShield/ArduinoEthernetShield.ino)
1818
- [Arduino WiFi Shield](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoWiFiShield/ArduinoWiFiShield.ino)
19-
- [Adafruit HUZZAH ESP8266](https://github.com/256dpi/arduino-mqtt/blob/master/examples/AdafruitHuzzahESP8266/AdafruitHuzzahESP8266.ino) ([SSL](https://github.com/256dpi/arduino-mqtt/blob/master/examples/AdafruitHuzzahESP8266_SSL/AdafruitHuzzahESP8266_SSL.ino))
20-
- [Arduino/Genuino WiFi101 Shield](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoWiFi101/ArduinoWiFi101.ino) ([SSL](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoWiFi101_SSL/ArduinoWiFi101_SSL.ino))
21-
- [Arduino MKR GSM 1400](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoMKRGSM1400/ArduinoMKRGSM1400.ino) ([SSL](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoMKRGSM1400_SSL/ArduinoMKRGSM1400_SSL.ino))
22-
- [ESP32 Development Board](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ESP32DevelopmentBoard/ESP32DevelopmentBoard.ino) ([SSL](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ESP32DevelopmentBoard_SSL/ESP32DevelopmentBoard_SSL.ino))
19+
- [Adafruit HUZZAH ESP8266](https://github.com/256dpi/arduino-mqtt/blob/master/examples/AdafruitHuzzahESP8266/AdafruitHuzzahESP8266.ino) ([Secure](https://github.com/256dpi/arduino-mqtt/blob/master/examples/AdafruitHuzzahESP8266Secure/AdafruitHuzzahESP8266Secure.ino))
20+
- [Arduino/Genuino WiFi101 Shield](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoWiFi101/ArduinoWiFi101.ino) ([Secure](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoWiFi101Secure/ArduinoWiFi101Secure.ino))
21+
- [Arduino MKR GSM 1400](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoMKRGSM1400/ArduinoMKRGSM1400.ino) ([Secure](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoMKRGSM1400Secure/ArduinoMKRGSM1400Secure.ino))
22+
- [ESP32 Development Board](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ESP32DevelopmentBoard/ESP32DevelopmentBoard.ino) ([Secure](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ESP32DevelopmentBoardSecure/ESP32DevelopmentBoardSecure.ino))
2323

2424
Other shields and boards should also work if they provide a [Client](https://www.arduino.cc/en/Reference/ClientConstructor) based network implementation.
2525

@@ -107,7 +107,7 @@ void begin(const char hostname[], Client &client);
107107
void begin(const char hostname[], int port, Client &client);
108108
```
109109

110-
- Specify port `8883` when using SSL clients for secure connections.
110+
- Specify port `8883` when using secure clients for encrypted connections.
111111
- Local domain names (e.g. `Computer.local` on OSX) are not supported by Arduino. You need to set the IP address directly.
112112

113113
The hostname and port can also be changed after calling `begin()`:
@@ -117,7 +117,7 @@ void setHost(const char hostname[]);
117117
void setHost(const char hostname[], int port);
118118
```
119119
120-
Set a will message (last testament) that gets registered on the broker after connecting:
120+
Set a will message (last testament) that gets registered on the broker after connecting. `setWill()` has to be called before calling `connect()`:
121121
122122
```c++
123123
void setWill(const char topic[]);
@@ -144,7 +144,7 @@ Set more advanced options:
144144
void setOptions(int keepAlive, bool cleanSession, int timeout);
145145
```
146146

147-
- The `keepAlive` option controls the keep alive interval (default: 10).
147+
- The `keepAlive` option controls the keep alive interval in seconds (default: 10).
148148
- The `cleanSession` option controls the session retention on the broker side (default: true).
149149
- The `timeout` option controls the default timeout for all commands in milliseconds (default: 1000).
150150

libraries/arduino-mqtt-2.3.1/library.properties renamed to libraries/arduino-mqtt-2.3.3/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=MQTT
2-
version=2.3.1
2+
version=2.3.3
33
author=Joel Gaehwiler <[email protected]>
44
maintainer=Joel Gaehwiler <[email protected]>
55
sentence=MQTT library for Arduino

libraries/arduino-mqtt-2.3.1/src/lwmqtt/helpers.c renamed to libraries/arduino-mqtt-2.3.3/lwmqtt/helpers.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
#include "helpers.h"
44

5-
uint8_t lwmqtt_read_bits(uint8_t byte, int pos, int num) {
6-
return (byte & (uint8_t)((~(0xFF << num)) << pos)) >> pos;
7-
}
5+
uint8_t lwmqtt_read_bits(uint8_t byte, int pos, int num) { return (byte & (uint8_t)((~(0xFF << num)) << pos)) >> pos; }
86

97
void lwmqtt_write_bits(uint8_t *byte, uint8_t value, int pos, int num) {
108
*byte = (*byte & ~(uint8_t)((~(0xFF << num)) << pos)) | (value << pos);

libraries/arduino-mqtt-2.3.1/src/lwmqtt/lwmqtt.h renamed to libraries/arduino-mqtt-2.3.3/lwmqtt/lwmqtt.h

+12-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
/**
99
* The error type used by all exposed APIs.
10+
*
11+
* If a function returns an error that operates on a connected client (e.g publish, keep_alive, etc.) the caller should
12+
* switch into a disconnected state, close and cleanup the current connection and start over by creating a new
13+
* connection.
1014
*/
1115
typedef enum {
1216
LWMQTT_SUCCESS = 0,
@@ -345,11 +349,12 @@ lwmqtt_err_t lwmqtt_disconnect(lwmqtt_client_t *client, uint32_t timeout);
345349
/**
346350
* Will yield control to the client and receive incoming packets from the network.
347351
*
348-
* Applications may peek on the network if there is data available to read before calling yield and potentially block
349-
* until the timeout is reached. Furthermore, applications may specify the amount of bytes available to read in order
350-
* to constrain the yield to only receive packets that are already inflight.
352+
* Single-threaded applications may peek on the network and assess if data is available to read before calling yield and
353+
* potentially block until the timeout is reached. Multi-threaded applications may select on the socket and block until
354+
* data is available and then yield to the client if data is available. All applications may specify the amount of bytes
355+
* available to read in order to constrain the yield to only receive packets that are already in-flight.
351356
*
352-
* If no availability data is given the yield will return after one packet has been successfully read or the deadline
357+
* If no availability info is given the yield will return after one packet has been successfully read or the deadline
353358
* has been reached but no single bytes has been received.
354359
*
355360
* Note: The message callback might be called with incoming messages as part of this call.
@@ -364,6 +369,9 @@ lwmqtt_err_t lwmqtt_yield(lwmqtt_client_t *client, size_t available, uint32_t ti
364369
/**
365370
* Will yield control to the client to keep the connection alive.
366371
*
372+
* This functions must be called at a rate slightly lower than 25% of the configured keep alive. If keep alive is zero,
373+
* the function must not be called at all.
374+
*
367375
* @param client - The client object.
368376
* @param timeout - The command timeout.
369377
* @return An error value.

libraries/lwmqtt/packet.c renamed to libraries/arduino-mqtt-2.3.3/lwmqtt/packet.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ lwmqtt_err_t lwmqtt_encode_connect(uint8_t *buf, size_t buf_len, size_t *len, lw
132132

133133
// set username flag if present
134134
if (options.username.len > 0) {
135-
lwmqtt_write_bits(&flags, 1, 6, 1);
135+
lwmqtt_write_bits(&flags, 1, 7, 1);
136136

137137
// set password flag if present
138138
if (options.password.len > 0) {
139-
lwmqtt_write_bits(&flags, 1, 7, 1);
139+
lwmqtt_write_bits(&flags, 1, 6, 1);
140140
}
141141
}
142142

0 commit comments

Comments
 (0)