Paho C++  1.0
The Paho MQTT C++ Client Library
 All Classes Files Functions Variables Typedefs Friends
mqtt::will_options Class Reference

Holds the set of options that govern the Last Will and Testament feature. More...

#include <will_options.h>

Public Types

using ptr_t = std::shared_ptr< will_options >
 Smart/shared pointer to this class. More...
 
using const_ptr_t = std::shared_ptr< const will_options >
 Smart/shared pointer to a const object of this class. More...
 

Public Member Functions

 will_options ()
 Constructs a new object using the default values.
 
 will_options (string_ref top, const void *payload, size_t payload_len, int qos=DFLT_QOS, bool retained=DFLT_RETAINED)
 Sets the "Last Will and Testament" (LWT) for the connection. More...
 
 will_options (const topic &top, const void *payload, size_t payload_len, int qos=DFLT_QOS, bool retained=DFLT_RETAINED)
 Sets the "Last Will and Testament" (LWT) for the connection. More...
 
 will_options (string_ref top, binary_ref payload, int qos=DFLT_QOS, bool retained=DFLT_RETAINED)
 Sets the "Last Will and Testament" (LWT) for the connection. More...
 
 will_options (string_ref top, const string &payload, int qos=DFLT_QOS, bool retained=DFLT_QOS)
 Sets the "Last Will and Testament" (LWT) for the connection. More...
 
 will_options (const message &msg)
 Sets the "Last Will and Testament" (LWT) for the connection. More...
 
 will_options (const will_options &opt)
 Copy constructor for the LWT options. More...
 
 will_options (will_options &&opt)
 Move constructor for the LWT options. More...
 
will_optionsoperator= (const will_options &opt)
 Copy assignment for the LWT options. More...
 
will_optionsoperator= (will_options &&opt)
 Move assignment for the LWT options. More...
 
string get_topic () const
 Gets the LWT message topic name. More...
 
const binary_refget_payload () const
 Gets the LWT message payload. More...
 
string get_payload_str () const
 Gets the LWT message payload as a string. More...
 
int get_qos () const
 Gets the QoS value for the LWT message. More...
 
bool is_retained () const
 Gets the 'retained' flag for the LWT message. More...
 
const_message_ptr get_message () const
 Gets the LWT message as a message object. More...
 
void set_topic (string_ref top)
 Sets the LWT message topic name. More...
 
void set_payload (binary_ref msg)
 Sets the LWT message text. More...
 
void set_payload (string msg)
 Sets the LWT message text. More...
 
void set_qos (const int qos)
 Sets the QoS value. More...
 
void set_retained (bool retained)
 Sets the retained flag. More...
 

Friends

class connect_options
 The connect options has special access.
 
class connect_options_test
 
class will_options_test
 

Detailed Description

Holds the set of options that govern the Last Will and Testament feature.

Note
This wraps struct v1 of the C library's MQTTAsync_willOptions structure. It sets the LWT binary payload, via the 'payload' struct field, and leaves the 'message' field as a nullptr.

Member Typedef Documentation

using mqtt::will_options::const_ptr_t = std::shared_ptr<const will_options>

Smart/shared pointer to a const object of this class.

using mqtt::will_options::ptr_t = std::shared_ptr<will_options>

Smart/shared pointer to this class.

Constructor & Destructor Documentation

mqtt::will_options::will_options ( string_ref  top,
const void *  payload,
size_t  payload_len,
int  qos = DFLT_QOS,
bool  retained = DFLT_RETAINED 
)

Sets the "Last Will and Testament" (LWT) for the connection.

Parameters
topThe LWT message is published to the this topic.
payloadThe message that is published to the Will Topic.
payload_lenThe message size in bytes
qosThe message Quality of Service.
retainedTell the broker to keep the LWT message after send to subscribers.
mqtt::will_options::will_options ( const topic top,
const void *  payload,
size_t  payload_len,
int  qos = DFLT_QOS,
bool  retained = DFLT_RETAINED 
)

Sets the "Last Will and Testament" (LWT) for the connection.

Parameters
topThe LWT message is published to the this topic.
payloadThe message that is published to the Will Topic.
payload_lenThe message size in bytes.
qosThe message Quality of Service.
retainedTell the broker to keep the LWT message after send to subscribers.
mqtt::will_options::will_options ( string_ref  top,
binary_ref  payload,
int  qos = DFLT_QOS,
bool  retained = DFLT_RETAINED 
)

Sets the "Last Will and Testament" (LWT) for the connection.

Parameters
topThe LWT message is published to the this topic.
payloadThe message payload that is published to the Will Topic.
qosThe message Quality of Service.
retainedTell the broker to keep the LWT message after send to subscribers.
mqtt::will_options::will_options ( string_ref  top,
const string &  payload,
int  qos = DFLT_QOS,
bool  retained = DFLT_QOS 
)

Sets the "Last Will and Testament" (LWT) for the connection.

Parameters
topThe LWT message is published to the this topic.
payloadThe message payload that is published to the Will Topic, as a string.
qosThe message Quality of Service.
retainedTell the broker to keep the LWT message after send to subscribers.
mqtt::will_options::will_options ( const message msg)

Sets the "Last Will and Testament" (LWT) for the connection.

Parameters
msgThe message that is published to the Will Topic.
mqtt::will_options::will_options ( const will_options opt)

Copy constructor for the LWT options.

Parameters
optThe other options.
mqtt::will_options::will_options ( will_options &&  opt)

Move constructor for the LWT options.

Parameters
optThe other options.

Member Function Documentation

const_message_ptr mqtt::will_options::get_message ( ) const
inline

Gets the LWT message as a message object.

Returns
A pointer to a copy of the LWT message.
const binary_ref& mqtt::will_options::get_payload ( ) const
inline

Gets the LWT message payload.

Returns
The LWT message payload.
string mqtt::will_options::get_payload_str ( ) const
inline

Gets the LWT message payload as a string.

Returns
The LWT message payload as a string.
int mqtt::will_options::get_qos ( ) const
inline

Gets the QoS value for the LWT message.

Returns
The QoS value for the LWT message.
string mqtt::will_options::get_topic ( ) const
inline

Gets the LWT message topic name.

Returns
The LWT message topic name.
bool mqtt::will_options::is_retained ( ) const
inline

Gets the 'retained' flag for the LWT message.

Returns
The 'retained' flag for the LWT message.
will_options& mqtt::will_options::operator= ( const will_options opt)

Copy assignment for the LWT options.

Parameters
optThe other options.
will_options& mqtt::will_options::operator= ( will_options &&  opt)

Move assignment for the LWT options.

Parameters
optThe other options.
void mqtt::will_options::set_payload ( binary_ref  msg)

Sets the LWT message text.

Parameters
msgThe LWT message
void mqtt::will_options::set_payload ( string  msg)
inline

Sets the LWT message text.

Parameters
msgThe LWT message
void mqtt::will_options::set_qos ( const int  qos)
inline

Sets the QoS value.

Parameters
qosThe LWT message QoS
void mqtt::will_options::set_retained ( bool  retained)
inline

Sets the retained flag.

Parameters
retainedTell the broker to keep the LWT message after send to subscribers.
void mqtt::will_options::set_topic ( string_ref  top)

Sets the LWT message topic name.

Parameters
topThe topic where to sent the message

The documentation for this class was generated from the following file: