include/IControlDataReceiver.h

include/IControlDataReceiver.h

Classes

Name
classIControlDataReceiver
IControlDataReceiver is the interface class for the control data receiver. An IControlDataReceiver can receive messages from a sender or other IControlDataReceivers using a network connection. It can also connect to and forward the incoming request messages to other receivers. The connections to the sender and the other receivers are controlled by an ISystemControllerInterface instance. The ControlDataReceiver has a receiving or listening side, as well as a sending side. The listening side can listen to one single network port and have multiple ControlDataSenders and ControlDataReceivers connected to that port to receive requests from them. On the sending side of the ControlDataReceiver, it can be connected to the listening side of other ControlDataReceivers, used to forward all incoming messages to that receiver, as well as sending its own requests.
structIControlDataReceiver::IncomingRequest
An incoming request to this ControlDataReceiver.
structIControlDataReceiver::ReceiverResponse
A response message to a request.
structIControlDataReceiver::Settings
Settings for a ControlDataReceiver.

Source code

// Copyright (c) 2024, Edgeware AB. All rights reserved.

#pragma once

#include <memory>

#include <ISystemControllerInterface.h>

#include "ControlDataCommon.h"

class IControlDataReceiver {
public:
    struct IncomingRequest {
        std::vector<std::vector<uint8_t>> mMessages; 
        std::string mSenderUUID;    
        std::string mRequesterUUID; 
        uint64_t mRequestID = 0;    
        int64_t mSenderTimestampUs =
            0; 
        int64_t mDeliveryTimestampUs =
            0; 
    };

    struct ReceiverResponse {
        std::vector<uint8_t> mMessage; 
    };

    struct Settings {
        std::string mProductionPipelineUUID; 
        std::function<void(const IncomingRequest&)> mPreviewIncomingRequestCallback;
        std::function<ReceiverResponse(const IncomingRequest&)> mIncomingRequestCallback;

        std::function<void(const ControlDataCommon::ConnectionStatus&)>
            mConnectionStatusCallback; 
        std::function<void(const ControlDataCommon::Response&)>
            mResponseCallback; 
    };

    virtual ~IControlDataReceiver() = default;

    virtual bool configure(const Settings& settings) = 0;

    virtual bool sendStatusMessageToSender(const std::vector<uint8_t>& message) = 0;

    virtual bool sendRequestToReceivers(const std::vector<uint8_t>& request, uint64_t& requestId) = 0;

    virtual bool sendMultiRequestToReceivers(const std::vector<std::vector<uint8_t>>& request, uint64_t& requestId) = 0;
};

Updated on 2024-04-08 at 15:15:27 +0200