From b9a04c8be5873c94493efebe3814f3354eb3bea3 Mon Sep 17 00:00:00 2001 From: Todd Treece Date: Mon, 5 Oct 2015 09:25:07 -0400 Subject: [PATCH] adds will() method def --- Adafruit_MQTT.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Adafruit_MQTT.h b/Adafruit_MQTT.h index 32b7816..14940af 100644 --- a/Adafruit_MQTT.h +++ b/Adafruit_MQTT.h @@ -131,6 +131,14 @@ class Adafruit_MQTT { // Return true if connected to the MQTT server, otherwise false. virtual bool connected() = 0; // Subclasses need to fill this in! + // Set MQTT last will topic, payload, QOS, and retain. This needs + // to be called before connect() because it is sent as part of the + // connect control packet. + bool will(const char *topic, const char *payload, uint8_t qos = 0, uint8_t retain = 0); + bool will(const __FlashStringHelper *topic, const char *payload, uint8_t qos = 0, uint8_t retain = 0) { + return will((const char *)topic, payload, qos, retain); + } + // Publish a message to a topic using the specified QoS level. Returns true // if the message was published, false otherwise. // The topic must be stored in PROGMEM. It can either be a