Add TCPStreamer/TCPStreamerClient (TCP transport behind the UDPSServerI/UDPSClientI seam), an optional single in-process TCPStreamService serving many streams over worker threads, multiplexed SUBSCRIBE (comma list, stream index in fragmentIdx), and TCPStreamJoin, which merges several streams into one sample-and-hold stream paced by a master. StreamHub takes a comma list of streams over one connection. Includes GTests, E2E scenarios s58-s73 and docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
80 lines
3.1 KiB
C++
80 lines
3.1 KiB
C++
/**
|
|
* @file TCPStreamerClient.h
|
|
* @brief Header file for class TCPStreamerClient
|
|
* @date 05/11/2026
|
|
* @author Martino Ferrari
|
|
*
|
|
* @copyright Copyright 2015 F4E | European Joint Undertaking for ITER and
|
|
* the Development of Fusion Energy ('Fusion for Energy').
|
|
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved
|
|
* by the European Commission - subsequent versions of the EUPL (the "Licence")
|
|
* You may not use this work except in compliance with the Licence.
|
|
* You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
|
|
*
|
|
* @warning Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the Licence is distributed on an "AS IS"
|
|
* basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
* or implied. See the Licence permissions and limitations under the Licence.
|
|
*
|
|
* @details This header file contains the declaration of the class
|
|
* TCPStreamerClient with all of its public, protected and private members.
|
|
*/
|
|
|
|
#ifndef TCPSTREAMERCLIENT_H_
|
|
#define TCPSTREAMERCLIENT_H_
|
|
|
|
#include "TCPSClient.h"
|
|
#include "UDPStreamerClient.h"
|
|
|
|
namespace MARTe {
|
|
|
|
/**
|
|
* @brief A DataSource that receives a TCPStreamer (or any TCP UDPS server)
|
|
* stream and exposes it as input signals.
|
|
*
|
|
* @details Same signal handling and CONFIG validation as UDPStreamerClient; the
|
|
* transport is a TCPSClient that connects, reads framed UDPS packets, and
|
|
* reconnects automatically when the connection is lost.
|
|
*
|
|
* @par Configuration
|
|
* | Parameter | Type | Default | Description |
|
|
* |----------------|---------|-----------|-------------|
|
|
* | ServerAddress | string | 127.0.0.1 | Server IPv4 address or host name. |
|
|
* | Port | uint16 | 44500 | Server TCP port. |
|
|
* | SilenceTimeout | float32 | 0 | Seconds without any received byte before reconnecting; 0 disables. |
|
|
* | ReconnectDelay | float32 | 2 | Seconds between connection attempts. |
|
|
* | StreamName | string | *(absent)* | Stream to subscribe to on a TCPStreamService (omit for a plain TCPStreamer). |
|
|
* | CPUMask | uint32 | 0xFFFFFFFF| Receiver thread affinity. |
|
|
* | StackSize | uint32 | (default) | Receiver thread stack size. |
|
|
*
|
|
* MulticastGroup, DataPort, Interface and KeepAliveInterval are UDP-only and
|
|
* rejected.
|
|
*/
|
|
class TCPStreamerClient : public UDPStreamerClient {
|
|
public:
|
|
CLASS_REGISTER_DECLARATION()
|
|
|
|
TCPStreamerClient();
|
|
virtual ~TCPStreamerClient();
|
|
|
|
/** Rejects the UDP-only keys, then behaves as UDPStreamerClient::Initialise(). */
|
|
virtual bool Initialise(StructuredDataI &data);
|
|
|
|
/** @return true while connected to the server. */
|
|
bool IsConnected() const;
|
|
/** @return connections established so far. */
|
|
uint32 GetConnectionCount() const;
|
|
/** @return connections dropped because of a protocol violation. */
|
|
uint32 GetProtocolErrors() const;
|
|
|
|
protected:
|
|
virtual bool InitialiseTransport(StructuredDataI &data);
|
|
|
|
private:
|
|
TCPSClient *tcpClient; /**< Alias of the transport owned by UDPStreamerClient. */
|
|
};
|
|
|
|
} /* namespace MARTe */
|
|
|
|
#endif /* TCPSTREAMERCLIENT_H_ */
|