fprime/Svc/ComStub/ComStub.hpp
Thomas Boyer-Chammard d0246f148b
Add Framer FPP interface, implement FprimeFramer and adapt ComQueue (#3486)
* Initial FprimeFramer and FprimePacketizer

* Code clarity + set up UTs

* Rework ComQueue and ComStub to use DataWithContext

* Add packets to RefPackets.fppi

* Fix ComQueue tests

* Add hotfix to FileDownlink instead of ComQueue

* Fix cancelPacket as well

* Fix ComQueue UTs by removing hotfix

* Refactor DataWithContext to use an FPP object for context instead of Fw.Buffer

* Touch up testing

* Add docs

* more docs

* More docs

* Rework buffer deallocation pattern to pass-through ComQueue

* Update ComStub UTs

* Restore original FileDownlink.cpp

* Formatting tweak

* Update deprecated getSerializeRepr() calls

* deserialization methods

* Fix spelling

* add cast for safety

* CMakefile change

* Bump ComQueue depth

* Update RPI deployment with new Downlink stack

* Rename comQueueIn port to comPktQueueIn

* Fix comQueueIn to comPktQueueIn change

* Remove legacy Svc.Framer

* Fix CMake UTs

* Fix RPI topology config

* Fix FprimeProtocol.fpp module

* Fix namespacing

* Use const reference for FrameContext port

* Review comments EXCEPT port passback refactor

* Rework ComStub with new ByteStream

* New ByteStream - ComInterface model

* Rework TcpClient / TcpServer with new bytestream

* Adapt UDP component for new ByteStream

* Adapt FrameAccumulator for new ByteStream

* Adapt FprimeFramer for new ByteStream

* Update Ref topology with new ByteStream model

* Remove all legacy deallocates from Drivers; reintroduce DEPRECATED model types

* Fix spelling and include error

* More spelling....

* RPI and RpiDemo fixes

* Fix conversion warning on RPI

* static_cast for short int on RPI

* Standardize port names

* Remove legacy Drv types and merge RECV/SEND enum type, delete StreamCrossover

* Update SDDs

* Update SDDs

* Fix ComInterface <-> Framer interfaction, clarify comments and fix annotations

* Switch ComStub from ASSERT to log failure and return buffer

* Add history size check + clarify test handler overrides

* Fix RPI topology to wire comStub on Uplink

* Rename comm to comDriver in RPI topology

* Update communication adapter interface docs
2025-04-29 16:40:36 -07:00

73 lines
2.8 KiB
C++

// ======================================================================
// \title ComStub.hpp
// \author mstarch
// \brief hpp file for ComStub component implementation class
// ======================================================================
#ifndef Svc_ComStub_HPP
#define Svc_ComStub_HPP
#include "Drv/ByteStreamDriverModel/ByteStreamStatusEnumAc.hpp"
#include "Svc/ComStub/ComStubComponentAc.hpp"
namespace Svc {
class ComStub final : public ComStubComponentBase {
friend class ComStubTester; //!< Allow UT Tester to access private members
public:
const FwIndexType RETRY_LIMIT = 10;
// ----------------------------------------------------------------------
// Construction, initialization, and destruction
// ----------------------------------------------------------------------
//! Construct object ComStub
//!
ComStub(const char* const compName /*!< The component name*/
);
//! Destroy object ComStub
//!
~ComStub() override;
private:
// ----------------------------------------------------------------------
// Handler implementations for user-defined typed input ports
// ----------------------------------------------------------------------
//! Handler implementation for comDataIn
//!
//! Comms data is coming in meaning there is a request for ComStub to send data on the wire
//! For ComStub, this means we send the data to the underlying driver (e.g. TCP/UDP/UART)
void comDataIn_handler(const FwIndexType portNum, /*!< The port number*/
Fw::Buffer& sendBuffer,
const ComCfg::FrameContext& context) override;
//! Handler implementation for drvConnected
//!
void drvConnected_handler(const FwIndexType portNum) override;
//! Handler implementation for drvDataIn
//!
//! Data is coming in from the driver (meaning it has been read from the wire).
//! ComStub forwards this to the comDataOut port
void drvDataIn_handler(const FwIndexType portNum,
/*!< The port number*/ Fw::Buffer& recvBuffer,
const Drv::ByteStreamStatus& recvStatus) override;
//! Handler implementation for dataReturnIn
//!
//! Buffer ownership and status returning from a Driver "send" operation
void dataReturnIn_handler(FwIndexType portNum, //!< The port number
Fw::Buffer& fwBuffer, //!< The buffer
const Drv::ByteStreamStatus& recvStatus) override;
bool m_reinitialize; //!< Stores if a ready signal is needed on connection
ComCfg::FrameContext m_storedContext; //!< Stores the context of the current message
FwIndexType m_retry_count; //!< Counts the number of retries of the current message
};
} // end namespace Svc
#endif