ControlDataSender
ControlDataSender
A ControlDataSender can send control signals to one or more receivers using a network connection. A single ControlDataSender can connect to multiple receivers, all identified by a UUID. The class is controlled using an ISystemControllerInterface; this interface is responsible for setting up connections to receivers. The ControlDataSender can send asynchronous requests to (all) the receivers and get a response back. Each response is identified with a request ID as well as the UUID of the responding receiver. The ControlDataSender can also receive status messages from the receivers.
#include <ControlDataSender.h>
Public Classes
| Name | |
|---|---|
| struct | Settings Settings for a ControlDataSender. |
Public Functions
| Name | |
|---|---|
| ControlDataSender() Default constructor, creates an empty object. | |
| ~ControlDataSender() Destructor. Will disconnect from the connected receivers and close the System controller connection. | |
| bool | configure(const std::shared_ptr< ISystemControllerInterface > & controllerInterface, const Settings & settings) Configure this ControlDataSender and connect it to the System Controller. This method will fail in case the ISystemControllerInterface has already been connected to the controller by another component, as such interface can only be used by one component. |
| bool | sendRequestToReceivers(const std::vector< uint8_t > & request, uint64_t & requestId) Send a request to all the connected ControlDataReceivers asynchronously. The responses will be sent to the response callback. |
| ControlDataSender(ControlDataSender const & ) =delete | |
| ControlDataSender & | operator=(ControlDataSender const & ) =delete |
| std::string | getVersion() Get application version. |
| std::string | getGitRevision() Get git revision which application was built on. |
| std::string | getBuildInfo() Get application build information. |
Public Functions Documentation
function ControlDataSender
ControlDataSender()
Default constructor, creates an empty object.
function ~ControlDataSender
~ControlDataSender()
Destructor. Will disconnect from the connected receivers and close the System controller connection.
function configure
bool configure(
const std::shared_ptr< ISystemControllerInterface > & controllerInterface,
const Settings & settings
)
Configure this ControlDataSender and connect it to the System Controller. This method will fail in case the ISystemControllerInterface has already been connected to the controller by another component, as such interface can only be used by one component.
Parameters:
- controllerInterface The interface to the System controller, used for communicating with this ControlDataSender
- settings The Settings to use for this ControlDataSender
Return: True on success, false otherwise
function sendRequestToReceivers
bool sendRequestToReceivers(
const std::vector< uint8_t > & request,
uint64_t & requestId
)
Send a request to all the connected ControlDataReceivers asynchronously. The responses will be sent to the response callback.
Parameters:
- request The request message
- requestId The unique identifier of this request. Used to identify the async responses.
Return: True if the request was successfully sent, false otherwise
function ControlDataSender
ControlDataSender(
ControlDataSender const &
) =delete
function operator=
ControlDataSender & operator=(
ControlDataSender const &
) =delete
function getVersion
static std::string getVersion()
Get application version.
Return: a string with the current version, e.g. “1.0.0”
function getGitRevision
static std::string getGitRevision()
Get git revision which application was built on.
Return: a string with the current git revision, e.g. “v2.1.0-231-gcd012ab”, followed by “-dirty” in case there are changes made to the Git repo.
function getBuildInfo
static std::string getBuildInfo()
Get application build information.
Return: a string with the current build information such as git hashes of all direct dependencies
Updated on 2022-11-17 at 15:40:06 +0100