F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Framer.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Framer.hpp
3 // \author mstarch, bocchino
4 // \brief hpp file for Framer 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_Framer_HPP
14 #define Svc_Framer_HPP
15 
19 
20 namespace Svc {
32  public:
33  // ----------------------------------------------------------------------
34  // Construction, initialization, and destruction
35  // ----------------------------------------------------------------------
36 
39  Framer(const char* const compName
40  );
41 
44  void init(const NATIVE_INT_TYPE instance = 0
45  );
46 
49  void setup(FramingProtocol& protocol );
50 
53  ~Framer();
54 
55  PRIVATE:
56  // ----------------------------------------------------------------------
57  // Handler implementations for user-defined typed input ports
58  // ----------------------------------------------------------------------
59 
62  void comIn_handler(const NATIVE_INT_TYPE portNum,
63  Fw::ComBuffer& data,
64  U32 context
65  );
66 
69  void bufferIn_handler(const NATIVE_INT_TYPE portNum,
70  Fw::Buffer& fwBuffer
71  );
72 
75  void comStatusIn_handler(const NATIVE_INT_TYPE portNum,
76  Fw::Success& condition );
77 
78  // ----------------------------------------------------------------------
79  // Implementation of FramingProtocolInterface
80  // ----------------------------------------------------------------------
81 
90  Fw::Buffer allocate(const U32 size);
91 
94  void send(Fw::Buffer& outgoing
95  );
96 
97  // ----------------------------------------------------------------------
98  // Helper functions
99  // ----------------------------------------------------------------------
100 
103  void handle_framing(const U8* const data, const U32 size, Fw::ComPacket::ComPacketType packet_type);
104 
105  // ----------------------------------------------------------------------
106  // Member variables
107  // ----------------------------------------------------------------------
108 
110  FramingProtocol* m_protocol;
111 
113  bool m_frame_sent;
114 };
115 
116 } // end namespace Svc
117 
118 #endif
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:26
void init()
Object initializer.
Definition: ObjBase.cpp:27
Success/Failure.
Auto-generated base for Framer component.
Generic framing component using FramingProtocol implementation for actual framing.
Definition: Framer.hpp:31
Framer(const char *const compName)
Definition: Framer.cpp:24
void setup(FramingProtocol &protocol)
Setup this component with a supplied framing protocol.
Definition: Framer.cpp:33
abstract class representing a framing protocol
interface supplied to the framing protocol