Paho C++
1.0
The Paho MQTT C++ Client Library
|
Holds the set of options that control how the client connects to a server. More...
#include <connect_options.h>
Public Types | |
using | ptr_t = std::shared_ptr< connect_options > |
Smart/shared pointer to an object of this class. More... | |
using | const_ptr_t = std::shared_ptr< const connect_options > |
Smart/shared pointer to a const object of this class. More... | |
Public Member Functions | |
connect_options () | |
Constructs a new object using the default values. | |
connect_options (string_ref userName, binary_ref password) | |
Constructs a new object using the specified user name and password. More... | |
connect_options (const connect_options &opt) | |
Copy constructor. More... | |
connect_options (connect_options &&opt) | |
Move constructor. More... | |
connect_options & | operator= (const connect_options &opt) |
Copy assignment. More... | |
connect_options & | operator= (connect_options &&opt) |
Move assignment. More... | |
std::chrono::seconds | get_keep_alive_interval () const |
Gets the "keep alive" interval. More... | |
std::chrono::seconds | get_connect_timeout () const |
Gets the connection timeout. More... | |
string | get_user_name () const |
Gets the user name to use for the connection. More... | |
binary_ref | get_password () const |
Gets the password to use for the connection. More... | |
string | get_password_str () const |
Gets the password to use for the connection. More... | |
int | get_max_inflight () const |
Gets the maximum number of messages that can be in-flight simultaneously. More... | |
string | get_will_topic () const |
Gets the topic to be used for last will and testament (LWT). More... | |
const_message_ptr | get_will_message () const |
Gets the message to be sent as last will and testament (LWT). More... | |
const will_options & | get_will_options () const |
Get the LWT options to use for the connection. More... | |
const ssl_options & | get_ssl_options () const |
Get the SSL options to use for the connection. More... | |
void | set_ssl (const ssl_options &ssl) |
Sets the SSL for the connection. More... | |
bool | is_clean_session () const |
Returns whether the server should remember state for the client across reconnects. More... | |
token_ptr | get_token () const |
Gets the token used as the callback context. More... | |
const_string_collection_ptr | get_servers () const |
Gets the list of servers to which the client will connect. More... | |
int | get_mqtt_version () const |
Gets the version of MQTT to be used on the connect. More... | |
bool | get_automatic_reconnect () const |
Determines if the options have been configured for automatic reconnect. More... | |
std::chrono::seconds | get_min_retry_interval () const |
Gets the minimum retry interval for automatic reconnect. More... | |
std::chrono::seconds | get_max_retry_interval () const |
Gets the maximum retry interval for automatic reconnect. More... | |
void | set_clean_session (bool cleanSession) |
Sets whether the server should remember state for the client across reconnects. More... | |
void | set_connection_timeout (int timeout) |
Sets the connection timeout value. More... | |
void | set_keep_alive_interval (int keepAliveInterval) |
Sets the "keep alive" interval. More... | |
template<class Rep , class Period > | |
void | set_keep_alive_interval (const std::chrono::duration< Rep, Period > &interval) |
Sets the "keep alive" interval with a chrono duration. More... | |
void | set_connect_timeout (int to) |
Sets the connect timeout in seconds. More... | |
template<class Rep , class Period > | |
void | set_connect_timeout (const std::chrono::duration< Rep, Period > &to) |
Sets the connect timeout with a chrono duration. More... | |
void | set_user_name (string_ref userName) |
Sets the user name to use for the connection. More... | |
void | set_password (binary_ref password) |
Sets the password to use for the connection. | |
void | set_max_inflight (int n) |
Sets the maximum number of messages that can be in-flight simultaneously. More... | |
void | set_will (const will_options &will) |
Sets the "Last Will and Testament" (LWT) for the connection. More... | |
void | set_token (const token_ptr &tok) |
Sets the callback context to a delivery token. More... | |
void | set_servers (const_string_collection_ptr serverURIs) |
Sets the list of servers to which the client will connect. More... | |
void | set_mqtt_version (int mqttVersion) |
Sets the version of MQTT to be used on the connect. More... | |
void | set_automatic_reconnect (bool on) |
Enable or disable automatic reconnects. More... | |
void | set_automatic_reconnect (int minRetryInterval, int maxRetryInterval) |
Enable or disable automatic reconnects. More... | |
template<class Rep1 , class Period1 , class Rep2 , class Period2 > | |
void | set_automatic_reconnect (const std::chrono::duration< Rep1, Period1 > &minRetryInterval, const std::chrono::duration< Rep2, Period2 > &maxRetryInterval) |
Enable or disable automatic reconnects. More... | |
string | to_string () const |
Gets a string representation of the object. More... | |
Friends | |
class | async_client |
The client has special access. | |
class | connect_options_test |
class | token_test |
Holds the set of options that control how the client connects to a server.
using mqtt::connect_options::const_ptr_t = std::shared_ptr<const connect_options> |
Smart/shared pointer to a const object of this class.
using mqtt::connect_options::ptr_t = std::shared_ptr<connect_options> |
Smart/shared pointer to an object of this class.
mqtt::connect_options::connect_options | ( | string_ref | userName, |
binary_ref | password | ||
) |
Constructs a new object using the specified user name and password.
userName | The name of the user for connecting to the server |
password | The password for connecting to the server |
mqtt::connect_options::connect_options | ( | const connect_options & | opt | ) |
Copy constructor.
opt | Another object to copy. |
mqtt::connect_options::connect_options | ( | connect_options && | opt | ) |
Move constructor.
opt | Another object to move into this new one. |
|
inline |
Determines if the options have been configured for automatic reconnect.
|
inline |
Gets the connection timeout.
This is the amount of time the underlying library will wait for a timeout before failing.
|
inline |
Gets the "keep alive" interval.
|
inline |
Gets the maximum number of messages that can be in-flight simultaneously.
|
inline |
Gets the maximum retry interval for automatic reconnect.
|
inline |
Gets the minimum retry interval for automatic reconnect.
|
inline |
Gets the version of MQTT to be used on the connect.
|
inline |
Gets the password to use for the connection.
|
inline |
Gets the password to use for the connection.
|
inline |
Gets the list of servers to which the client will connect.
|
inline |
Get the SSL options to use for the connection.
|
inline |
Gets the token used as the callback context.
|
inline |
Gets the user name to use for the connection.
|
inline |
Gets the message to be sent as last will and testament (LWT).
|
inline |
Get the LWT options to use for the connection.
|
inline |
Gets the topic to be used for last will and testament (LWT).
|
inline |
Returns whether the server should remember state for the client across reconnects.
connect_options& mqtt::connect_options::operator= | ( | const connect_options & | opt | ) |
Copy assignment.
opt | Another object to copy. |
connect_options& mqtt::connect_options::operator= | ( | connect_options && | opt | ) |
Move assignment.
opt | Another object to move into this new one. |
|
inline |
Enable or disable automatic reconnects.
The retry intervals are not affected.
on | Whether to turn reconnects on or off |
void mqtt::connect_options::set_automatic_reconnect | ( | int | minRetryInterval, |
int | maxRetryInterval | ||
) |
Enable or disable automatic reconnects.
minRetryInterval | Minimum retry interval in seconds. Doubled on each failed retry. |
maxRetryInterval | Maximum retry interval in seconds. The doubling stops here on failed retries. |
|
inline |
Enable or disable automatic reconnects.
minRetryInterval | Minimum retry interval. Doubled on each failed retry. |
maxRetryInterval | Maximum retry interval. The doubling stops here on failed retries. |
|
inline |
Sets whether the server should remember state for the client across reconnects.
cleanSession |
|
inline |
Sets the connect timeout in seconds.
This is the maximum time that the underlying library will wait for a connection before failing.
to | The connect timeout in seconds. |
|
inline |
Sets the connect timeout with a chrono duration.
This is the maximum time that the underlying library will wait for a connection before failing.
to | The connect timeout in seconds. |
|
inline |
Sets the connection timeout value.
timeout |
|
inline |
Sets the "keep alive" interval.
This is the maximum time that should pass without communications between client and server. If no massages pass in this time, the client will ping the broker.
keepAliveInterval | The keep alive interval in seconds. |
|
inline |
Sets the "keep alive" interval with a chrono duration.
This is the maximum time that should pass without communications between client and server. If no massages pass in this time, the client will ping the broker.
interval | The keep alive interval. |
|
inline |
Sets the maximum number of messages that can be in-flight simultaneously.
n | The maximum number of inflight messages. |
|
inline |
Sets the version of MQTT to be used on the connect.
mqttVersion | The MQTT version to use for the connection:
|
void mqtt::connect_options::set_servers | ( | const_string_collection_ptr | serverURIs | ) |
Sets the list of servers to which the client will connect.
serverURIs | A pointer to a collection of server URI's. Each entry should be of the form protocol://host:port where protocol must be tcp or ssl. For host, you can specify either an IP address or a domain name. |
void mqtt::connect_options::set_ssl | ( | const ssl_options & | ssl | ) |
Sets the SSL for the connection.
These will only have an effect if compiled against the SSL version of the Paho C library.
ssl | The SSL options. |
void mqtt::connect_options::set_token | ( | const token_ptr & | tok | ) |
Sets the callback context to a delivery token.
tok | The delivery token to be used as the callback context. |
void mqtt::connect_options::set_user_name | ( | string_ref | userName | ) |
Sets the user name to use for the connection.
userName |
void mqtt::connect_options::set_will | ( | const will_options & | will | ) |
Sets the "Last Will and Testament" (LWT) for the connection.
will | The LWT options. |
string mqtt::connect_options::to_string | ( | ) | const |
Gets a string representation of the object.