Name | |
---|---|
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 | SystemControllerConnection::Settings Settings for a SystemControllerConnection. |
// Copyright (c) 2022, Edgeware AB. All rights reserved.
#pragma once
#include <chrono>
#include "ISystemControllerInterface.h"
#include "json.hpp"
class SystemControllerConnection final : public ISystemControllerInterface {
public:
enum class ComponentType : uint32_t {
kIngest,
kMediaReceiver,
kMediaStreamer,
kControlDataReceiver,
kControlDataSender,
};
struct Settings {
std::string mSystemControllerIP; // IP of the server
uint16_t mSystemControllerPort; // Port of the server
std::string mSystemControllerPostfix; // Postfix of the address that the backend uses if any
std::string mPSK; // The pre shared key used for authorization with the system controller server
std::string mUUID; // The UUID of the device using this library
ComponentType mType; // The component type of the component using this SystemControllerConnection
std::string mName; // The component name (optional)
std::string mMyIP; // The external IP of the system the component is running on. Will be sent to the system
// controller server in the announce message (optional)
std::chrono::milliseconds mConnectTimeout{
3000}; // Max time to wait on an announcement response from the server during connection
bool mEnableHTTPS; // Enable the communication between the system controller and a component encrypted
bool mInsecureHTTPS; // Disable the verification of the TLS certificate if requested.
std::string mCustomCaCertFile; // Custom CA certificate
};
SystemControllerConnection();
~SystemControllerConnection() override;
bool configure(const Settings& settings,
const std::shared_ptr<ISystemControllerInterface>& parentInterface = nullptr);
bool connect() override;
bool isConnected() const override;
std::string getUUID() const override;
std::optional<std::string> sendMessage(const std::string& messageTitle, const nlohmann::json& parameters) override;
bool disconnect() override;
bool registerRequestCallback(const Callbacks& callbacks) override;
bool hasParent() const override;
std::shared_ptr<ISystemControllerInterface> getParentInterface() const override;
SystemControllerConnection(SystemControllerConnection const&) = delete; // Copy construct
SystemControllerConnection(SystemControllerConnection&&) = delete; // Move construct
SystemControllerConnection& operator=(SystemControllerConnection const&) = delete; // Copy assign
SystemControllerConnection& operator=(SystemControllerConnection&&) = delete; // Move assign
private:
class Impl;
std::unique_ptr<Impl> pImpl;
};
Updated on 2024-01-25 at 12:02:05 +0100