Skip to content

Commit 54839bd

Browse files
committed
Blocking mqtt option
1 parent 01f822e commit 54839bd

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

library.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "git",
77
"url": "https://github.com/sblantipodi/arduino_bootstrapper.git"
88
},
9-
"version": "1.18.2",
9+
"version": "1.18.3",
1010
"examples": "examples/*.cpp",
1111
"exclude": "tests",
1212
"frameworks": "arduino",

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Bootstrapper
2-
version=1.18.2
2+
version=1.18.3
33
author=Davide Perini <perini.davide@dpsoftware.org>
44
maintainer=Davide Perini <perini.davide@dpsoftware.org>
55
sentence=A client library for MQTT messaging.

src/Helpers.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ String mqttpass = "XXX";
5050
String mqttWillTopic = "0";
5151
String mqttWillPayload = "0";
5252
int mqttWillQOS = 1;
53-
bool mqttWillRetain = 0;
54-
bool mqttCleanSession = 1;
53+
bool mqttWillRetain = false;
54+
bool mqttCleanSession = true;
55+
bool blockingMqtt = true;
56+
bool mqttConnected = false;
5557
String additionalParam = "XXX";
5658
bool ethConnected = false;
5759

src/Helpers.h

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ extern String mqttWillPayload;
5353
extern int mqttWillQOS;
5454
extern bool mqttWillRetain;
5555
extern bool mqttCleanSession;
56+
extern bool mqttConnected;
57+
extern bool blockingMqtt;
5658
extern String additionalParam;
5759
extern bool ethConnected;
5860

src/QueueManager.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,19 @@ void QueueManager::mqttReconnect(void (*manageDisconnections)(), void (*manageQu
113113
// Wait 500 millis before retrying
114114
delay(DELAY_500);
115115
}
116+
if (!blockingMqtt) {
117+
break;
118+
}
116119
}
117120
}
118121

119122
void QueueManager::queueLoop(void (*manageDisconnections)(), void (*manageQueueSubscription)(),
120123
void (*manageHardwareButton)()) {
121124
if (!mqttClient.connected()) {
125+
mqttConnected = false;
122126
mqttReconnect(manageDisconnections, manageQueueSubscription, manageHardwareButton);
127+
} else {
128+
mqttConnected = true;
123129
}
124130
mqttClient.loop();
125131
}

0 commit comments

Comments
 (0)