IQRF Gateway Daemon
|
MQTT messaging. More...
#include <MqttMessaging.h>
Public Member Functions | |
MqttMessaging ()=delete | |
MqttMessaging (const std::string &name) | |
virtual | ~MqttMessaging () |
void | start () override |
IMessaging overriden methods. More... | |
void | stop () override |
Stop Messaging instance. More... | |
void | update (const rapidjson::Value &cfg) override |
Update configuration. More... | |
const std::string & | getName () const override |
Get name of the instance. More... | |
void | registerMessageHandler (MessageHandlerFunc hndl) override |
Register message handler. More... | |
void | unregisterMessageHandler () override |
Unregister message handler. More... | |
void | sendMessage (const ustring &msg) override |
send message More... | |
![]() | |
virtual | ~IMessaging () |
Additional Inherited Members | |
![]() | |
typedef std::basic_string< unsigned char > | ustring |
typedef std::function< void(const ustring &)> | MessageHandlerFunc |
Incoming message handler functional type. More... | |
MQTT messaging.
Implements IMessaging interface for MQTT communication by MQTT Paho library
Configurable via its update() method accepting JSON properties:
|
delete |
MqttMessaging::MqttMessaging | ( | const std::string & | name | ) |
|
virtual |
|
overridevirtual |
Get name of the instance.
Returns unique name of the instance
Implements IMessaging.
|
overridevirtual |
Register message handler.
[in] | hndl | registering handler function |
Whenever a message is received it is passed to the handler function. It is possible to register just one handler
Implements IMessaging.
|
overridevirtual |
send message
[in] | msg | message to be sent |
The message is send outside
Implements IMessaging.
|
overridevirtual |
IMessaging overriden methods.
Implements IMessaging.
|
overridevirtual |
|
overridevirtual |
Unregister message handler.
If the handler is not required anymore, it is possible to unregister via this method.
Implements IMessaging.
|
overridevirtual |
Update configuration.
[in] | cfg | configuration data |
Configuration data are taken from passed cfg and the instance is configured accordingly
Implements IMessaging.