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>
Name | |
---|---|
struct | Settings Settings for a ControlDataSender. |
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. |
bool | sendMultiRequestToReceivers(const std::vector< std::vector< uint8_t » & request, uint64_t & requestId) Send a multi-message 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. |
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.
Parameters:
Return: True on success, false otherwise
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:
Return: True if the request was successfully sent, false otherwise
bool sendMultiRequestToReceivers(
const std::vector< std::vector< uint8_t >> & request,
uint64_t & requestId
)
Send a multi-message request to all the connected ControlDataReceivers asynchronously. The responses will be sent to the response callback.
Parameters:
Return: True if the request was successfully sent, false otherwise
ControlDataSender(
ControlDataSender const &
) =delete
ControlDataSender & operator=(
ControlDataSender const &
) =delete
static std::string getVersion()
Get application version.
Return: a string with the current version, e.g. “1.0.0”
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.
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 2023-10-03 at 14:32:11 +0200