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
Name | |
---|---|
struct | Settings Settings for a SystemControllerConnection. |
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. |
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 |
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. |
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.
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.
Parameters:
See: connect.
Return: True if successfully configured, false otherwise
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
virtual bool isConnected() const override
Return: True if this class is connected to the server, false otherwise
Reimplements: ISystemControllerInterface::isConnected
virtual std::string getUUID() const override
Return: The UUID of this interface to the System controller
Reimplements: ISystemControllerInterface::getUUID
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:
Return: Optional containing an error message on error, else nullopt in case the message was successfully sent
Reimplements: ISystemControllerInterface::sendMessage
virtual bool disconnect() override
Disconnect from the server.
Return: True if successfully disconnected, false on internal error
Reimplements: ISystemControllerInterface::disconnect
virtual bool registerRequestCallback(
const Callbacks & callbacks
) override
Register callbacks to call when getting requests from the server or the server connection is lost.
Parameters:
Return: True if successfully registered, false if a callback is not set, or if already connected to the server
Reimplements: ISystemControllerInterface::registerRequestCallback
virtual bool hasParent() const override
Return: True if this component has a parent ISystemControllerInterface, false otherwise
Reimplements: ISystemControllerInterface::hasParent
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
SystemControllerConnection(
SystemControllerConnection const &
) =delete
SystemControllerConnection(
SystemControllerConnection &&
) =delete
SystemControllerConnection & operator=(
SystemControllerConnection const &
) =delete
SystemControllerConnection & operator=(
SystemControllerConnection &&
) =delete
Updated on 2024-01-25 at 12:02:05 +0100