Represents a topic destination, used for publish/subscribe messaging.
More...
#include <topic.h>
Represents a topic destination, used for publish/subscribe messaging.
A smart/shared pointer to this class.
A smart/shared pointer to this class.
Construct an MQTT topic destination for messages.
- Parameters
-
cli | Client to which the topic is attached |
name | The topic string |
qos | The default QoS for publishing. |
retained | The default retained flag for the topic. |
Creates a new topic.
- Parameters
-
cli | Client to which the topic is attached |
name | The topic string |
qos | The default QoS for publishing. |
retained | The default retained flag for the topic. |
- Returns
- A shared pointer to the topic.
Gets a reference to the MQTT client used by this topic.
- Returns
- The MQTT client used by this topic
const string& mqtt::topic::get_name |
( |
| ) |
const |
|
inline |
Gets the name of the topic.
- Returns
- The name of the topic.
int mqtt::topic::get_qos |
( |
| ) |
const |
|
inline |
Gets the default quality of service for this topic.
- Returns
- The default quality of service for this topic.
bool mqtt::topic::get_retained |
( |
| ) |
const |
|
inline |
Gets the default retained flag used for this topic.
- Returns
- The default retained flag used for this topic.
delivery_token_ptr mqtt::topic::publish |
( |
const void * |
payload, |
|
|
size_t |
n |
|
) |
| |
Publishes a message on the topic using the default QoS and retained flag.
- Parameters
-
payload | the bytes to use as the message payload |
n | the number of bytes in the payload |
- Returns
- The delivery token used to track and wait for the publish to complete.
delivery_token_ptr mqtt::topic::publish |
( |
const void * |
payload, |
|
|
size_t |
n, |
|
|
int |
qos, |
|
|
bool |
retained |
|
) |
| |
Publishes a message on the topic.
- Parameters
-
payload | the bytes to use as the message payload |
n | the number of bytes in the payload |
qos | the Quality of Service to deliver the message at. Valid values are 0, 1 or 2. |
retained | whether or not this message should be retained by the server. |
- Returns
- The delivery token used to track and wait for the publish to complete.
delivery_token_ptr mqtt::topic::publish |
( |
binary_ref |
payload | ) |
|
Publishes a message on the topic using the default QoS and retained flag.
- Parameters
-
payload | the bytes to use as the message payload |
- Returns
- The delivery token used to track and wait for the publish to complete.
delivery_token_ptr mqtt::topic::publish |
( |
binary_ref |
payload, |
|
|
int |
qos, |
|
|
bool |
retained |
|
) |
| |
Publishes a message on the topic.
- Parameters
-
payload | the bytes to use as the message payload |
qos | the Quality of Service to deliver the message at. Valid values are 0, 1 or 2. |
retained | whether or not this message should be retained by the server. |
- Returns
- The delivery token used to track and wait for the publish to complete.
void mqtt::topic::set_qos |
( |
int |
qos | ) |
|
|
inline |
Sets the default quality of service for this topic.
- Parameters
-
qos | The default quality of service for this topic. |
void mqtt::topic::set_retained |
( |
bool |
retained | ) |
|
|
inline |
Sets the default retained flag used for this topic.
- Parameters
-
retained | The default retained flag used for this topic. |
string mqtt::topic::to_string |
( |
| ) |
const |
|
inline |
Returns a string representation of this topic.
- Returns
- The name of the topic
The documentation for this class was generated from the following file: