Go to the documentation of this file.
53 void subscribe(
const std::string& address,
const std::function<
void (
const std::string&)>& callback);
58 void publish(
const std::string& address,
const std::string& msg,
bool retained=
false);
86 std::shared_ptr< NRPMQTTClient> _mqttClient;
93 static std::unique_ptr<NRPMQTTProxy> _instance;
static NRPMQTTProxy & resetInstance(const nlohmann::json &clientParams)
Reset singleton instance.
Definition: nrp_mqtt_proxy.cpp:31
static NRPMQTTProxy & getInstance()
Get singleton instance of NRPMQTTProxy.
Definition: nrp_mqtt_proxy.cpp:26
NRPMQTTProxy & operator=(const NRPMQTTProxy &)=delete
bool _doBypassBroker
If true, msgs are published directly to subscriber callbacks, without going through the MQTT broker....
Definition: nrp_mqtt_proxy.h:80
bool isConnected()
Check connection status to broker.
Definition: nrp_mqtt_proxy.cpp:55
Definition: nrp_mqtt_proxy.h:27
void disconnect()
Disconnects client from MQTT Broker.
Definition: nrp_mqtt_proxy.cpp:63
void publish(const std::string &address, const std::string &msg, bool retained=false)
Publishes 'msg' to MQTT topic 'address'.
Definition: nrp_mqtt_proxy.cpp:37
void subscribe(const std::string &address, const std::function< void(const std::string &)> &callback)
Subscribe to MQTT topic 'address' with callback function 'callback'.
Definition: nrp_mqtt_proxy.cpp:45
void clearRetained()
Clear all topics with retain messages by sending an empty msg.
Definition: nrp_mqtt_proxy.cpp:70
friend class EventLoop_EVENT_LOOP_ENGINE_Test
Definition: nrp_mqtt_proxy.h:82
nlohmann::json json
Definition: engine_json_server.cpp:31