![]() |
PahoMqttCpp
MQTT C++ Client for POSIX and Windows
|
#include <subscribe_options.h>
Public Types | |
enum | RetainHandling { SEND_RETAINED_ON_SUBSCRIBE = 0 , SEND_RETAINED_ON_NEW = 1 , DONT_SEND_RETAINED = 2 } |
using | ptr_t = std::shared_ptr< subscribe_options > |
using | const_ptr_t = std::shared_ptr< const subscribe_options > |
Public Member Functions | |
subscribe_options () | |
subscribe_options (bool noLocal, bool retainAsPublished=false, RetainHandling retainHandling=SEND_RETAINED_ON_SUBSCRIBE) | |
subscribe_options (MQTTSubscribe_options opts) | |
bool | get_no_local () const |
void | set_no_local (bool on=true) |
bool | get_retain_as_published () const |
void | set_retain_as_published (bool on=true) |
auto | get_retain_handling () const -> RetainHandling |
void | set_retain_handling (RetainHandling retainHandling) |
Static Public Attributes | |
static constexpr bool | NO_LOCAL = true |
static constexpr bool | LOCAL = false |
static constexpr bool | SUBSCRIBE_NO_LOCAL = true |
static constexpr bool | SUBSCRIBE_LOCAL = false |
static constexpr bool | NO_RETAIN_AS_PUBLISHED = false |
static constexpr bool | RETAIN_AS_PUBLISHED = true |
Friends | |
class | async_client |
class | response_options |
The MQTT v5 subscription options.
The subscribe options are bitfields in the payload of a SUBSCRIBE packet, forming a single options byte for each topic filter in the subscription.
These were added in MQTT v5. The default (zero/false) value for each field gives the behavior that was present in MQTT v3.1.1. To get a new behavior the field(s) must be set.
These are defined in section 3.8.3.1 of the MQTT v5 spec.
using mqtt::subscribe_options::ptr_t = std::shared_ptr<subscribe_options> |
Smart/shared pointer to an object of this class.
using mqtt::subscribe_options::const_ptr_t = std::shared_ptr<const subscribe_options> |
Smart/shared pointer to a const object of this class.
|
inline |
Create default subscription options. These are the default options corresponding to the original MQTT (v3) behaviors.
|
inlineexplicit |
Creates a set of subscription options.
noLocal | Whether the server should send back our own publications, if subscribed. |
retainAsPublished | Whether to keep the retained flag as in the original published message (true). |
retainHandling | When to send retained messages:
|
|
inlineexplicit |
Creates the set of subscribe options from an underlying C struct.
opts | The Paho C subscribe options |
|
inline |
Gets the value of the "no local" flag.
|
inline |
Sets the "no local" flag on or off.
on | Whether the server should send back our own publications, if subscribed. |
|
inline |
Gets the "retain as published" flag.
|
inline |
Sets the "retain as published" flag on or off.
on | Whether to keep the retained flag as in the original published message. |
|
inline |
Gets the "retain handling" option.
|
inline |
Sets the "retain handling" option.
retainHandling | When to send retained messages:
|
|
friend |
The client and response have special access
|
friend |
|
staticconstexpr |
Don't receive our own publications
|
staticconstexpr |
Receive our own publications
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
Retain flag is only set on publications sent by a broker if in response to a subscribe request
|
staticconstexpr |
Keep the retain flag as on the original publish message