![]() |
PahoMqttCpp
MQTT C++ Client for POSIX and Windows
|
Functions | |
const string | VERSION_STR ("Paho MQTT C++ (mqttpp) v. 1.5.0") |
const string | COPYRIGHT ("Copyright (c) 2013-2024 Frank Pagliughi") |
template<typename T > | |
std::ostream & | operator<< (std::ostream &os, const buffer_ref< T > &buf) |
template<typename T > | |
std::ostream & | operator<< (std::ostream &os, const buffer_view< T > &buf) |
std::ostream & | operator<< (std::ostream &os, const exception &exc) |
void * | persistence_malloc (size_t n) |
void | persistence_free (void *p) |
message_ptr | make_message (string_ref topic, const void *payload, size_t len, int qos, bool retained, const properties &props=properties()) |
message_ptr | make_message (string_ref topic, const void *payload, size_t len) |
message_ptr | make_message (string_ref topic, binary_ref payload, int qos, bool retained, const properties &props=properties()) |
message_ptr | make_message (string_ref topic, binary_ref payload) |
std::ostream & | operator<< (std::ostream &os, const property &prop) |
template<typename T > | |
T | get (const property &) |
template<> | |
uint8_t | get< uint8_t > (const property &prop) |
template<> | |
uint16_t | get< uint16_t > (const property &prop) |
template<> | |
int16_t | get< int16_t > (const property &prop) |
template<> | |
uint32_t | get< uint32_t > (const property &prop) |
template<> | |
int32_t | get< int32_t > (const property &prop) |
template<> | |
string | get< string > (const property &prop) |
template<> | |
string_pair | get< string_pair > (const property &prop) |
template<typename T > | |
T | get (const properties &props, property::code propid, size_t idx) |
template<typename T > | |
T | get (const properties &props, property::code propid) |
std::string | to_string (ReasonCode reasonCode) |
std::ostream & | operator<< (std::ostream &os, ReasonCode reasonCode) |
template<class Rep , class Period > | |
std::chrono::seconds | to_seconds (const std::chrono::duration< Rep, Period > &dur) |
template<class Rep , class Period > | |
long | to_seconds_count (const std::chrono::duration< Rep, Period > &dur) |
template<class Rep , class Period > | |
std::chrono::milliseconds | to_milliseconds (const std::chrono::duration< Rep, Period > &dur) |
template<class Rep , class Period > | |
long | to_milliseconds_count (const std::chrono::duration< Rep, Period > &dur) |
bool | to_bool (int n) |
int | to_int (bool b) |
string | to_string (const char *cstr) |
Variables | |
const uint32_t | VERSION = 0x01050000 |
constexpr no_persistence | NO_PERSISTENCE {} |
using mqtt::async_client_ptr = typedef async_client::ptr_t |
Smart/shared pointer to an asynchronous MQTT client object
using mqtt::string_ref = typedef buffer_ref<char> |
A reference to a text buffer.
using mqtt::binary_ref = typedef buffer_ref<char> |
A reference to a binary buffer. Note that we're using char for the underlying data type to allow efficient moves to and from std::string's. Using a separate type indicates that the data may be arbitrary binary.
using mqtt::string_view = typedef buffer_view<char> |
A buffer view for character string data.
using mqtt::binary_view = typedef buffer_view<char> |
A buffer view for binary data
using mqtt::callback_ptr = typedef callback::ptr_t |
Smart/shared pointer to a callback object
using mqtt::const_callback_ptr = typedef callback::const_ptr_t |
Smart/shared pointer to a const callback object
using mqtt::client_ptr = typedef client::ptr_t |
Smart/shared pointer to an MQTT synchronous client object
using mqtt::connect_options_ptr = typedef connect_options::ptr_t |
Smart/shared pointer to a connection options object.
using mqtt::persistence_type = typedef std::variant<no_persistence, string, iclient_persistence*> |
A variant for the different type of persistence:
using mqtt::create_options_ptr = typedef create_options::ptr_t |
Smart/shared pointer to a connection options object.
using mqtt::delivery_token_ptr = typedef delivery_token::ptr_t |
Smart/shared pointer to a delivery_token
using mqtt::const_delivery_token_ptr = typedef delivery_token::const_ptr_t |
Smart/shared pointer to a const delivery_token
using mqtt::bad_cast = typedef std::bad_cast |
Bring std::bad_cast into the mqtt namespace
using mqtt::iaction_listener_ptr = typedef iaction_listener::ptr_t |
Smart/shared pointer to an action listener
using mqtt::const_iaction_listener_ptr = typedef iaction_listener::const_ptr_t |
Smart/shared pointer to a const action listener
using mqtt::iclient_persistence_ptr = typedef iclient_persistence::ptr_t |
Smart/shared pointer to a persistence client
using mqtt::const_iclient_persistence_ptr = typedef iclient_persistence::const_ptr_t |
Smart/shared pointer to a persistence client
using mqtt::message_ptr = typedef message::ptr_t |
Smart/shared pointer to a message
using mqtt::const_message_ptr = typedef message::const_ptr_t |
Smart/shared pointer to a const message
using mqtt::string_pair = typedef std::tuple<string, string> |
A pair of strings as a tuple.
using mqtt::ssl_options_ptr = typedef ssl_options::ptr_t |
Shared pointer to the ssl options class.
using mqtt::ssl_options_unique_ptr = typedef ssl_options::unique_ptr_t |
Unique pointer to the ssl options class.
using mqtt::string_collection_ptr = typedef string_collection::ptr_t |
Smart/shared pointer to a string collection
using mqtt::const_string_collection_ptr = typedef string_collection::const_ptr_t |
Smart/shared pointer to a const string_collection
using mqtt::subscribe_options_ptr = typedef subscribe_options::ptr_t |
Smart/shared pointer to a subscribe options object.
using mqtt::token_ptr = typedef token::ptr_t |
Smart/shared pointer to a token object
using mqtt::const_token_ptr = typedef token::const_ptr_t |
Smart/shared pointer to a const token object
using mqtt::topic_ptr = typedef topic::ptr_t |
A smart/shared pointer to a topic object.
using mqtt::const_topic_ptr = typedef topic::const_ptr_t |
A smart/shared pointer to a const topic object.
using mqtt::byte = typedef uint8_t |
A 'byte' is an 8-bit, unsigned int
using mqtt::string = typedef std::string |
An mqtt string is just a std::string
using mqtt::binary = typedef std::string |
A binary blob of data is, umm, just a string too!
using mqtt::string_ptr = typedef std::shared_ptr<const string> |
Smart/shared pointer to a const string
using mqtt::binary_ptr = typedef std::shared_ptr<const binary> |
Smart/shared pointer to a const binary blob
using mqtt::will_options_ptr = typedef will_options::ptr_t |
Shared pointer to a will options object.
using mqtt::const_will_options_ptr = typedef will_options::const_ptr_t |
Shared pointer to a const will options object.
using mqtt::will_options_unique_ptr = typedef will_options::unique_ptr_t |
Unique pointer to a will options object.
enum mqtt::ReasonCode |
The MQTT v5 Reason Codes.
const string mqtt::VERSION_STR | ( | "Paho MQTT C++ (mqttpp) v. 1.5.0" | ) |
The version string for the client library
const string mqtt::COPYRIGHT | ( | "Copyright (c) 2013-2024 Frank Pagliughi" | ) |
Copyright notice for the client library
std::ostream & mqtt::operator<< | ( | std::ostream & | os, |
const buffer_ref< T > & | buf | ||
) |
Stream inserter for a buffer reference. This does a binary write of the data in the buffer.
os | The output stream. |
buf | The buffer reference to write. |
std::ostream & mqtt::operator<< | ( | std::ostream & | os, |
const buffer_view< T > & | buf | ||
) |
Stream inserter for a buffer view. This does a binary write of the data in the buffer.
os | The output stream. |
buf | The buffer reference to write. |
|
inline |
Stream inserter writes a fairly verbose message
os | The stream. |
exc | The exception to write. |
|
inline |
Allocate memory for use with user persistence.
n | The number of bytes for the buffer. |
|
inline |
Frees memory allocated with persistence_malloc().
p | Pointer to a buffer obtained by persistence_malloc. |
|
inline |
Constructs a message with the specified array as a payload, and all other values set to defaults.
topic | The message topic |
payload | the bytes to use as the message payload |
len | the number of bytes in the payload |
qos | The quality of service for the message. |
retained | Whether the message should be retained by the broker. |
props | The MQTT v5 properties for the message. |
|
inline |
Constructs a message with the specified array as a payload, and all other values set to defaults.
topic | The message topic |
payload | the bytes to use as the message payload |
len | the number of bytes in the payload |
|
inline |
Constructs a message with the specified values.
topic | The message topic |
payload | A buffer to use as the message payload. |
qos | The quality of service for the message. |
retained | Whether the message should be retained by the broker. |
|
inline |
Constructs a message with the specified buffer as a payload, and all other values set to defaults.
topic | The message topic |
payload | A string to use as the message payload. |
std::ostream & mqtt::operator<< | ( | std::ostream & | os, |
const property & | prop | ||
) |
|
inline |
Extracts the value from the property as the specified type.
Extracts the value from the property as an unsigned 8-bit integer.
Extracts the value from the property as an unsigned 16-bit integer.
Extracts the value from the property as a signed 16-bit integer.
get<uint16_t>()
Extracts the value from the property as an unsigned 32-bit integer.
Extracts the value from the property as a signed 32-bit integer.
get<uint32_t>()
Extracts the value from the property as a string.
|
inline |
Extracts the value from the property as a pair of strings.
|
inline |
Retrieves a single value from a property list for when there may be multiple identical property ID's.
T | The type of the value to retrieve |
props | The property list |
propid | The property ID code for the desired value. |
idx | Index of the desired property ID |
|
inline |
Retrieves a single value from a property list.
T | The type of the value to retrieve |
props | The property list |
propid | The property ID code for the desired value. |
std::string mqtt::to_string | ( | ReasonCode | reasonCode | ) |
Get the string representation of the reason code.
reasonCode | An MQTT v5 reason code. |
std::ostream & mqtt::operator<< | ( | std::ostream & | os, |
ReasonCode | reasonCode | ||
) |
ostream inserter for reason codes
os | The output stream |
reasonCode | The reason code. |
std::chrono::seconds mqtt::to_seconds | ( | const std::chrono::duration< Rep, Period > & | dur | ) |
Convert a chrono duration to seconds. This casts away precision to get integer seconds.
dur | A chrono duration type |
long mqtt::to_seconds_count | ( | const std::chrono::duration< Rep, Period > & | dur | ) |
Convert a chrono duration to a number of seconds. This casts away precision to get integer seconds.
dur | A chrono duration type |
std::chrono::milliseconds mqtt::to_milliseconds | ( | const std::chrono::duration< Rep, Period > & | dur | ) |
Convert a chrono duration to milliseconds. This casts away precision to get integer milliseconds.
dur | A chrono duration type |
long mqtt::to_milliseconds_count | ( | const std::chrono::duration< Rep, Period > & | dur | ) |
Convert a chrono duration to a number of milliseconds. This casts away precision to get integer milliseconds.
dur | A chrono duration type |
|
inline |
Converts an into to a bool.
n | An integer. |
|
inline |
Converts the boolean into a C integer true/false value.
b | A boolean |
|
inline |
Gets a valid string for the char pointer, returning an empty string if the pointer is NULL.
cstr | A C-string pointer |
cstr
is NULL, this returns an empty string. const uint32_t mqtt::VERSION = 0x01050000 |
The version number for the client library.
|
constexpr |
A constant used to indicate that no persistence is desired