F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TmFramer.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TmFramer.hpp
3 // \author thomas-bc
4 // \brief hpp file for TmFramer component implementation class
5 // ======================================================================
6 
7 #ifndef Svc_Ccsds_TmFramer_HPP
8 #define Svc_Ccsds_TmFramer_HPP
9 
14 
15 namespace Svc {
16 
17 namespace Ccsds {
18 
19 class TmFramer final : public TmFramerComponentBase {
20  friend class TmFramerTester;
21 
23  "TM Frame Fixed Size must be at least large enough to hold header, trailer and data");
24 
25  static_assert(static_cast<FwSizeType>(TMHeader::SERIALIZED_SIZE) == static_cast<FwSizeType>(TmHeaderSize),
26  "Svc.Ccsds.TmHeaderSize must match TMHeader");
27  static_assert(static_cast<FwSizeType>(TMTrailer::SERIALIZED_SIZE) == static_cast<FwSizeType>(TmTrailerSize),
28  "Svc.Ccsds.TmTrailerSize must match TMTrailer");
29 
31  static constexpr FwSizeType TmPayloadCapacity = static_cast<FwSizeType>(TmDataFieldSize);
32 
33  enum class BufferOwnershipState {
34  NOT_OWNED,
35  OWNED,
36  };
37 
38  public:
39  // ----------------------------------------------------------------------
40  // Component construction and destruction
41  // ----------------------------------------------------------------------
42 
44  TmFramer(const char* const compName
45  );
46 
48  ~TmFramer();
49 
50  private:
51  // ----------------------------------------------------------------------
52  // Handler implementations for typed input ports
53  // ----------------------------------------------------------------------
54 
59  void comStatusIn_handler(FwIndexType portNum,
60  Fw::Success& condition
61  ) override;
62 
69  void dataIn_handler(FwIndexType portNum,
70  Fw::Buffer& data,
71  const ComCfg::FrameContext& context) override;
72 
76  void dataReturnIn_handler(FwIndexType portNum,
77  Fw::Buffer& data,
78  const ComCfg::FrameContext& context) override;
79 
80  // ----------------------------------------------------------------------
81  // Members
82  // ----------------------------------------------------------------------
83  private:
84  // Because the TM protocol use fixed width frames, and only one frame is in transit between ComQueue and
85  // ComInterface at a time, we can use a member fixed-size buffer to hold the frame data
86  U8 m_frameBuffer[ComCfg::TmFrameFixedSize];
87  BufferOwnershipState m_bufferState = BufferOwnershipState::OWNED;
88 
89  // Current implementation uses a single virtual channel, so we can use a single virtual frame count
90  U8 m_masterFrameCount;
91  U8 m_virtualFrameCount;
92 };
93 
94 } // namespace Ccsds
95 } // namespace Svc
96 
97 #endif
PlatformSizeType FwSizeType
The size of the serial representation.
~TmFramer()
Destroy TmFramer object.
Definition: TmFramer.cpp:22
friend class TmFramerTester
Definition: TmFramer.hpp:20
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
Auto-generated base for TmFramer component.
TmFramer(const char *const compName)
Construct TmFramer object.
Definition: TmFramer.cpp:19
PlatformIndexType FwIndexType
Type used to pass context info between components during framing/deframing.
RateGroupDivider component implementation.
The size of the serial representation.
Success/Failure.