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 SystemControllerConnection
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. |
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. |
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 std::string | getUUID() const =0 |
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.
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.
Parameters:
Return: Optional containing an error message on error, else nullopt in case the message was successfully sent
Reimplemented by: SystemControllerConnection::sendMessage
virtual bool registerRequestCallback(
const Callbacks & callbacks
) =0
Register the callbacks to call for events in this class.
Parameters:
Return: True on successful registration, false if some callback is not set or if already connected
Reimplemented by: SystemControllerConnection::registerRequestCallback
virtual bool connect() =0
Connect to the System controller.
Return: True on successful connection, false on error or if already connected
Reimplemented by: SystemControllerConnection::connect
virtual bool disconnect() =0
Disconnect from the System controller.
Return: True on successful disconnection, false on error or if not connected
Reimplemented by: SystemControllerConnection::disconnect
virtual bool isConnected() const =0
Return: True if connected to the System controller, false otherwise
Reimplemented by: SystemControllerConnection::isConnected
virtual std::string getUUID() const =0
Return: The UUID of this interface to the System controller
Reimplemented by: SystemControllerConnection::getUUID
Updated on 2024-04-08 at 15:15:27 +0200