async_mqtt 9.0.1
|
MQTT PUBLISH packet (v5) More...
#include <v5_publish.hpp>
Public Member Functions | |
template<typename StringViewLike , typename Payload , std::enable_if_t< std::is_convertible_v< std::decay_t< StringViewLike >, std::string_view > &&detail::is_payload< Payload >(), std::nullptr_t > = nullptr> | |
basic_publish_packet (typename basic_packet_id_type< PacketIdBytes >::type packet_id, StringViewLike &&topic_name, Payload &&payloads, pub::opts pubopts, properties props={}) | |
constructor | |
template<typename StringViewLike , typename Payload , std::enable_if_t< std::is_convertible_v< std::decay_t< StringViewLike >, std::string_view > &&detail::is_payload< Payload >(), std::nullptr_t > = nullptr> | |
basic_publish_packet (StringViewLike &&topic_name, Payload &&payloads, pub::opts pubopts, properties props={}) | |
constructor for QoS0 | |
std::vector< as::const_buffer > | const_buffer_sequence () const |
Create const buffer sequence it is for boost asio APIs. | |
std::size_t | size () const |
Get packet size. | |
std::size_t | num_of_const_buffer_sequence () const |
Get number of element of const_buffer_sequence. | |
basic_packet_id_type< PacketIdBytes >::type | packet_id () const |
Get packet id. | |
constexpr pub::opts | opts () const |
Get publish_options. | |
std::string | topic () const |
Get topic name. | |
buffer const & | topic_as_buffer () const |
Get topic as a buffer. | |
std::string | payload () const |
Get payload. | |
auto | payload_range () const |
Get payload range. | |
std::vector< buffer > const & | payload_as_buffer () const |
Get payload as a sequence of buffer. | |
constexpr void | set_dup (bool dup) |
Set dup flag. | |
properties const & | props () const |
Get properties. | |
void | remove_topic_add_topic_alias (topic_alias_type val) |
Remove topic and add topic_alias This is for applying topic_alias. | |
void | add_topic_alias (topic_alias_type val) |
Add topic_alias This is for registering topic_alias. | |
void | add_topic (std::string topic) |
Add topic This is for extracting topic_alias. | |
void | remove_topic_alias () |
Remove topic alias This is for prepareing to store packet. | |
void | remove_topic_alias_add_topic (std::string topic) |
Remove topic and add topic_alias This is for extracting topic from the topic_alias. | |
void | update_message_expiry_interval (std::uint32_t val) |
Update MessageExpiryInterval property. | |
Static Public Member Functions | |
static constexpr control_packet_type | type () |
Get MQTT control packet type. | |
Related Symbols | |
(Note that these are not member symbols.) | |
using | publish_packet = basic_publish_packet<2> |
Type alias of basic_publish_packet (PacketIdBytes=2). | |
template<std::size_t PacketIdBytes> | |
bool | operator< (basic_publish_packet< PacketIdBytes > const &lhs, basic_publish_packet< PacketIdBytes > const &rhs) |
less than operator | |
template<std::size_t PacketIdBytes> | |
bool | operator== (basic_publish_packet< PacketIdBytes > const &lhs, basic_publish_packet< PacketIdBytes > const &rhs) |
equal operator | |
template<std::size_t PacketIdBytes> | |
std::ostream & | operator<< (std::ostream &o, basic_publish_packet< PacketIdBytes > const &v) |
stream output operator | |
MQTT PUBLISH packet (v5)
PacketIdBytes | size of packet_id |
If both the client and the broker keeping the session, QoS1 and QoS2 PUBLISH packet is stored in the endpoint for resending if disconnect/reconnect happens. In addition, the client can sent the packet at offline. The packets are stored and will send after the next connection is established. If the session doesn' exist or lost, then the stored packets are erased.
See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901100
|
explicit |
constructor
StringViewLike | Type of the topic. Any type can convert to std::string_view. |
Payload | Type of the payload. Any type can convert to std::string_view or its sequence. |
|
explicit |
constructor for QoS0
StringViewLike | Type of the topic. Any type can convert to std::string_view. |
Payload | Type of the payload. Any type can convert to std::string_view or its sequence. |
topic_name | MQTT TopicName See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901107 |
payloads | The body message of the packet. It could be a single buffer of multiple buffer sequence. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901119 |
pubopts | Publish Options. It contains the following elements: DUP See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901102 QoS See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901103 RETAIN See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901104 |
props | Publish properties. See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901109 |
void async_mqtt::v5::basic_publish_packet< PacketIdBytes >::add_topic | ( | std::string | topic | ) |
Add topic This is for extracting topic_alias.
topic | to add |
void async_mqtt::v5::basic_publish_packet< PacketIdBytes >::add_topic_alias | ( | topic_alias_type | val | ) |
Add topic_alias This is for registering topic_alias.
val | topic_alias |
std::vector< as::const_buffer > async_mqtt::v5::basic_publish_packet< PacketIdBytes >::const_buffer_sequence | ( | ) | const |
Create const buffer sequence it is for boost asio APIs.
std::size_t async_mqtt::v5::basic_publish_packet< PacketIdBytes >::num_of_const_buffer_sequence | ( | ) | const |
Get number of element of const_buffer_sequence.
|
inlineconstexpr |
Get publish_options.
basic_packet_id_type< PacketIdBytes >::type async_mqtt::v5::basic_publish_packet< PacketIdBytes >::packet_id | ( | ) | const |
Get packet id.
std::string async_mqtt::v5::basic_publish_packet< PacketIdBytes >::payload | ( | ) | const |
Get payload.
std::vector< buffer > const & async_mqtt::v5::basic_publish_packet< PacketIdBytes >::payload_as_buffer | ( | ) | const |
Get payload as a sequence of buffer.
auto async_mqtt::v5::basic_publish_packet< PacketIdBytes >::payload_range | ( | ) | const |
Get payload range.
properties const & async_mqtt::v5::basic_publish_packet< PacketIdBytes >::props | ( | ) | const |
Get properties.
void async_mqtt::v5::basic_publish_packet< PacketIdBytes >::remove_topic_add_topic_alias | ( | topic_alias_type | val | ) |
Remove topic and add topic_alias This is for applying topic_alias.
val | topic_alias |
void async_mqtt::v5::basic_publish_packet< PacketIdBytes >::remove_topic_alias_add_topic | ( | std::string | topic | ) |
Remove topic and add topic_alias This is for extracting topic from the topic_alias.
topic | topic_alias |
|
inlineconstexpr |
Set dup flag.
dup | flag value to set |
std::size_t async_mqtt::v5::basic_publish_packet< PacketIdBytes >::size | ( | ) | const |
Get packet size.
std::string async_mqtt::v5::basic_publish_packet< PacketIdBytes >::topic | ( | ) | const |
Get topic name.
buffer const & async_mqtt::v5::basic_publish_packet< PacketIdBytes >::topic_as_buffer | ( | ) | const |
Get topic as a buffer.
|
inlinestaticconstexpr |
Get MQTT control packet type.
void async_mqtt::v5::basic_publish_packet< PacketIdBytes >::update_message_expiry_interval | ( | std::uint32_t | val | ) |
Update MessageExpiryInterval property.
val | message_expiry_interval |
|
related |
less than operator
lhs | compare target |
rhs | compare target |
|
related |
stream output operator
o | output stream |
v | target |
|
related |
equal operator
lhs | compare target |
rhs | compare target |