include/IControlDataReceiver.h
include/IControlDataReceiver.h File Reference
Namespaces
| Name |
|---|
| Acl |
Classes
| Name | |
|---|---|
| class | Acl::IControlDataReceiver 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. |
| struct | Acl::IControlDataReceiver::RequestData An incoming request to this ControlDataReceiver. |
| class | Acl::IControlDataReceiver::IRequest Interface for a request that can be responded to. |
| struct | Acl::IControlDataReceiver::Settings Settings for a ControlDataReceiver. |
Source code
// Copyright (c) 2024, Ateliere. All rights reserved.
#pragma once
#include <memory>
#include <ISystemControllerInterface.h>
#include "ControlDataAddress.h"
#include "ControlDataCommon.h"
namespace Acl {
class IControlDataReceiver {
public:
struct RequestData {
std::string mMessage;
UUID mSenderUUID;
ControlDataAddress mRequester;
uint64_t mRequestID = 0;
int64_t mSenderTimestampUs =
0;
int64_t mDeliveryTimestampUs =
0;
};
class IRequest {
public:
IRequest() = default;
virtual ~IRequest() = default;
virtual const RequestData& getRequestData() = 0;
virtual bool respond(std::string&& message) = 0;
};
using IRequestPtr = std::shared_ptr<IRequest>;
struct Settings {
UUID mProductionPipelineUUID;
std::function<void(const ControlDataCommon::Response&)>
mResponseCallback;
std::function<void(const ControlDataCommon::ConnectionEvent&)>
mConnectionEventCallback;
};
virtual ~IControlDataReceiver() = default;
virtual bool configure(const Settings& settings) = 0;
virtual std::vector<IRequestPtr> getRequests(int64_t timestampUs) = 0;
virtual bool sendStatusMessageToSender(std::string&& message, const ControlDataAddress& address) = 0;
virtual bool sendRequestToReceivers(const std::string& request, uint64_t& requestId) = 0;
virtual size_t getNumberOfConnectedSenders() = 0;
virtual size_t getNumberOfConnectedReceivers() = 0;
};
} // namespace Acl