.. index:: pair: class; NRPMQTTProxy .. _doxid-class_n_r_p_m_q_t_t_proxy: class NRPMQTTProxy ================== .. toctree:: :hidden: Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class NRPMQTTProxy { public: // construction :target:`NRPMQTTProxy`(); :target:`NRPMQTTProxy`(const NRPMQTTProxy&); :target:`NRPMQTTProxy`(NRPMQTTProxy&&); // methods NRPMQTTProxy& :target:`operator =` (const NRPMQTTProxy&); NRPMQTTProxy& :target:`operator =` (NRPMQTTProxy&&); void :ref:`subscribe`( const std::string& address, const std::function& callback ); void :ref:`publish`( const std::string& address, const std::string& msg, bool retained = false ); bool :ref:`isConnected`(); void :ref:`disconnect`(); void :ref:`clearRetained`(); static NRPMQTTProxy& :ref:`getInstance`(); static NRPMQTTProxy& :ref:`resetInstance`(const :ref:`nlohmann::json`& clientParams); }; .. _details-class_n_r_p_m_q_t_t_proxy: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Methods ------- .. index:: pair: function; subscribe .. _doxid-class_n_r_p_m_q_t_t_proxy_1a3197dc584f1da9082d40452091e3033a: .. ref-code-block:: cpp :class: doxyrest-title-code-block void subscribe( const std::string& address, const std::function& callback ) Subscribe to MQTT topic 'address' with callback function 'callback'. .. index:: pair: function; publish .. _doxid-class_n_r_p_m_q_t_t_proxy_1aff83bb21cb2b047aa366b87c8519881a: .. ref-code-block:: cpp :class: doxyrest-title-code-block void publish( const std::string& address, const std::string& msg, bool retained = false ) Publishes 'msg' to MQTT topic 'address'. .. index:: pair: function; isConnected .. _doxid-class_n_r_p_m_q_t_t_proxy_1ae0306569bb50f5609afa80265df1fe8b: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isConnected() Check connection status to broker. .. index:: pair: function; disconnect .. _doxid-class_n_r_p_m_q_t_t_proxy_1a4684fd631c6c87a161c5eb54b82e8076: .. ref-code-block:: cpp :class: doxyrest-title-code-block void disconnect() Disconnects client from MQTT Broker. .. index:: pair: function; clearRetained .. _doxid-class_n_r_p_m_q_t_t_proxy_1aa63e9071472c0054ee60ead2d02e1f5a: .. ref-code-block:: cpp :class: doxyrest-title-code-block void clearRetained() Clear all topics with retain messages by sending an empty msg. .. index:: pair: function; getInstance .. _doxid-class_n_r_p_m_q_t_t_proxy_1a6a9efc67e037445ece84bff471794d0e: .. ref-code-block:: cpp :class: doxyrest-title-code-block static NRPMQTTProxy& getInstance() Get singleton instance of :ref:`NRPMQTTProxy `. .. index:: pair: function; resetInstance .. _doxid-class_n_r_p_m_q_t_t_proxy_1aeb9a8dbee1546518a3388f131745cbec: .. ref-code-block:: cpp :class: doxyrest-title-code-block static NRPMQTTProxy& resetInstance(const :ref:`nlohmann::json`& clientParams) Reset singleton instance.