F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Deframer.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Deframer.hpp
3 // \author mstarch, bocchino
4 // \brief hpp file for Deframer component implementation class
5 //
6 // \copyright
7 // Copyright 2009-2022, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12 
13 #ifndef Svc_Deframer_HPP
14 #define Svc_Deframer_HPP
15 
16 #include <DeframerCfg.hpp>
17 
22 
23 namespace Svc {
24 
38 class Deframer :
39  public DeframerComponentBase,
41 {
42  public:
43 
44  // ----------------------------------------------------------------------
45  // Construction, initialization, and destruction
46  // ----------------------------------------------------------------------
47 
49  Deframer(
50  const char* const compName
51  );
52 
54  void init(
55  const NATIVE_INT_TYPE instance = 0
56  );
57 
59  ~Deframer();
60 
62  void setup(
63  DeframingProtocol& protocol
64  );
65 
66  PRIVATE:
67 
68  // ----------------------------------------------------------------------
69  // Handler implementations for user-defined typed input ports
70  // ----------------------------------------------------------------------
71 
73  void cmdResponseIn_handler(
74  NATIVE_INT_TYPE portNum,
75  FwOpcodeType opcode,
76  U32 cmdSeq,
77  const Fw::CmdResponse& response
78  );
79 
81  void framedIn_handler(
82  const NATIVE_INT_TYPE portNum,
83  Fw::Buffer& recvBuffer,
84  const Drv::RecvStatus& recvStatus
85  );
86 
88  void schedIn_handler(
89  const NATIVE_INT_TYPE portNum,
90  U32 context
91  );
92 
93  // ----------------------------------------------------------------------
94  // Implementation of DeframingProtocolInterface
95  // ----------------------------------------------------------------------
96 
99  void route(
100  Fw::Buffer& packetBuffer
101  );
102 
106  Fw::Buffer allocate(
107  const U32 size
108  );
109 
110  // ----------------------------------------------------------------------
111  // Helper methods
112  // ----------------------------------------------------------------------
113 
116  void processBuffer(
117  Fw::Buffer& buffer
118  );
119 
121  void processRing();
122 
123  // ----------------------------------------------------------------------
124  // Member variables
125  // ----------------------------------------------------------------------
126 
128  DeframingProtocol* m_protocol;
129 
131  Types::CircularBuffer m_inRing;
132 
134  U8 m_ringBuffer[DeframerCfg::RING_BUFFER_SIZE];
135 
137  U8 m_pollBuffer[DeframerCfg::POLL_BUFFER_SIZE];
138 
139 };
140 
141 } // end namespace Svc
142 
143 #endif
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:26
U32 FwOpcodeType
Definition: FpConfig.h:78
Status associated with the received data.
Enum representing a command response.
void init()
Object initializer.
Definition: ObjBase.cpp:27
Auto-generated base for Deframer component.
Generic deframing component using DeframingProtocol implementation for actual deframing.
Definition: Deframer.hpp:41
~Deframer()
Destroy Deframer instance.
Definition: Deframer.cpp:52
void setup(DeframingProtocol &protocol)
Set up the instance.
Definition: Deframer.cpp:54
Deframer(const char *const compName)
Construct Deframer instance.
Definition: Deframer.cpp:39
Abstract base class representing a deframing protocol.
interface supplied to the deframing protocol
static const U32 POLL_BUFFER_SIZE
The size of the polling buffer in bytes.
Definition: DeframerCfg.hpp:17
static const U32 RING_BUFFER_SIZE
The size of the circular buffer in bytes.
Definition: DeframerCfg.hpp:15