F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
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 "Svc/Deframer/DeframerComponentAc.hpp"
21
22namespace Svc {
23
37class Deframer :
38 public DeframerComponentBase,
40{
41 public:
42
43 // ----------------------------------------------------------------------
44 // Construction, initialization, and destruction
45 // ----------------------------------------------------------------------
46
49 const char* const compName
50 );
51
53 void init(
54 const NATIVE_INT_TYPE instance = 0
55 );
56
58 ~Deframer();
59
61 void setup(
62 DeframingProtocol& protocol
63 );
64
65 PRIVATE:
66
67 // ----------------------------------------------------------------------
68 // Handler implementations for user-defined typed input ports
69 // ----------------------------------------------------------------------
70
72 void cmdResponseIn_handler(
73 NATIVE_INT_TYPE portNum,
74 FwOpcodeType opcode,
75 U32 cmdSeq,
76 const Fw::CmdResponse& response
77 );
78
80 void framedIn_handler(
81 const NATIVE_INT_TYPE portNum,
82 Fw::Buffer& recvBuffer,
83 const Drv::RecvStatus& recvStatus
84 );
85
87 void schedIn_handler(
88 const NATIVE_INT_TYPE portNum,
89 NATIVE_UINT_TYPE context
90 );
91
92 // ----------------------------------------------------------------------
93 // Implementation of DeframingProtocolInterface
94 // ----------------------------------------------------------------------
95
98 void route(
99 Fw::Buffer& packetBuffer
100 );
101
105 Fw::Buffer allocate(
106 const U32 size
107 );
108
109 // ----------------------------------------------------------------------
110 // Helper methods
111 // ----------------------------------------------------------------------
112
115 void processBuffer(
116 Fw::Buffer& buffer
117 );
118
120 void processRing();
121
122 // ----------------------------------------------------------------------
123 // Member variables
124 // ----------------------------------------------------------------------
125
127 DeframingProtocol* m_protocol;
128
130 Types::CircularBuffer m_inRing;
131
133 U8 m_ringBuffer[DeframerCfg::RING_BUFFER_SIZE];
134
136 U8 m_pollBuffer[DeframerCfg::POLL_BUFFER_SIZE];
137
138};
139
140} // end namespace Svc
141
142#endif
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
uint8_t U8
8-bit unsigned integer
Definition BasicTypes.h:26
PlatformUIntType NATIVE_UINT_TYPE
Definition BasicTypes.h:52
U32 FwOpcodeType
Definition FpConfig.h:56
Generic deframing component using DeframingProtocol implementation for actual deframing.
Definition Deframer.hpp:40
void init(const NATIVE_INT_TYPE instance=0)
Initialize Deframer instance.
Definition Deframer.cpp:48
~Deframer()
Destroy Deframer instance.
Definition Deframer.cpp:52
void setup(DeframingProtocol &protocol)
Set up the instance.
Definition Deframer.cpp:54
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.
static const U32 RING_BUFFER_SIZE
The size of the circular buffer in bytes.