paho-mqtt-cpp
MQTT C++ Client for POSIX and Windows
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends
mqtt::create_options Class Reference

#include <create_options.h>

Public Types

using ptr_t = std::shared_ptr< create_options >
 
using const_ptr_t = std::shared_ptr< const create_options >
 

Public Member Functions

 create_options ()
 
 create_options (int mqttVersion)
 
 create_options (int mqttVersion, int maxBufferedMessages)
 
bool get_send_while_disconnected () const
 
void set_send_while_disconnected (bool on, bool anyTime=false)
 
int get_max_buffered_messages () const
 
void set_max_buffered_messages (int n)
 
int mqtt_version () const
 
void set_mqtt_version (int ver)
 
bool get_delete_oldest_messages () const
 
void set_delete_oldest_messages (bool on)
 
bool get_restore_messages () const
 
void set_restore_messages (bool on)
 
bool get_persist_qos0 () const
 
void set_persist_qos0 (bool on)
 

Friends

class async_client
 
class create_options_builder
 

Detailed Description

Options for creating a client object.

Member Typedef Documentation

◆ ptr_t

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

Smart/shared pointer to an object of this class.

◆ const_ptr_t

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

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

Constructor & Destructor Documentation

◆ create_options() [1/3]

mqtt::create_options::create_options ( )

Default set of client create options.

◆ create_options() [2/3]

mqtt::create_options::create_options ( int  mqttVersion)
explicit

Default create options for the specified version of MQTT.

Parameters
mqttVersionThe MQTT version used to create the client.

◆ create_options() [3/3]

mqtt::create_options::create_options ( int  mqttVersion,
int  maxBufferedMessages 
)

Default create options, but with off-line buffering enabled.

Parameters
mqttVersionThe MQTT version used to create the client.
maxBufferedMessagesthe maximum number of messages allowed to be buffered while not connected

Member Function Documentation

◆ get_send_while_disconnected()

bool mqtt::create_options::get_send_while_disconnected ( ) const
inline

Gets whether the client will accept message to publish while disconnected.

◆ set_send_while_disconnected()

void mqtt::create_options::set_send_while_disconnected ( bool  on,
bool  anyTime = false 
)
inline

Sets whether the client will accept message to publish while disconnected.

Parameters
ontrue to allow the application to publish messages while disconnected, false returns an error on publish if disconnected.
anyTimeIf true, allows you to publish messages before the first successful connection.

◆ get_max_buffered_messages()

int mqtt::create_options::get_max_buffered_messages ( ) const
inline

Gets the maximum number of offline buffered messages.

Returns
The maximum number of offline buffered messages.

◆ set_max_buffered_messages()

void mqtt::create_options::set_max_buffered_messages ( int  n)
inline

Sets the maximum number of offline buffered messages.

Parameters
nThe maximum number of offline buffered messages.

◆ mqtt_version()

int mqtt::create_options::mqtt_version ( ) const
inline

Gets the MQTT version used to create the client.

Returns
The MQTT version used to create the client.

◆ set_mqtt_version()

void mqtt::create_options::set_mqtt_version ( int  ver)
inline

Sets the MQTT version used to create the client.

Parameters
verThe MQTT version used to create the client.

◆ get_delete_oldest_messages()

bool mqtt::create_options::get_delete_oldest_messages ( ) const
inline

Whether the oldest messages are deleted when the output buffer is full.

Returns
true if the oldest messages should be deleted when the output buffer is full, false if the new messages should be dropped when the buffer is full.

◆ set_delete_oldest_messages()

void mqtt::create_options::set_delete_oldest_messages ( bool  on)
inline

Determines what to do when the maximum number of buffered messages is reached: delete the oldest messages rather than the newest

Parameters
ontrue When the output queue is full, delete the oldest message, false drop the newest message being added.

◆ get_restore_messages()

bool mqtt::create_options::get_restore_messages ( ) const
inline

Whether the messages will be restored from persistence or the store will be cleared.

Returns
true if the messages will be restored from persistence, false if the persistence store will be cleared.

◆ set_restore_messages()

void mqtt::create_options::set_restore_messages ( bool  on)
inline

Determine whether to restore messages from persistence or clear the persistence store.

Parameters
ontrue to restore messages from persistence, false to clear the persistence store.

◆ get_persist_qos0()

bool mqtt::create_options::get_persist_qos0 ( ) const
inline

Whether to persist QoS 0 messages.

Returns
true if QoS 0 messages are persisted, false if not.

◆ set_persist_qos0()

void mqtt::create_options::set_persist_qos0 ( bool  on)
inline

Determine whether to persist QoS 0 messages.

Parameters
ontrue if QoS 0 messages are persisted, false if not.

Friends And Related Symbol Documentation

◆ async_client

friend class async_client
friend

The client and tests have special access

◆ create_options_builder

friend class create_options_builder
friend

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