PahoMqttCpp
MQTT C++ Client for POSIX and Windows
Loading...
Searching...
No Matches
Public Types | Public Member Functions
mqtt::create_options_builder Class Reference

#include <create_options.h>

Public Types

using self = create_options_builder
 

Public Member Functions

 create_options_builder ()
 
auto server_uri (const string &serverURI) -> self &
 
auto client_id (const string &clientId) -> self &
 
auto persistence (const persistence_type &persistence) -> self &
 
auto send_while_disconnected (bool on=true, bool anyTime=false) -> self &
 
auto max_buffered_messages (int n) -> self &
 
auto mqtt_version (int ver) -> self &
 
auto delete_oldest_messages (bool on=true) -> self &
 
auto restore_messages (bool on=true) -> self &
 
auto persist_qos0 (bool on=true) -> self &
 
create_options finalize ()
 

Detailed Description

Builder class to generate the create options.

Member Typedef Documentation

◆ self

This class

Constructor & Destructor Documentation

◆ create_options_builder()

mqtt::create_options_builder::create_options_builder ( )
inline

Default constructor.

Member Function Documentation

◆ server_uri()

auto mqtt::create_options_builder::server_uri ( const string serverURI) -> self&
inline

Set the server URI.

Parameters
serverURIThe address of the server to connect to, specified as a URI

◆ client_id()

auto mqtt::create_options_builder::client_id ( const string clientId) -> self&
inline

Sets the client ID.

Parameters
clientIdA client identifier that is unique on the server

◆ persistence()

auto mqtt::create_options_builder::persistence ( const persistence_type persistence) -> self&
inline

Sets the persistence.

Parameters
persistenceThe persistence the client should use.

◆ send_while_disconnected()

auto mqtt::create_options_builder::send_while_disconnected ( bool  on = true,
bool  anyTime = false 
) -> self&
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.
Returns
A reference to this object.

◆ max_buffered_messages()

auto mqtt::create_options_builder::max_buffered_messages ( int  n) -> self&
inline

Sets the maximum number of offline buffered messages.

Parameters
nThe maximum number of offline buffered messages.
Returns
A reference to this object.

◆ mqtt_version()

auto mqtt::create_options_builder::mqtt_version ( int  ver) -> self&
inline

Sets the MQTT version used to create the client.

Parameters
verThe MQTT version used to create the client.

◆ delete_oldest_messages()

auto mqtt::create_options_builder::delete_oldest_messages ( bool  on = true) -> self&
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.
Returns
A reference to this object.

◆ restore_messages()

auto mqtt::create_options_builder::restore_messages ( bool  on = true) -> self&
inline

Determines whether to restore persisted messages or clear the persistence store. (Defaults true)

Parameters
ontrue to restore persisted messages, false to clear the persistence store.
Returns
A reference to this object.

◆ persist_qos0()

auto mqtt::create_options_builder::persist_qos0 ( bool  on = true) -> self&
inline

Whether to persist QoS 0 messages. (Defaults true)

Parameters
ontrue persist QoS 0 messages, false, don't.
Returns
A reference to this object

◆ finalize()

create_options mqtt::create_options_builder::finalize ( )
inline

Finish building the options and return them.

Returns
The option struct as built.

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