Skip to content

Commit e420aaf

Browse files
committed
Arduino Bootstrapper (v1.7.6)
1 parent 71e9a1d commit e420aaf

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

src/BootstrapManager.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,24 @@ void BootstrapManager::publish(const char *topic, JsonObject objectToSend, boole
8787

8888
}
8989

90+
/********************************** SUBSCRIBE TO A QUEUE TOPIC **********************************/
91+
void BootstrapManager::unsubscribe(const char *topic) {
92+
93+
queueManager.unsubscribe(topic);
94+
95+
if (DEBUG_QUEUE_MSG) {
96+
Serial.print(F("TOPIC SUBSCRIBED [")); Serial.print(topic); Serial.println(F("] "));
97+
}
98+
99+
}
100+
90101
/********************************** SUBSCRIBE TO A QUEUE TOPIC **********************************/
91102
void BootstrapManager::subscribe(const char *topic) {
92-
103+
93104
queueManager.subscribe(topic);
94-
105+
95106
if (DEBUG_QUEUE_MSG) {
96-
Serial.print(F("TOPIC SUBSCRIBED [")); Serial.print(topic); Serial.println(F("] "));
107+
Serial.print(F("TOPIC SUBSCRIBED [")); Serial.print(topic); Serial.println(F("] "));
97108
}
98109

99110
}

src/BootstrapManager.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ class BootstrapManager {
5252
void bootstrapLoop(void (*manageDisconnectionFunction)(), void (*manageQueueSubscription)(), void (*manageHardwareButton)()); // bootstrap loop()
5353
void publish(const char *topic, const char *payload, boolean retained); // send a message on the queue
5454
void publish(const char *topic, JsonObject objectToSend, boolean retained); // send a message on the queue
55-
void subscribe(const char *topic); // subscribe to a queue topic
56-
void subscribe(const char *topic, uint8_t qos); // subscribe to a queue topic with qos 0 or 1
55+
void unsubscribe(const char *topic); // unsubscribe to a queue topic
56+
void subscribe(const char *topic); // subscribe to a queue topic
57+
void subscribe(const char *topic, uint8_t qos); // subscribe to a queue topic with qos 0 or 1
5758
JsonObject getJsonObject(); // return a new json object instance
5859
void nonBlokingBlink(); // blink default LED when sending data to the queue
5960
void getMicrocontrollerInfo(); // print or display microcontroller's info

src/QueueManager.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ void QueueManager::publish(const char *topic, const char *payload, boolean retai
125125

126126
}
127127

128+
/********************************** SUBSCRIBE TO A QUEUE TOPIC **********************************/
129+
void QueueManager::unsubscribe(const char *topic) {
130+
131+
mqttClient.unsubscribe(topic);
132+
133+
}
134+
128135
/********************************** SUBSCRIBE TO A QUEUE TOPIC **********************************/
129136
void QueueManager::subscribe(const char *topic) {
130137

src/QueueManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class QueueManager {
3434
void mqttReconnect(void (*manageDisconnections)(), void (*manageQueueSubscription)(), void (*manageHardwareButton)()); // manage reconnection on the queue
3535
void queueLoop(void (*manageDisconnections)(), void (*manageQueueSubscription)(), void (*manageHardwareButton)()); // manage queue loop
3636
void publish(const char *topic, const char *payload, boolean retained); // send a message on the queue
37+
void unsubscribe(const char *topic); // unsubscribe to a queue topic
3738
void subscribe(const char *topic); // subscribe to a queue topic
3839
void subscribe(const char *topic, uint8_t qos); // subscribe to a queue topic with qos 0 or 1
3940

0 commit comments

Comments
 (0)