PahoMqttCpp
MQTT C++ Client for POSIX and Windows
Loading...
Searching...
No Matches
mqtt::disconnect_options Class Reference

#include <disconnect_options.h>

Public Member Functions

 disconnect_options ()
 
 disconnect_options (int timeout)
 
template<class Rep, class Period>
 disconnect_options (const std::chrono::duration< Rep, Period > &to)
 
 disconnect_options (const disconnect_options &opt)
 
 disconnect_options (disconnect_options &&opt)
 
disconnect_optionsoperator= (const disconnect_options &opt)
 
disconnect_optionsoperator= (disconnect_options &&opt)
 
std::chrono::milliseconds get_timeout () const
 
void set_timeout (int timeout)
 
template<class Rep, class Period>
void set_timeout (const std::chrono::duration< Rep, Period > &to)
 
void set_token (const token_ptr &tok, int mqttVersion)
 
token_ptr get_token () const
 
const propertiesget_properties () const
 
propertiesget_properties ()
 
void set_properties (const properties &props)
 
void set_properties (properties &&props)
 
ReasonCode get_reason_code () const
 
void set_reason_code (ReasonCode code)
 

Static Public Member Functions

static disconnect_options v3 ()
 
static disconnect_options v5 ()
 

Friends

class async_client
 
class disconnect_options_builder
 

Detailed Description

Options for disconnecting from an MQTT broker.

Constructor & Destructor Documentation

◆ disconnect_options() [1/5]

mqtt::disconnect_options::disconnect_options ( )
inline

Create an empty delivery response object.

◆ disconnect_options() [2/5]

mqtt::disconnect_options::disconnect_options ( int timeout)
inline

Creates disconnect options tied to the specific token.

Parameters
timeoutThe timeout (in milliseconds).

◆ disconnect_options() [3/5]

template<class Rep, class Period>
mqtt::disconnect_options::disconnect_options ( const std::chrono::duration< Rep, Period > & to)
inline

Creates disconnect options tied to the specific token.

Parameters
toThe timeout.

◆ disconnect_options() [4/5]

mqtt::disconnect_options::disconnect_options ( const disconnect_options & opt)

Copy constructor.

Parameters
optAnother object to copy.

◆ disconnect_options() [5/5]

mqtt::disconnect_options::disconnect_options ( disconnect_options && opt)

Move constructor.

Parameters
optAnother object to move into this new one.

Member Function Documentation

◆ v3()

static disconnect_options mqtt::disconnect_options::v3 ( )
inlinestatic

Creates default options for an MQTT v3.x connection.

Returns
Default options for an MQTT v3.x connection.

◆ v5()

static disconnect_options mqtt::disconnect_options::v5 ( )
inlinestatic

Creates default options for an MQTT v5 connection.

Returns
Default options for an MQTT v5 connection.

◆ operator=() [1/2]

disconnect_options & mqtt::disconnect_options::operator= ( const disconnect_options & opt)

Copy assignment.

Parameters
optAnother object to copy.

◆ operator=() [2/2]

disconnect_options & mqtt::disconnect_options::operator= ( disconnect_options && opt)

Move assignment.

Parameters
optAnother object to move into this new one.

◆ get_timeout()

std::chrono::milliseconds mqtt::disconnect_options::get_timeout ( ) const
inline

Expose the underlying C struct for the unit tests. Gets the timeout used for disconnecting.

Returns
The timeout for disconnecting (in milliseconds).

◆ set_timeout() [1/2]

void mqtt::disconnect_options::set_timeout ( int timeout)
inline

Sets the disconnect timeout, in milliseconds. This allows for any remaining in-flight messages to be delivered.

Parameters
timeoutThe disconnect timeout (in milliseconds).

◆ set_timeout() [2/2]

template<class Rep, class Period>
void mqtt::disconnect_options::set_timeout ( const std::chrono::duration< Rep, Period > & to)
inline

Sets the disconnect timeout with a duration. This allows for any remaining in-flight messages to be delivered.

Parameters
toThe disconnect connect timeout.

◆ set_token()

void mqtt::disconnect_options::set_token ( const token_ptr & tok,
int mqttVersion )

Sets the callback context to a delivery token.

Parameters
tokThe delivery token to be used as the callback context.
mqttVersionThe version of MQTT we're using for the connection.

◆ get_token()

token_ptr mqtt::disconnect_options::get_token ( ) const
inline

Gets the callback context to a delivery token.

Returns
The delivery token to be used as the callback context.

◆ get_properties() [1/2]

const properties & mqtt::disconnect_options::get_properties ( ) const
inline

Gets the disconnect properties.

Returns
A const reference to the properties for the disconnect.

◆ get_properties() [2/2]

properties & mqtt::disconnect_options::get_properties ( )
inline

Gets a mutable reference to the disconnect properties.

Returns
A mutable reference to the properties for the disconnect.

◆ set_properties() [1/2]

void mqtt::disconnect_options::set_properties ( const properties & props)
inline

Sets the properties for the connect.

Parameters
propsThe properties to place into the message.

◆ set_properties() [2/2]

void mqtt::disconnect_options::set_properties ( properties && props)
inline

Moves the properties for the connect.

Parameters
propsThe properties to move into the connect object.

◆ get_reason_code()

ReasonCode mqtt::disconnect_options::get_reason_code ( ) const
inline

Gets the reason code for the disconnect.

Returns
The reason code for the disconnect.

◆ set_reason_code()

void mqtt::disconnect_options::set_reason_code ( ReasonCode code)
inline

Sets the reason code for the disconnect.

Parameters
codeThe reason code for the disconnect.

Friends And Related Symbol Documentation

◆ async_client

friend class async_client
friend

The client has special access

◆ disconnect_options_builder

friend class disconnect_options_builder
friend

The options builder has special access


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