F´ Flight Software - C/C++ Documentation
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 <DeframerCfg.hpp>
17
22
23namespace Svc {
24
38class Deframer :
41{
42 public:
43
44 // ----------------------------------------------------------------------
45 // Construction, initialization, and destruction
46 // ----------------------------------------------------------------------
47
50 const char* const compName
51 );
52
54 ~Deframer();
55
57 void setup(
58 DeframingProtocol& protocol
59 );
60
61 PRIVATE:
62
63 // ----------------------------------------------------------------------
64 // Handler implementations for user-defined typed input ports
65 // ----------------------------------------------------------------------
66
68 void cmdResponseIn_handler(
69 NATIVE_INT_TYPE portNum,
70 FwOpcodeType opcode,
71 U32 cmdSeq,
72 const Fw::CmdResponse& response
73 );
74
76 void framedIn_handler(
77 const NATIVE_INT_TYPE portNum,
78 Fw::Buffer& recvBuffer,
79 const Drv::RecvStatus& recvStatus
80 );
81
83 void schedIn_handler(
84 const NATIVE_INT_TYPE portNum,
85 U32 context
86 );
87
88 // ----------------------------------------------------------------------
89 // Implementation of DeframingProtocolInterface
90 // ----------------------------------------------------------------------
91
94 void route(
95 Fw::Buffer& packetBuffer
96 );
97
101 Fw::Buffer allocate(
102 const U32 size
103 );
104
105 // ----------------------------------------------------------------------
106 // Helper methods
107 // ----------------------------------------------------------------------
108
111 void processBuffer(
112 Fw::Buffer& buffer
113 );
114
116 void processRing();
117
118 // ----------------------------------------------------------------------
119 // Member variables
120 // ----------------------------------------------------------------------
121
123 DeframingProtocol* m_protocol;
124
126 Types::CircularBuffer m_inRing;
127
129 U8 m_ringBuffer[DeframerCfg::RING_BUFFER_SIZE];
130
132 U8 m_pollBuffer[DeframerCfg::POLL_BUFFER_SIZE];
133
134};
135
136} // end namespace Svc
137
138#endif
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:55
uint8_t U8
8-bit unsigned integer
Definition BasicTypes.h:30
U32 FwOpcodeType
Definition FpConfig.h:91
Status associated with the received data.
Enum representing a command response.
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:48
void setup(DeframingProtocol &protocol)
Set up the instance.
Definition Deframer.cpp:50
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.