#include <mqtt_subscriber.h>
|
| | MqttSubscriber (const std::string &server, const std::string &topic) |
| |
| | ~MqttSubscriber () override |
| |
| std::string | topic () const noexcept |
| |
| bool | is_connected () const noexcept |
| |
| void | connect () |
| |
| std::optional< std::string > | poll (std::chrono::milliseconds timeout=std::chrono::milliseconds(1000)) |
| |
| std::optional< std::string > | read (std::chrono::milliseconds timeout=std::chrono::milliseconds::zero()) |
| |
| void | message_arrived (mqtt::const_message_ptr msg) override |
| |
| void | publish (const std::string &payload, int_t qos=1, bool retained=false) |
| |
| void | publish (const nlohmann::json &payload, int_t qos=1, bool retained=false) |
| |
A thin wrapper over mqtt::async_client
◆ MqttSubscriber()
| bitrl::network::MqttSubscriber::MqttSubscriber |
( |
const std::string & |
server, |
|
|
const std::string & |
topic |
|
) |
| |
◆ ~MqttSubscriber()
| bitrl::network::MqttSubscriber::~MqttSubscriber |
( |
| ) |
|
|
override |
◆ connect()
| void bitrl::network::MqttSubscriber::connect |
( |
| ) |
|
◆ is_connected()
| bool bitrl::network::MqttSubscriber::is_connected |
( |
| ) |
const |
|
inlinenoexcept |
◆ message_arrived()
| void bitrl::network::MqttSubscriber::message_arrived |
( |
mqtt::const_message_ptr |
msg | ) |
|
|
override |
◆ poll()
| std::optional< std::string > bitrl::network::MqttSubscriber::poll |
( |
std::chrono::milliseconds |
timeout = std::chrono::milliseconds(1000) | ) |
|
◆ publish() [1/2]
| void bitrl::network::MqttSubscriber::publish |
( |
const nlohmann::json & |
payload, |
|
|
int_t |
qos = 1, |
|
|
bool |
retained = false |
|
) |
| |
Publish the JSON payload
- Parameters
-
◆ publish() [2/2]
| void bitrl::network::MqttSubscriber::publish |
( |
const std::string & |
payload, |
|
|
int_t |
qos = 1, |
|
|
bool |
retained = false |
|
) |
| |
Publish the payload to the topic that this subscriber listens to
- Parameters
-
◆ read()
| std::optional< std::string > bitrl::network::MqttSubscriber::read |
( |
std::chrono::milliseconds |
timeout = std::chrono::milliseconds::zero() | ) |
|
◆ topic()
| std::string bitrl::network::MqttSubscriber::topic |
( |
| ) |
const |
|
inlinenoexcept |
The documentation for this class was generated from the following files: