#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()
| bitsim::network::MqttSubscriber::MqttSubscriber |
( |
const std::string & | server, |
|
|
const std::string & | topic ) |
◆ ~MqttSubscriber()
| bitsim::network::MqttSubscriber::~MqttSubscriber |
( |
| ) |
|
|
override |
◆ connect()
| void bitsim::network::MqttSubscriber::connect |
( |
| ) |
|
◆ is_connected()
| bool bitsim::network::MqttSubscriber::is_connected |
( |
| ) |
const |
|
inlinenoexcept |
◆ message_arrived()
| void bitsim::network::MqttSubscriber::message_arrived |
( |
mqtt::const_message_ptr | msg | ) |
|
|
override |
◆ poll()
| std::optional< std::string > bitsim::network::MqttSubscriber::poll |
( |
std::chrono::milliseconds | timeout = std::chrono::milliseconds(1000) | ) |
|
◆ publish() [1/2]
| void bitsim::network::MqttSubscriber::publish |
( |
const nlohmann::json & | payload, |
|
|
int_t | qos = 1, |
|
|
bool | retained = false ) |
Publish the JSON payload
- Parameters
-
◆ publish() [2/2]
| void bitsim::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 > bitsim::network::MqttSubscriber::read |
( |
std::chrono::milliseconds | timeout = std::chrono::milliseconds::zero() | ) |
|
◆ topic()
| std::string bitsim::network::MqttSubscriber::topic |
( |
| ) |
const |
|
inlinenoexcept |
The documentation for this class was generated from the following files: