IQRF Gateway Daemon
|
UDP messaging. More...
#include <UdpMessaging.h>
Public Types | |
enum | Mode { Mode::Operational, Mode::Service, Mode::Forwarding } |
operational mode More... | |
![]() | |
typedef std::basic_string< unsigned char > | ustring |
typedef std::function< void(const ustring &)> | MessageHandlerFunc |
Incoming message handler functional type. More... | |
Public Member Functions | |
UdpMessaging ()=delete | |
UdpMessaging (const std::string &name) | |
virtual | ~UdpMessaging () |
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... | |
std::unique_ptr< DpaTransaction > | getDpaTransactionForward (DpaTransaction *forwarded) override |
Get DPA transaction forwarding object. More... | |
void | setExclusive (IChannel *chan) override |
Set exclusive access. More... | |
void | resetExclusive () override |
Reset exclusive access. More... | |
void | sendDpaMessageToUdp (const DpaMessage &dpaMessage) |
Send DpaMessage to UDP. More... | |
void | setDaemon (IDaemon *d) |
set daemon instance More... | |
![]() | |
virtual | ~IMessaging () |
![]() | |
virtual | ~IDpaExclusiveAccess () |
UDP messaging.
Implements IMessaging interface for UDP communication UdpMessaging works now as any IMessaging, but it is not used by any IService. It behaves as IService, ISerializer and IMessaging together because of legacy reason. It shall be changed in next version to keep architecture consistency with other components
Configurable via its update() method accepting JSON properties:
|
strong |
|
delete |
UdpMessaging::UdpMessaging | ( | const std::string & | name | ) |
|
virtual |
|
overridevirtual |
Get DPA transaction forwarding object.
[in] | forwarded | DPA transaction to be forwarded |
The transaction to be forwarded is wrapped to another transaction object implementing forwrding of flowing message
Implements IDpaMessageForwarding.
|
inlineoverridevirtual |
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 |
Reset exclusive access.
Implements IDpaExclusiveAccess.
void UdpMessaging::sendDpaMessageToUdp | ( | const DpaMessage & | dpaMessage | ) |
Send DpaMessage to UDP.
[in] | dpaMessage | to send |
Copyright 2016-2017 MICRORISC s.r.o.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
overridevirtual |
send message
[in] | msg | message to be sent |
The message is send outside
Implements IMessaging.
|
inline |
set daemon instance
|
overridevirtual |
Set exclusive access.
Implements IDpaExclusiveAccess.
|
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.