SystemControllerConnection
SystemControllerConnection
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 ISystemControllerInterface
Public Classes
| Name | |
|---|---|
| struct | Settings Settings for a SystemControllerConnection. |
Public Types
| Name | |
|---|---|
| enum class uint32_t | ComponentType { kIngest, kMediaReceiver, kMediaStreamer, kControlDataReceiver, kControlDataSender} 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, const std::shared_ptr< ISystemControllerInterface > & parentInterface =nullptr) 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 std::string | 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. |
| virtual bool | hasParent() const override |
| virtual std::shared_ptr< ISystemControllerInterface > | getParentInterface() const override |
| SystemControllerConnection(SystemControllerConnection const & ) =delete | |
| SystemControllerConnection(SystemControllerConnection && ) =delete | |
| SystemControllerConnection & | operator=(SystemControllerConnection const & ) =delete |
| SystemControllerConnection & | operator=(SystemControllerConnection && ) =delete |
Additional inherited members
Public Classes inherited from 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 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} 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 ISystemControllerInterface
| Name | |
|---|---|
| virtual | ~ISystemControllerInterface() =default Virtual destructor. |
Public Types Documentation
enum ComponentType
| Enumerator | Value | Description |
|---|---|---|
| kIngest | ||
| kMediaReceiver | ||
| kMediaStreamer | ||
| kControlDataReceiver | ||
| kControlDataSender |
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,
const std::shared_ptr< ISystemControllerInterface > & parentInterface =nullptr
)
Configure this connection. This method should be called before calling.
Parameters:
- settings The settings to use when connecting to the server
- parentInterface Optional parent interface that this interface is a child of. Setting this to nullptr means that this interface does not have a parent interface
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: ISystemControllerInterface::connect
function isConnected
virtual bool isConnected() const override
Return: True if this class is connected to the server, false otherwise
Reimplements: ISystemControllerInterface::isConnected
function getUUID
virtual std::string getUUID() const override
Return: The UUID of this interface to the System controller
Reimplements: 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: ISystemControllerInterface::sendMessage
function disconnect
virtual bool disconnect() override
Disconnect from the server.
Return: True if successfully disconnected, false on internal error
Reimplements: 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: ISystemControllerInterface::registerRequestCallback
function hasParent
virtual bool hasParent() const override
Return: True if this component has a parent ISystemControllerInterface, false otherwise
Reimplements: ISystemControllerInterface::hasParent
function getParentInterface
virtual std::shared_ptr< ISystemControllerInterface > getParentInterface() const override
Return: A pointer to parent’s ISystemControllerInterface, if any. Returns nullptr in case there is no parent
Reimplements: ISystemControllerInterface::getParentInterface
function SystemControllerConnection
SystemControllerConnection(
SystemControllerConnection const &
) =delete
function SystemControllerConnection
SystemControllerConnection(
SystemControllerConnection &&
) =delete
function operator=
SystemControllerConnection & operator=(
SystemControllerConnection const &
) =delete
function operator=
SystemControllerConnection & operator=(
SystemControllerConnection &&
) =delete
Updated on 2024-01-25 at 12:02:05 +0100