Class implements basic API for DDS RMS plug-ins.
More...
#include <Intercom.h>
|
void | notify (std::istream &_stream) |
| Parse the input stream and notify subscribers. More...
|
|
Class implements basic API for DDS RMS plug-ins.
Example Usage:
try {
prot.onSubmit([](const SSubmit& _submit) {
prot.stop();
});
prot.onMessage([](const SMessage& _message) {
});
prot.start();
} catch (exception& _e) {
}
◆ signalMessage_t
Callback function for message notifications.
◆ signalSubmit_t
Callback function for submit notifications.
◆ CRMSPluginProtocol()
CRMSPluginProtocol::CRMSPluginProtocol |
( |
const std::string & |
_id | ) |
|
Constructor with ID.
- Parameters
-
[in] | _id | DDS commander provides an ID which has to be used for the communication. |
◆ ~CRMSPluginProtocol()
CRMSPluginProtocol::~CRMSPluginProtocol |
( |
| ) |
|
◆ notify()
void CRMSPluginProtocol::notify |
( |
std::istream & |
_stream | ) |
|
|
protected |
Parse the input stream and notify subscribers.
- Parameters
-
[in] | _stream | Stream with JSON data from DDS commander. |
◆ onMessage()
void CRMSPluginProtocol::onMessage |
( |
signalMessage_t::slot_function_type |
_subscriber | ) |
|
Subscribe for message notifications.
- Parameters
-
[in] | _subscriber | Callback function that is called when notification arrives. |
◆ onSubmit()
void CRMSPluginProtocol::onSubmit |
( |
signalSubmit_t::slot_function_type |
_subscriber | ) |
|
Subscribe for submit notifications.
- Parameters
-
[in] | _subscriber | Callback function that is called when notification arrives. |
◆ sendMessage()
void CRMSPluginProtocol::sendMessage |
( |
EMsgSeverity |
_severity, |
|
|
const std::string & |
_msg |
|
) |
| |
Send message to DDS commander.
- Parameters
-
[in] | _severity | Message severity. |
[in] | _msg | Message text. |
◆ start()
void CRMSPluginProtocol::start |
( |
bool |
_block = true | ) |
|
Send initial request to the commander and start listening for notifications.
param[in] _block If true than we stop the main thread.
If _block is true function stops the thread and waits until one of the conditions is applied:
- 10 minutes timeout;
- Failed connection to DDS commander or disconnection from DDS commander;
- Explicit call of stop() function.
- Note
- If there are no subscribers function doesn't wait.
◆ stop()
void CRMSPluginProtocol::stop |
( |
| ) |
|
The documentation for this class was generated from the following files: