- namespace Acl
- namespace AclLog
A namespace for logging utilities.- class FileLocationFormatterFlag
A custom flag formatter which logs the source file location between a par of “[]”, in case the location is provided with the log call. - class ThreadNameFormatterFlag
- class FileLocationFormatterFlag
- class ControlDataAddress
A class representing an address within the control protocol. The address consists of an internal list of UUIDs, which all represent a component that needs to be passed to reach the final address. An address might end with a wildcard, which is represented by the omni UUID (i.e. all digits set to 0xF) and will then match all addresses with the same UUID sequence in the start. - namespace ControlDataCommon
- struct ConnectionEvent
A connection related event. - struct Response
A response from a ControlDataReceiver to a request. The UUID tells which receiver the response is sent from. - struct StatusMessage
A status message from a ControlDataReceiver. The UUID tells which receiver the message is sent from.
- struct ConnectionEvent
- class 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.- struct Settings
Settings for a ControlDataSender.
- struct Settings
- class ISystemControllerInterface
An ISystemControllerInterface is the interface between a component and the System controller controlling the component. The interface allows for two-way communication between the component and the system controller by means of sending requests and getting responses. Classes deriving from the ISystemControllerInterface should provide the component side implementation of the communication with the system controller. This interface can be inherited and implemented by developers to connect to custom system controllers, or to directly control a component programmatically, without the need for connecting to a remote server. - class SystemControllerConnection
An implementation of the ISystemControllerInterface for a System controller residing in a remote server. The connection to the server uses a Websocket.- struct Settings
Settings for a SystemControllerConnection.
- struct Settings
- class UUID
A class holding a UUID, stored as a sequence of bytes. This class only supports version 4 variant 1 of the UUID standard.
- namespace AclLog
- namespace fmt
- namespace spdlog
This is the multi-page printable view of this section. Click here to print.
Classes
- 1: Acl::AclLog::FileLocationFormatterFlag
- 2: Acl::AclLog::ThreadNameFormatterFlag
- 3: Acl::ControlDataAddress
- 4: Acl::ControlDataCommon::ConnectionEvent
- 5: Acl::ControlDataCommon::Response
- 6: Acl::ControlDataCommon::StatusMessage
- 7: Acl::ControlDataSender
- 8: Acl::ControlDataSender::Settings
- 9: Acl::ISystemControllerInterface
- 10: Acl::ISystemControllerInterface::Callbacks
- 11: Acl::ISystemControllerInterface::Response
- 12: Acl::SystemControllerConnection
- 13: Acl::SystemControllerConnection::Settings
- 14: Acl::UUID
- 15: fmt::formatter< Acl::ControlDataAddress >
- 16: fmt::formatter< Acl::ControlDataCommon::EventType >
- 17: fmt::formatter< Acl::ISystemControllerInterface::StatusCode >
- 18: fmt::formatter< Acl::SystemControllerConnection::ComponentType >
- 19: fmt::formatter< Acl::UUID >
1 - Acl::AclLog::FileLocationFormatterFlag
Acl::AclLog::FileLocationFormatterFlag Class Reference
A custom flag formatter which logs the source file location between a par of “[]”, in case the location is provided with the log call.
#include <AclLog.h>
Inherits from spdlog::custom_flag_formatter
Public Functions
| Name | |
|---|---|
| void | format(const spdlog::details::log_msg & msg, const std::tm & , spdlog::memory_buf_t & dest) override |
| std::unique_ptr< custom_flag_formatter > | clone() const override |
Public Functions Documentation
function format
inline void format(
const spdlog::details::log_msg & msg,
const std::tm & ,
spdlog::memory_buf_t & dest
) override
function clone
inline std::unique_ptr< custom_flag_formatter > clone() const override
2 - Acl::AclLog::ThreadNameFormatterFlag
Acl::AclLog::ThreadNameFormatterFlag Class Reference
Inherits from spdlog::custom_flag_formatter
Public Functions
| Name | |
|---|---|
| void | format(const spdlog::details::log_msg & , const std::tm & , spdlog::memory_buf_t & dest) override |
| std::unique_ptr< custom_flag_formatter > | clone() const override |
Public Functions Documentation
function format
inline void format(
const spdlog::details::log_msg & ,
const std::tm & ,
spdlog::memory_buf_t & dest
) override
function clone
inline std::unique_ptr< custom_flag_formatter > clone() const override
3 - Acl::ControlDataAddress
Acl::ControlDataAddress Class Reference
A class representing an address within the control protocol. The address consists of an internal list of UUIDs, which all represent a component that needs to be passed to reach the final address. An address might end with a wildcard, which is represented by the omni UUID (i.e. all digits set to 0xF) and will then match all addresses with the same UUID sequence in the start.
#include <ControlDataAddress.h>
Public Functions
| Name | |
|---|---|
| ControlDataAddress() =default Default constructor for an empty address. | |
| ControlDataAddress(const UUID & destinationUUID) Constructor which creates an address with the final destination UUID. | |
| size_t | size() const Returns the number of parts of the address that is currently stored. |
| bool | empty() const Check if address is empty or contains any parts. |
| bool | extend(const UUID & uuid) Extend the address with a new UUID that must be passed to get to the next UUID in the address. |
| bool | extend(const ControlDataAddress & address) Extend the address with all UUIDs in another ControlDataAddress. The UUIDs will be added in the same order as in the other ControlDataAddress to the beginning of this ControlDataAddress (i.e. the UUIDs in the other ControlDataAddress must be passed before the UUIDs in this ControlDataAddress to reach the final destination) |
| bool | hasWildcard() const |
| bool | currentUuidIsWildcard() const |
| bool | currentUuidMatch(const UUID & uuid) const Check if the uuid match the first UUID of the address. |
| bool | fullAddressMatch(const ControlDataAddress & other) const Check if another address matches this address. This check might pass in two ways: |
| std::optional< UUID > | getCurrentUuid() const |
| std::optional< UUID > | moveToAndGetNextUuid() Move to the next UUID in the address, by removing the current one, and return the next UUID of the address. In case there was at least one UUID in the address, the size of the address will be decreased by one. |
| std::vector< uint8_t > | pack() const Pack a ControlDataAddress into a byte vector. |
| std::string | toString() const |
| bool | operator==(const ControlDataAddress & other) const Compare this ControlDataAddress for equality to another ControlDataAddress. |
| bool | operator!=(const ControlDataAddress & other) const Compare this ControlDataAddress for non-equality to another ControlDataAddress. |
| std::optional< ControlDataAddress > | unpack(const std::vector< uint8_t >::const_iterator & packedBegin, const std::vector< uint8_t >::const_iterator & packedEnd) Unpack a packed ControlDataAddress, the size of packedEnd - packedBegin must be a multiple of UUID::kUUIDSize to be able to unpack anything. |
| std::optional< ControlDataAddress > | unpack(const uint8_t * packedBegin, const uint8_t * packedEnd) Unpack a packed ControlDataAddress, the size of packedEnd - packedBegin must be a multiple of UUID::kUUIDSize to be able to unpack anything. |
Friends
| Name | |
|---|---|
| std::ostream & | operator«(std::ostream & stream, const ControlDataAddress & address) Print this ControlDataAddress to an output stream, UUIDs separated with ‘:’. |
Public Functions Documentation
function ControlDataAddress
ControlDataAddress() =default
Default constructor for an empty address.
function ControlDataAddress
explicit ControlDataAddress(
const UUID & destinationUUID
)
Constructor which creates an address with the final destination UUID.
Parameters:
- destinationUUID The destination UUID of the address
function size
size_t size() const
Returns the number of parts of the address that is currently stored.
Return: The number of parts of the address that is currently stored
function empty
bool empty() const
Check if address is empty or contains any parts.
Return: True if there are no parts left in the address, false otherwise.
function extend
bool extend(
const UUID & uuid
)
Extend the address with a new UUID that must be passed to get to the next UUID in the address.
Parameters:
- uuid The new UUID to add to the address.
Return: False in case an omni UUID is passed to a non-empty ControlDataAddress
function extend
bool extend(
const ControlDataAddress & address
)
Extend the address with all UUIDs in another ControlDataAddress. The UUIDs will be added in the same order as in the other ControlDataAddress to the beginning of this ControlDataAddress (i.e. the UUIDs in the other ControlDataAddress must be passed before the UUIDs in this ControlDataAddress to reach the final destination)
Parameters:
- address The ControlDataAddress with UUIDs to add to this address.
Return: False in case @address contains an omni UUID
function hasWildcard
bool hasWildcard() const
Return: True if the address ends with a wildcard UUID (the special omni UUID), false otherwise.
function currentUuidIsWildcard
bool currentUuidIsWildcard() const
Return: True if the first UUID in the address is a wildcard UUID (the special omni UUID), false otherwise.
function currentUuidMatch
bool currentUuidMatch(
const UUID & uuid
) const
Check if the uuid match the first UUID of the address.
Parameters:
- uuid The UUID to match against
Return: True if the UUID is the same as the first UUID in the address, or in case the first UUID of the address is a wildcard UUID, false otherwise.
function fullAddressMatch
bool fullAddressMatch(
const ControlDataAddress & other
) const
Check if another address matches this address. This check might pass in two ways:
- Both addresses are identical
- At least one of the addresses includes a wildcard, and the other address is identical up to that wildcard otherThe address to match against.
True if the addresses match either because they are equal, or in case they are equal up to a wildcard in either address, false otherwise.
function getCurrentUuid
std::optional< UUID > getCurrentUuid() const
Return: The first UUID of the address, or an empty optional in case there are no more UUIDs in the address.
function moveToAndGetNextUuid
std::optional< UUID > moveToAndGetNextUuid()
Move to the next UUID in the address, by removing the current one, and return the next UUID of the address. In case there was at least one UUID in the address, the size of the address will be decreased by one.
Return: The next UUID of the address, or an empty optional in case there are no more UUIDs in the address.
function pack
std::vector< uint8_t > pack() const
Pack a ControlDataAddress into a byte vector.
Return: A vector with the packed message address.
function toString
std::string toString() const
Return: A string representation of the ControlDataAddress with ‘:’ separated UUIDs.
function operator==
bool operator==(
const ControlDataAddress & other
) const
Compare this ControlDataAddress for equality to another ControlDataAddress.
Parameters:
- other The other ControlDataAddress to compare this ControlDataAddress to
Return: True if the ControlDataAddresses are identical, false otherwise
function operator!=
bool operator!=(
const ControlDataAddress & other
) const
Compare this ControlDataAddress for non-equality to another ControlDataAddress.
Parameters:
- other The other ControlDataAddress to compare this ControlDataAddress to
Return: False if the ControlDataAddresses are identical, true otherwise
function unpack
static std::optional< ControlDataAddress > unpack(
const std::vector< uint8_t >::const_iterator & packedBegin,
const std::vector< uint8_t >::const_iterator & packedEnd
)
Unpack a packed ControlDataAddress, the size of packedEnd - packedBegin must be a multiple of UUID::kUUIDSize to be able to unpack anything.
Parameters:
- packedBegin Iterator to the start of the vector to unpack.
- packedEnd Iterator to the end of the vector to unpack.
Return: A ControlDataAddress if unpack was successful, std::nullopt if it failed.
function unpack
static std::optional< ControlDataAddress > unpack(
const uint8_t * packedBegin,
const uint8_t * packedEnd
)
Unpack a packed ControlDataAddress, the size of packedEnd - packedBegin must be a multiple of UUID::kUUIDSize to be able to unpack anything.
Parameters:
- packedBegin Pointer to the first byte of the address to unpack
- packedEnd Pointer to the last byte of the address to unpack
Return: A ControlDataAddress if unpack was successful, std::nullopt if it failed.
Friends
friend operator«
friend std::ostream & operator<<(
std::ostream & stream,
const ControlDataAddress & address
);
Print this ControlDataAddress to an output stream, UUIDs separated with ‘:’.
Parameters:
- stream The stream to print to
- address The address to print
Return: Reference to the output stream
4 - Acl::ControlDataCommon::ConnectionEvent
Acl::ControlDataCommon::ConnectionEvent Struct Reference
A connection related event.
#include <ControlDataCommon.h>
Public Attributes
| Name | |
|---|---|
| EventType | mEventType |
| ControlDataAddress | mAddress The type of event that occurred. |
| UUID | mEventNode The address of the node that detected the event. |
Public Attributes Documentation
variable mEventType
EventType mEventType = EventType::kDisconnect;
variable mAddress
ControlDataAddress mAddress;
The type of event that occurred.
variable mEventNode
UUID mEventNode;
The address of the node that detected the event.
5 - Acl::ControlDataCommon::Response
Acl::ControlDataCommon::Response Struct Reference
A response from a ControlDataReceiver to a request. The UUID tells which receiver the response is sent from.
#include <ControlDataCommon.h>
Public Attributes
| Name | |
|---|---|
| std::string | mMessage |
| uint64_t | mRequestId The actual message. |
| UUID | mFromUUID The ID of the request this is a response to. |
| ControlDataAddress | mRecipient The UUID of the responder. |
Public Attributes Documentation
variable mMessage
std::string mMessage;
variable mRequestId
uint64_t mRequestId = 0;
The actual message.
variable mFromUUID
UUID mFromUUID;
The ID of the request this is a response to.
variable mRecipient
ControlDataAddress mRecipient;
The UUID of the responder.
6 - Acl::ControlDataCommon::StatusMessage
Acl::ControlDataCommon::StatusMessage Struct Reference
A status message from a ControlDataReceiver. The UUID tells which receiver the message is sent from.
#include <ControlDataCommon.h>
Public Attributes
| Name | |
|---|---|
| std::string | mMessage |
| UUID | mFromUUID The actual message. |
| ControlDataAddress | mRecipient The UUID of the sender. |
Public Attributes Documentation
variable mMessage
std::string mMessage;
variable mFromUUID
UUID mFromUUID;
The actual message.
variable mRecipient
ControlDataAddress mRecipient;
The UUID of the sender.
7 - Acl::ControlDataSender
Acl::ControlDataSender Class Reference
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 Types
| Name | |
|---|---|
| enum class | SendRequestStatus { kSuccess, kFailed, kSendFailedForSome, kSenderNotConfigured, kNoConnectedReceiver, kInternalError} |
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) const 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. |
| SendRequestStatus | sendRequestToReceivers(std::string_view request, uint64_t & requestId, const UUID & requester =UUID::kNilUUID, int8_t hops =-1) const Send a request to all the connected ControlDataReceivers asynchronously. The responses will be sent to the response callback. |
| std::vector< UUID > | getDirectlyConnectedReceivers() const Get a list of the UUIDs of all receivers that are directly connected to this ControlDataSender. Useful for checking if this ControlDataSender is connected to something that will receive the control commands sent. |
| ControlDataSender(ControlDataSender const & ) =delete | |
| ControlDataSender & | operator=(ControlDataSender const & ) =delete |
| std::string | getVersion() Get application version. |
Public Types Documentation
enum SendRequestStatus
| Enumerator | Value | Description |
|---|---|---|
| kSuccess | Request was successfully sent. | |
| kFailed | Failed to send the request to any connected receivers. | |
| kSendFailedForSome | Multiple receivers are connected but not all received the message. | |
| kSenderNotConfigured | Cannot send messages before sender is configured. | |
| kNoConnectedReceiver | There is no connected receiver. | |
| kInternalError | Check the logs for error. |
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
) const
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
SendRequestStatus sendRequestToReceivers(
std::string_view request,
uint64_t & requestId,
const UUID & requester =UUID::kNilUUID,
int8_t hops =-1
) const
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.
- requester UUID that identifies the entity that sent the request, can be used if the ControlDataSender serves multiple clients and need to distinguish between them when receiving responses. A value of the nil UUID indicates that the requester field will not be used.
- hops The number of hops the message should be delivered/forwarded. A value of 1 means to all connected receivers, but not further. A value of 2 means all connected receivers to this sender, and all connected receivers to those, but not further, and so on. A value of -1 means infinity.
Return: True if the request was successfully sent, false otherwise
function getDirectlyConnectedReceivers
std::vector< UUID > getDirectlyConnectedReceivers() const
Get a list of the UUIDs of all receivers that are directly connected to this ControlDataSender. Useful for checking if this ControlDataSender is connected to something that will receive the control commands sent.
Return: A list of all receivers that are connected directly to this ControlDataSender
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. “6.0.0-39-g60a35937”
8 - Acl::ControlDataSender::Settings
Acl::ControlDataSender::Settings Struct Reference
Settings for a ControlDataSender.
#include <ControlDataSender.h>
Public Attributes
| Name | |
|---|---|
| std::function< void(const ControlDataCommon::Response &)> | mResponseCallback |
| std::function< void(const ControlDataCommon::StatusMessage &)> | mStatusMessageCallback |
| std::function< void(const ControlDataCommon::ConnectionEvent &)> | mConnectionEventCallback |
Public Attributes Documentation
variable mResponseCallback
std::function< void(const ControlDataCommon::Response &)> mResponseCallback;
variable mStatusMessageCallback
std::function< void(const ControlDataCommon::StatusMessage &)> mStatusMessageCallback;
variable mConnectionEventCallback
std::function< void(const ControlDataCommon::ConnectionEvent &)> mConnectionEventCallback;
9 - Acl::ISystemControllerInterface
Acl::ISystemControllerInterface Class Reference
An ISystemControllerInterface is the interface between a component and the System controller controlling the component. The interface allows for two-way communication between the component and the system controller by means of sending requests and getting responses. Classes deriving from the ISystemControllerInterface should provide the component side implementation of the communication with the system controller. This interface can be inherited and implemented by developers to connect to custom system controllers, or to directly control a component programmatically, without the need for connecting to a remote server.
#include <ISystemControllerInterface.h>
Inherited by Acl::SystemControllerConnection
Public Classes
| Name | |
|---|---|
| struct | Callbacks A struct containing the callbacks that needs to be registered by the component using this interface. |
| struct | Response A response to a request, consists of a status code and an (optional) parameters JSON object. |
Public Types
| Name | |
|---|---|
| enum class uint32_t | StatusCode { SUCCESS = 3001, TOO_MANY_REQUESTS = 3101, UUID_ALREADY_REGISTERED = 3201, FORMAT_ERROR = 3202, ALREADY_CONFIGURED = 3203, OUT_OF_RESOURCES = 3204, NOT_FOUND = 3205, INTERNAL_ERROR = 3206, CONNECTION_FAILED = 3207, TIMEOUT_EXCEEDED = 3208, KEY_MISMATCH = 3209, UNKNOWN_REQUEST = 3210, MALFORMED_REQUEST = 3211, ALREADY_IN_USE = 3212, VERSION_MISMATCH = 3213} Status codes used in JSON response messages for Websockets. These are starting at 3000 since the 1000 - 2000 range is taken up by the Spec: https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1. |
Public Functions
| Name | |
|---|---|
| virtual | ~ISystemControllerInterface() =default Virtual destructor. |
| virtual std::optional< std::string > | sendMessage(const std::string & messageTitle, const nlohmann::json & parameters) =0 Send a message containing a JSON object to the controller. |
| virtual bool | registerRequestCallback(const Callbacks & callbacks) =0 Register the callbacks to call for events in this class. |
| virtual bool | connect() =0 Connect to the System controller. |
| virtual bool | disconnect() =0 Disconnect from the System controller. |
| virtual bool | isConnected() const =0 |
| virtual UUID | getUUID() const =0 |
Public Types Documentation
enum StatusCode
| Enumerator | Value | Description |
|---|---|---|
| SUCCESS | 3001 | 3000-3099 Info/Notifications |
| TOO_MANY_REQUESTS | 3101 | 3100-3199 Warnings |
| UUID_ALREADY_REGISTERED | 3201 | 3200-3299 Error |
| FORMAT_ERROR | 3202 | |
| ALREADY_CONFIGURED | 3203 | |
| OUT_OF_RESOURCES | 3204 | |
| NOT_FOUND | 3205 | |
| INTERNAL_ERROR | 3206 | |
| CONNECTION_FAILED | 3207 | |
| TIMEOUT_EXCEEDED | 3208 | |
| KEY_MISMATCH | 3209 | |
| UNKNOWN_REQUEST | 3210 | |
| MALFORMED_REQUEST | 3211 | |
| ALREADY_IN_USE | 3212 | |
| VERSION_MISMATCH | 3213 |
Status codes used in JSON response messages for Websockets. These are starting at 3000 since the 1000 - 2000 range is taken up by the Spec: https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1.
Public Functions Documentation
function ~ISystemControllerInterface
virtual ~ISystemControllerInterface() =default
Virtual destructor.
function sendMessage
virtual std::optional< std::string > sendMessage(
const std::string & messageTitle,
const nlohmann::json & parameters
) =0
Send a message containing a JSON object to the controller.
Parameters:
- messageTitle The title of the status type or request
- parameters The parameters part of the JSON message
Return: Optional containing an error message on error, else nullopt in case the message was successfully sent
Reimplemented by: Acl::SystemControllerConnection::sendMessage
function registerRequestCallback
virtual bool registerRequestCallback(
const Callbacks & callbacks
) =0
Register the callbacks to call for events in this class.
Parameters:
- callbacks The callbacks to use when events in this class happen
Return: True on successful registration, false if some callback is not set or if already connected
Reimplemented by: Acl::SystemControllerConnection::registerRequestCallback
function connect
virtual bool connect() =0
Connect to the System controller.
Return: True on successful connection, false on error or if already connected
Reimplemented by: Acl::SystemControllerConnection::connect
function disconnect
virtual bool disconnect() =0
Disconnect from the System controller.
Return: True on successful disconnection, false on error or if not connected
Reimplemented by: Acl::SystemControllerConnection::disconnect
function isConnected
virtual bool isConnected() const =0
Return: True if connected to the System controller, false otherwise
Reimplemented by: Acl::SystemControllerConnection::isConnected
function getUUID
virtual UUID getUUID() const =0
Return: The UUID of this interface to the System controller
Reimplemented by: Acl::SystemControllerConnection::getUUID
10 - Acl::ISystemControllerInterface::Callbacks
Acl::ISystemControllerInterface::Callbacks Struct Reference
A struct containing the callbacks that needs to be registered by the component using this interface.
#include <ISystemControllerInterface.h>
Public Attributes
| Name | |
|---|---|
| std::function< Response(const std::string &, const nlohmann::json &)> | mRequestCallback |
| std::function< void(uint32_t, const std::string &, const std::error_code &)> | mConnectionClosedCallback |
Public Attributes Documentation
variable mRequestCallback
std::function< Response(const std::string &, const nlohmann::json &)> mRequestCallback;
variable mConnectionClosedCallback
std::function< void(uint32_t, const std::string &, const std::error_code &)> mConnectionClosedCallback;
11 - Acl::ISystemControllerInterface::Response
Acl::ISystemControllerInterface::Response Struct Reference
A response to a request, consists of a status code and an (optional) parameters JSON object.
#include <ISystemControllerInterface.h>
Public Attributes
| Name | |
|---|---|
| StatusCode | mCode |
| nlohmann::json | mParameters |
Public Attributes Documentation
variable mCode
StatusCode mCode;
variable mParameters
nlohmann::json mParameters;
12 - Acl::SystemControllerConnection
Acl::SystemControllerConnection Class Reference
An implementation of the ISystemControllerInterface for a System controller residing in a remote server. The connection to the server uses a Websocket.
#include <SystemControllerConnection.h>
Inherits from Acl::ISystemControllerInterface
Public Classes
| Name | |
|---|---|
| struct | Settings Settings for a SystemControllerConnection. |
Public Types
| Name | |
|---|---|
| enum class uint32_t | ComponentType { kIngest, kPipeline, kControlPanel} Enumeration of component types the component using this SystemControllerConnection can tell the System Controller to be seen as. |
Public Functions
| Name | |
|---|---|
| SystemControllerConnection() | |
| ~SystemControllerConnection() override | |
| bool | configure(const Settings & settings) Configure this connection. This method should be called before calling. |
| virtual bool | connect() override Connect to the server using the settings set with the. |
| virtual bool | isConnected() const override |
| virtual UUID | getUUID() const override |
| virtual std::optional< std::string > | sendMessage(const std::string & messageTitle, const nlohmann::json & parameters) override Send a message containing a JSON object to the system controller server. |
| virtual bool | disconnect() override Disconnect from the server. |
| virtual bool | registerRequestCallback(const Callbacks & callbacks) override Register callbacks to call when getting requests from the server or the server connection is lost. |
| SystemControllerConnection(SystemControllerConnection const & ) =delete | |
| SystemControllerConnection(SystemControllerConnection && ) =delete | |
| SystemControllerConnection & | operator=(SystemControllerConnection const & ) =delete |
| SystemControllerConnection & | operator=(SystemControllerConnection && ) =delete |
Additional inherited members
Public Classes inherited from Acl::ISystemControllerInterface
| Name | |
|---|---|
| struct | Callbacks A struct containing the callbacks that needs to be registered by the component using this interface. |
| struct | Response A response to a request, consists of a status code and an (optional) parameters JSON object. |
Public Types inherited from Acl::ISystemControllerInterface
| Name | |
|---|---|
| enum class uint32_t | StatusCode { SUCCESS, TOO_MANY_REQUESTS, UUID_ALREADY_REGISTERED, FORMAT_ERROR, ALREADY_CONFIGURED, OUT_OF_RESOURCES, NOT_FOUND, INTERNAL_ERROR, CONNECTION_FAILED, TIMEOUT_EXCEEDED, KEY_MISMATCH, UNKNOWN_REQUEST, MALFORMED_REQUEST, ALREADY_IN_USE, VERSION_MISMATCH} Status codes used in JSON response messages for Websockets. These are starting at 3000 since the 1000 - 2000 range is taken up by the Spec: https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1. |
Public Functions inherited from Acl::ISystemControllerInterface
| Name | |
|---|---|
| virtual | ~ISystemControllerInterface() =default Virtual destructor. |
Public Types Documentation
enum ComponentType
| Enumerator | Value | Description |
|---|---|---|
| kIngest | ||
| kPipeline | ||
| kControlPanel |
Enumeration of component types the component using this SystemControllerConnection can tell the System Controller to be seen as.
Public Functions Documentation
function SystemControllerConnection
SystemControllerConnection()
function ~SystemControllerConnection
~SystemControllerConnection() override
function configure
bool configure(
const Settings & settings
)
Configure this connection. This method should be called before calling.
Parameters:
- settings The settings to use when connecting to the server
See: connect.
Return: True if successfully configured, false otherwise
function connect
virtual bool connect() override
Connect to the server using the settings set with the.
See: configure method.
Return: True if connection was successful, false otherwise
Reimplements: Acl::ISystemControllerInterface::connect
function isConnected
virtual bool isConnected() const override
Return: True if this class is connected to the server, false otherwise
Reimplements: Acl::ISystemControllerInterface::isConnected
function getUUID
virtual UUID getUUID() const override
Return: The UUID of this interface to the System controller
Reimplements: Acl::ISystemControllerInterface::getUUID
function sendMessage
virtual std::optional< std::string > sendMessage(
const std::string & messageTitle,
const nlohmann::json & parameters
) override
Send a message containing a JSON object to the system controller server.
Parameters:
- messageTitle The title of the status type or request
- parameters The parameters part of the JSON message
Return: Optional containing an error message on error, else nullopt in case the message was successfully sent
Reimplements: Acl::ISystemControllerInterface::sendMessage
function disconnect
virtual bool disconnect() override
Disconnect from the server.
Return: True if successfully disconnected, false on internal error
Reimplements: Acl::ISystemControllerInterface::disconnect
function registerRequestCallback
virtual bool registerRequestCallback(
const Callbacks & callbacks
) override
Register callbacks to call when getting requests from the server or the server connection is lost.
Parameters:
- callbacks The callbacks to set
Return: True if successfully registered, false if a callback is not set, or if already connected to the server
Reimplements: Acl::ISystemControllerInterface::registerRequestCallback
function SystemControllerConnection
SystemControllerConnection(
SystemControllerConnection const &
) =delete
function SystemControllerConnection
SystemControllerConnection(
SystemControllerConnection &&
) =delete
function operator=
SystemControllerConnection & operator=(
SystemControllerConnection const &
) =delete
function operator=
SystemControllerConnection & operator=(
SystemControllerConnection &&
) =delete
13 - Acl::SystemControllerConnection::Settings
Acl::SystemControllerConnection::Settings Struct Reference
Settings for a SystemControllerConnection.
#include <SystemControllerConnection.h>
Public Attributes
| Name | |
|---|---|
| std::string | mSystemControllerIP |
| uint16_t | mSystemControllerPort |
| std::string | mSystemControllerPostfix |
| std::string | mPSK |
| UUID | mUUID |
| ComponentType | mType |
| std::string | mName |
| std::string | mMyIP |
| std::chrono::milliseconds | mConnectTimeout |
| bool | mEnableHTTPS |
| bool | mInsecureHTTPS |
| std::string | mCustomCaCertFile |
Public Attributes Documentation
variable mSystemControllerIP
std::string mSystemControllerIP;
variable mSystemControllerPort
uint16_t mSystemControllerPort;
variable mSystemControllerPostfix
std::string mSystemControllerPostfix;
variable mPSK
std::string mPSK;
variable mUUID
UUID mUUID;
variable mType
ComponentType mType;
variable mName
std::string mName;
variable mMyIP
std::string mMyIP;
variable mConnectTimeout
std::chrono::milliseconds mConnectTimeout {
3000};
variable mEnableHTTPS
bool mEnableHTTPS;
variable mInsecureHTTPS
bool mInsecureHTTPS;
variable mCustomCaCertFile
std::string mCustomCaCertFile;
14 - Acl::UUID
Acl::UUID Class Reference
A class holding a UUID, stored as a sequence of bytes. This class only supports version 4 variant 1 of the UUID standard.
#include <UUID.h>
Public Functions
| Name | |
|---|---|
| UUID() Default constructor, returns a nil UUID. | |
| constexpr | UUID(const std::array< uint8_t, kUUIDSize > & bytes) Construct a UUID from a sequence of bytes. |
| std::string | toString() const |
| std::string | toBitString() const |
| bool | operator==(const UUID & other) const Compare this UUID to another UUID. |
| bool | operator!=(const UUID & other) const Compare this UUID to another UUID for inequality. |
| bool | operator<(const UUID & other) const Less than operator implementation. |
| std::array< uint8_t, kUUIDSize >::const_iterator | begin() const |
| std::array< uint8_t, kUUIDSize >::const_iterator | end() const |
| constexpr size_t | size() const |
| UUID | generateRandom() Create a new, randomly generated UUID. |
| std::optional< UUID > | fromString(const std::string & uuid) Parse a UUID from a string. |
| std::optional< UUID > | fromVector(const std::vector< uint8_t >::const_iterator & start, const std::vector< uint8_t >::const_iterator & end) Read a UUID from a vector of uint8s. |
| std::optional< UUID > | fromPointer(const uint8_t * start, const uint8_t * end) Read a UUID from a pointer. |
Public Attributes
| Name | |
|---|---|
| constexpr size_t | kUUIDSize |
| const UUID | kNilUUID |
| const UUID | kOmniUUID |
Public Functions Documentation
function UUID
UUID()
Default constructor, returns a nil UUID.
function UUID
inline explicit constexpr UUID(
const std::array< uint8_t, kUUIDSize > & bytes
)
Construct a UUID from a sequence of bytes.
Note: This will accept UUIDs that are not valid version 4 UUIDs.
function toString
std::string toString() const
Return: A string representation of the UUID formatted as hex values
function toBitString
std::string toBitString() const
Return: A string representation of the UUID formatted as bits
function operator==
bool operator==(
const UUID & other
) const
Compare this UUID to another UUID.
Parameters:
Return: True if the UUIDs are identical, false otherwise
function operator!=
bool operator!=(
const UUID & other
) const
Compare this UUID to another UUID for inequality.
Parameters:
Return: True if the UUIDs are not equal, false in case they are identical
function operator<
bool operator<(
const UUID & other
) const
Less than operator implementation.
Parameters:
Return: True if this UUID should be sorted before the other UUID
function begin
std::array< uint8_t, kUUIDSize >::const_iterator begin() const
Return: Begin iterator for the UUID byte sequence
function end
std::array< uint8_t, kUUIDSize >::const_iterator end() const
Return: End iterator for the UUID byte sequence
function size
inline constexpr size_t size() const
Return: The size in bytes of the UUID. Will always return 16
function generateRandom
static UUID generateRandom()
Create a new, randomly generated UUID.
Return: A new, randomly generated UUID
function fromString
static std::optional< UUID > fromString(
const std::string & uuid
)
Parse a UUID from a string.
Parameters:
- uuid The string representation of the UUID
Return: An optional containing the UUID on success, or nullopt in case the parsing failed
function fromVector
static std::optional< UUID > fromVector(
const std::vector< uint8_t >::const_iterator & start,
const std::vector< uint8_t >::const_iterator & end
)
Read a UUID from a vector of uint8s.
Parameters:
- start Start iterator to read the UUID from
- end End iterator to read the UUID from, must be 16 bytes after
start
Return: An optional containing the UUID on success, or nullopt in case the parsing failed
function fromPointer
static std::optional< UUID > fromPointer(
const uint8_t * start,
const uint8_t * end
)
Read a UUID from a pointer.
Parameters:
- start Start pointer to read the UUID from
- end End pointer to read the UUID from, must be 16 bytes after
start
Return: An optional containing the UUID on success, or nullopt in case the parsing failed
Public Attributes Documentation
variable kUUIDSize
static constexpr size_t kUUIDSize = 16;
variable kNilUUID
static const UUID kNilUUID;
variable kOmniUUID
static const UUID kOmniUUID;
15 - fmt::formatter< Acl::ControlDataAddress >
fmt::formatter< Acl::ControlDataAddress > Struct Reference
Inherits from formatter< std::string >
Public Functions
| Name | |
|---|---|
| template <typename FormatContext > auto | format(const Acl::ControlDataAddress & address, FormatContext & ctx) |
Public Functions Documentation
function format
template <typename FormatContext >
inline auto format(
const Acl::ControlDataAddress & address,
FormatContext & ctx
)
16 - fmt::formatter< Acl::ControlDataCommon::EventType >
fmt::formatter< Acl::ControlDataCommon::EventType > Struct Reference
Inherits from formatter< std::string >
Public Functions
| Name | |
|---|---|
| template <typename FormatContext > auto | format(const Acl::ControlDataCommon::EventType type, FormatContext & ctx) |
Public Functions Documentation
function format
template <typename FormatContext >
inline auto format(
const Acl::ControlDataCommon::EventType type,
FormatContext & ctx
)
17 - fmt::formatter< Acl::ISystemControllerInterface::StatusCode >
fmt::formatter< Acl::ISystemControllerInterface::StatusCode > Struct Reference
Inherits from formatter< std::uint32_t >
Public Functions
| Name | |
|---|---|
| template <typename FormatContext > auto | format(Acl::ISystemControllerInterface::StatusCode code, FormatContext & ctx) |
Public Functions Documentation
function format
template <typename FormatContext >
inline auto format(
Acl::ISystemControllerInterface::StatusCode code,
FormatContext & ctx
)
18 - fmt::formatter< Acl::SystemControllerConnection::ComponentType >
fmt::formatter< Acl::SystemControllerConnection::ComponentType > Struct Reference
Inherits from formatter< std::string >
Public Functions
| Name | |
|---|---|
| template <typename FormatContext > auto | format(Acl::SystemControllerConnection::ComponentType type, FormatContext & ctx) |
Public Functions Documentation
function format
template <typename FormatContext >
inline auto format(
Acl::SystemControllerConnection::ComponentType type,
FormatContext & ctx
)
19 - fmt::formatter< Acl::UUID >
fmt::formatter< Acl::UUID > Struct Reference
Inherits from formatter< std::string >
Public Functions
| Name | |
|---|---|
| template <typename FormatContext > auto | format(const Acl::UUID & uuid, FormatContext & ctx) |
Public Functions Documentation
function format
template <typename FormatContext >
inline auto format(
const Acl::UUID & uuid,
FormatContext & ctx
)