![]() |
PahoMqttCpp
MQTT C++ Client for POSIX and Windows
|
Functions | |
const string | VERSION_STR ("Paho MQTT C++ (mqttpp) v. 1.5.2") |
const string | COPYRIGHT ("Copyright (c) 2013-2025 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 = 0x01050002 |
constexpr no_persistence | NO_PERSISTENCE {} |
Smart/shared pointer to an asynchronous MQTT client object
using mqtt::string_ref = buffer_ref<char> |
A reference to a text buffer.
using mqtt::binary_ref = 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 = buffer_view<char> |
A buffer view for character string data.
using mqtt::binary_view = buffer_view<char> |
A buffer view for binary data
using mqtt::callback_ptr = callback::ptr_t |
Smart/shared pointer to a callback object
Smart/shared pointer to a const callback object
using mqtt::client_ptr = client::ptr_t |
Smart/shared pointer to an MQTT synchronous client object
Smart/shared pointer to a connection options object.
using mqtt::persistence_type = std::variant<no_persistence, string, iclient_persistence*> |
A variant for the different type of persistence:
Smart/shared pointer to a connection options object.
Smart/shared pointer to a delivery_token
Smart/shared pointer to a const delivery_token
using mqtt::bad_cast = std::bad_cast |
Bring std::bad_cast into the mqtt namespace
Smart/shared pointer to an action listener
Smart/shared pointer to a const action listener
Smart/shared pointer to a persistence client
Smart/shared pointer to a persistence client
using mqtt::message_ptr = message::ptr_t |
Smart/shared pointer to a message
Smart/shared pointer to a const message
using mqtt::string_pair = std::tuple<string, string> |
A pair of strings as a tuple.
Shared pointer to the ssl options class.
Unique pointer to the ssl options class.
Smart/shared pointer to a string collection
Smart/shared pointer to a const string_collection
Smart/shared pointer to a subscribe options object.
using mqtt::token_ptr = token::ptr_t |
Smart/shared pointer to a token object
Smart/shared pointer to a const token object
using mqtt::topic_ptr = topic::ptr_t |
A smart/shared pointer to a topic object.
A smart/shared pointer to a const topic object.
using mqtt::byte = uint8_t |
A 'byte' is an 8-bit, unsigned int
using mqtt::string = std::string |
An mqtt string is just a std::string
using mqtt::binary = std::string |
A binary blob of data is, umm, just a string too!
using mqtt::string_ptr = std::shared_ptr<const string> |
Smart/shared pointer to a const string
using mqtt::binary_ptr = std::shared_ptr<const binary> |
Smart/shared pointer to a const binary blob
Shared pointer to a will options object.
Shared pointer to a const will options object.
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.2" | ) |
The version string for the client library
const string mqtt::COPYRIGHT | ( | "Copyright (c) 2013-2025 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 = 0x01050002 |
The version number for the client library.
|
constexpr |
A constant used to indicate that no persistence is desired