IQRF Gateway Daemon
Public Types | Public Member Functions | List of all members
IMessaging Class Referenceabstract

IMessaging interface. More...

#include <IMessaging.h>

Inheritance diagram for IMessaging:
MqMessaging MqttMessaging UdpMessaging

Public Types

typedef std::basic_string< unsigned char > ustring
 
typedef std::function< void(const ustring &)> MessageHandlerFunc
 Incoming message handler functional type. More...
 

Public Member Functions

virtual void start ()=0
 Start Messaging instance. More...
 
virtual void stop ()=0
 Stop Messaging instance. More...
 
virtual void update (const rapidjson::Value &cfg)=0
 Update configuration. More...
 
virtual const std::string & getName () const =0
 Get name of the instance. More...
 
virtual void registerMessageHandler (MessageHandlerFunc hndl)=0
 Register message handler. More...
 
virtual void unregisterMessageHandler ()=0
 Unregister message handler. More...
 
virtual void sendMessage (const ustring &msg)=0
 send message More...
 
virtual ~IMessaging ()
 

Detailed Description

IMessaging interface.

Provides interface for sending/receiving message from/to general communication interface

Member Typedef Documentation

◆ MessageHandlerFunc

typedef std::function<void(const ustring&)> IMessaging::MessageHandlerFunc

Incoming message handler functional type.

◆ ustring

typedef std::basic_string<unsigned char> IMessaging::ustring

Constructor & Destructor Documentation

◆ ~IMessaging()

virtual IMessaging::~IMessaging ( )
inlinevirtual

Member Function Documentation

◆ getName()

virtual const std::string& IMessaging::getName ( ) const
pure virtual

Get name of the instance.

Returns
The instance name

Returns unique name of the instance

Implemented in MqttMessaging, UdpMessaging, and MqMessaging.

◆ registerMessageHandler()

virtual void IMessaging::registerMessageHandler ( MessageHandlerFunc  hndl)
pure virtual

Register message handler.

Parameters
[in]hndlregistering handler function

Whenever a message is received it is passed to the handler function. It is possible to register just one handler

Implemented in MqttMessaging, UdpMessaging, and MqMessaging.

◆ sendMessage()

virtual void IMessaging::sendMessage ( const ustring msg)
pure virtual

send message

Parameters
[in]msgmessage to be sent

The message is send outside

Implemented in MqttMessaging, UdpMessaging, and MqMessaging.

◆ start()

virtual void IMessaging::start ( )
pure virtual

Start Messaging instance.

Messaging implementation starts to listen incoming messages an is ready to send

Implemented in MqttMessaging, UdpMessaging, and MqMessaging.

◆ stop()

virtual void IMessaging::stop ( )
pure virtual

Stop Messaging instance.

Messaging implementation stops its job

Implemented in MqttMessaging, UdpMessaging, and MqMessaging.

◆ unregisterMessageHandler()

virtual void IMessaging::unregisterMessageHandler ( )
pure virtual

Unregister message handler.

If the handler is not required anymore, it is possible to unregister via this method.

Implemented in MqttMessaging, UdpMessaging, and MqMessaging.

◆ update()

virtual void IMessaging::update ( const rapidjson::Value &  cfg)
pure virtual

Update configuration.

Parameters
[in]cfgconfiguration data

Configuration data are taken from passed cfg and the instance is configured accordingly

Implemented in MqttMessaging, UdpMessaging, and MqMessaging.


The documentation for this class was generated from the following file: