25 #ifndef __mqtt_will_options_h 
   26 #define __mqtt_will_options_h 
   28 #include "MQTTAsync.h" 
   35 class connect_options;
 
   50     static constexpr 
int DFLT_QOS = 0;
 
   52     static constexpr 
bool DFLT_RETAINED = 
false;
 
   54     static const MQTTAsync_willOptions DFLT_C_STRUCT;
 
   57     MQTTAsync_willOptions opts_;
 
   67     friend class connect_options_test;
 
   68     friend class will_options_test;
 
   82         return sr ? sr.
to_string().c_str() : 
nullptr;
 
   87     using ptr_t = std::shared_ptr<will_options>;
 
  105                  int qos=DFLT_QOS, 
bool retained=DFLT_RETAINED);
 
  116                  int qos=DFLT_QOS, 
bool retained=DFLT_RETAINED);
 
  127                  int qos=DFLT_QOS, 
bool retained=DFLT_RETAINED);
 
  138                  int qos=DFLT_QOS, 
bool retained=DFLT_QOS);
 
  194         return message::create(topic_, payload_, opts_.qos, to_bool(opts_.retained));
 
  215     void set_qos(
const int qos) { opts_.qos = qos; }
 
  221     void set_retained(
bool retained) { opts_.retained = to_int(retained); }
 
  234 #endif      // __mqtt_will_options_h 
Basic types and type conversions for the Paho MQTT C++ library. 
const_message_ptr get_message() const 
Gets the LWT message as a message object. 
Definition: will_options.h:193
string get_payload_str() const 
Gets the LWT message payload as a string. 
Definition: will_options.h:178
void set_payload(string msg)
Sets the LWT message text. 
Definition: will_options.h:210
Holds the set of options that control how the client connects to a server. 
Definition: connect_options.h:46
Represents a topic destination, used for publish/subscribe messaging. 
Definition: topic.h:42
Declaration of MQTT message class. 
bool is_retained() const 
Gets the 'retained' flag for the LWT message. 
Definition: will_options.h:188
void set_topic(string_ref top)
Sets the LWT message topic name. 
will_options()
Constructs a new object using the default values. 
void set_retained(bool retained)
Sets the retained flag. 
Definition: will_options.h:221
std::shared_ptr< const will_options > const_ptr_t
Smart/shared pointer to a const object of this class. 
Definition: will_options.h:89
An MQTT message holds everything required for an MQTT PUBLISH message. 
Definition: message.h:52
std::shared_ptr< will_options > ptr_t
Smart/shared pointer to this class. 
Definition: will_options.h:87
const binary_ref & get_payload() const 
Gets the LWT message payload. 
Definition: will_options.h:173
will_options & operator=(const will_options &opt)
Copy assignment for the LWT options. 
string get_topic() const 
Gets the LWT message topic name. 
Definition: will_options.h:168
Declaration of MQTT topic class. 
static ptr_t create(string_ref topic, const void *payload, size_t len, int qos, bool retained)
Constructs a message with the specified array as a payload, and all other values set to defaults...
Definition: message.h:164
int get_qos() const 
Gets the QoS value for the LWT message. 
Definition: will_options.h:183
Holds the set of options that govern the Last Will and Testament feature. 
Definition: will_options.h:47
void set_payload(binary_ref msg)
Sets the LWT message text. 
void set_qos(const int qos)
Sets the QoS value. 
Definition: will_options.h:215
const blob & to_string() const 
Gets the data buffer as a string. 
Definition: buffer_ref.h:251