Skip to content

Commit 0faa3a2

Browse files
authored
Merge branch 'master' into std-function-callback-support
2 parents 0179fcd + cbc6f6e commit 0faa3a2

File tree

5 files changed

+16
-23
lines changed

5 files changed

+16
-23
lines changed

Diff for: .github/workflows/compile-examples.yml

-7
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@ jobs:
2121
with:
2222
fetch-depth: 1
2323
- name: compile-examples for official Arduino boards
24-
if: startsWith(matrix.fqbn, '"esp8266:esp8266') != true
2524
uses: arduino/actions/libraries/compile-examples@master
2625
with:
2726
fqbn: ${{ matrix.fqbn }}
2827
libraries: ${{ env.LIBRARIES }}
29-
- name: compile-examples for ESP8266 boards
30-
if: startsWith(matrix.fqbn, '"esp8266:esp8266')
31-
uses: arduino/actions/libraries/compile-examples@master
32-
with:
33-
fqbn: ${{ matrix.fqbn }}
34-
entrypoint: /github/workspace/.github/workflows/install-python-wrapper.sh

Diff for: .github/workflows/install-python-wrapper.sh

-9
This file was deleted.

Diff for: library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ArduinoMqttClient
2-
version=0.1.4
2+
version=0.1.5
33
author=Arduino
44
maintainer=Arduino <[email protected]>
55
sentence=[BETA] Allows you to send and receive MQTT messages using Arduino.

Diff for: src/MqttClient.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@
2929
#endif
3030
#endif
3131

32-
#ifdef __AVR__
33-
#define TX_PAYLOAD_BUFFER_SIZE 128
34-
#else
35-
#define TX_PAYLOAD_BUFFER_SIZE 256
32+
#ifndef TX_PAYLOAD_BUFFER_SIZE
33+
#ifdef __AVR__
34+
#define TX_PAYLOAD_BUFFER_SIZE 128
35+
#else
36+
#define TX_PAYLOAD_BUFFER_SIZE 256
37+
#endif
3638
#endif
3739

3840
#define MQTT_CONNECT 1
@@ -61,8 +63,8 @@ enum {
6163
MQTT_CLIENT_RX_STATE_DISCARD_PUBLISH_PAYLOAD
6264
};
6365

64-
MqttClient::MqttClient(Client& client) :
65-
_client(&client),
66+
MqttClient::MqttClient(Client* client) :
67+
_client(client),
6668
_onMessage(NULL),
6769
_cleanSession(true),
6870
_keepAliveInterval(60 * 1000L),
@@ -82,6 +84,11 @@ MqttClient::MqttClient(Client& client) :
8284
setTimeout(0);
8385
}
8486

87+
MqttClient::MqttClient(Client& client) : MqttClient(&client)
88+
{
89+
90+
}
91+
8592
MqttClient::~MqttClient()
8693
{
8794
if (_willBuffer) {

Diff for: src/MqttClient.h

+2
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@
4141

4242
class MqttClient : public Client {
4343
public:
44+
MqttClient(Client* client);
4445
MqttClient(Client& client);
4546
virtual ~MqttClient();
4647

4748
#ifdef MQTT_CLIENT_STD_FUNCTION_CALLBACK
4849
typedef std::function<void(MqttClient *client, int messageSize)> MessageCallback;
4950
void onMessage(MessageCallback callback);
5051
#else
52+
inline void setClient(Client& client) { _client = &client; }
5153
void onMessage(void(*)(int));
5254
#endif
5355

0 commit comments

Comments
 (0)