|
SPSP
Simple publish-subscribe protocol. Connects low power IoT clients to MQTT.
|
Go to the documentation of this file.
12 #include "mqtt_client.h"
17 namespace SPSP::FarLayers::MQTT
29 esp_mqtt_client_handle_t m_mqtt;
31 AdapterSubDataCb m_subDataCb =
nullptr;
32 AdapterConnectedCb m_connectedCb =
nullptr;
61 bool publish(
const std::string& topic,
const std::string& payload);
124 return str.empty() ? nullptr : str.c_str();
~Adapter()
Destroys MQTT layer object.
Adapter(const Config &conf)
Constructs a new MQTT layer object.
Interface for platform-dependent MQTT adapter.
Interface for platform-dependent MQTT adapter.
AdapterSubDataCb getSubDataCb() const
Gets callback for incoming subscription data.
MQTT client configuration.
static const char * stringToCOrNull(const std::string &str)
Helper to convert std::string to C string or nullptr
void setSubDataCb(AdapterSubDataCb cb)
Sets callback for incoming subscription data.
bool subscribe(const std::string &topic)
Subscribes to given topic.
bool publish(const std::string &topic, const std::string &payload)
Publishes message coming from node.
void setConnectedCb(AdapterConnectedCb cb)
Sets connected callback.
MQTT adapter for ESP platform.
bool unsubscribe(const std::string &topic)
Unsubscribes from given topic.
AdapterConnectedCb getConnectedCb() const
Gets connected callback.