From 476d1115e67e1b7232adcac9cde05c9b6e5ccebe Mon Sep 17 00:00:00 2001 From: Todd Treece Date: Mon, 5 Oct 2015 09:50:57 -0400 Subject: [PATCH] adds will() function --- Adafruit_MQTT.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Adafruit_MQTT.cpp b/Adafruit_MQTT.cpp index 3f12f39..de046f0 100644 --- a/Adafruit_MQTT.cpp +++ b/Adafruit_MQTT.cpp @@ -167,6 +167,22 @@ bool Adafruit_MQTT::publish(const char *topic, const char *data, uint8_t qos) { return true; } +bool Adafruit_MQTT::will(const char *topic, const char *payload, uint8_t qos, uint8_t retain) { + + if (connected()) { + DEBUG_PRINT(F("Will defined after connect")); + return false; + } + + will_topic = topic; + will_payload = payload; + will_qos = qos; + will_retain = retain; + + return true; + +} + bool Adafruit_MQTT::subscribe(Adafruit_MQTT_Subscribe *sub) { uint8_t i; // see if we are already subscribed