F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ComPortAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ComPortAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for Com port
5 // ======================================================================
6 
7 #ifndef Fw_ComPortAc_HPP
8 #define Fw_ComPortAc_HPP
9 
10 #include "Fw/Com/ComBuffer.hpp"
11 #include "Fw/FPrimeBasicTypes.hpp"
13 #if !FW_DIRECT_PORT_CALLS
17 #endif
18 
19 namespace Fw {
20 
23  class ComPortBuffer :
25  {
26 
27  public:
28 
29  // ----------------------------------------------------------------------
30  // Public constants for ComPortBuffer
31  // ----------------------------------------------------------------------
32 
35  static constexpr FwSizeType CAPACITY =
37  sizeof(U32);
38 
39  public:
40 
41  // ----------------------------------------------------------------------
42  // Public member functions for ComPortBuffer
43  // ----------------------------------------------------------------------
44 
47 
48  }
49 
50  private:
51 
52  // ----------------------------------------------------------------------
53  // Private member variables
54  // ----------------------------------------------------------------------
55 
56  U8 m_buff[CAPACITY];
57 
58  };
59 
63 
64  public:
65 
66  // ----------------------------------------------------------------------
67  // Public constructors for ComPortSerializer
68  // ----------------------------------------------------------------------
69 
72 
73  public:
74 
75  // ----------------------------------------------------------------------
76  // Public member functions for ComPortSerializer
77  // ----------------------------------------------------------------------
78 
81  Fw::SerialBufferBase& _buffer
82  );
83 
84  public:
85 
86  // ----------------------------------------------------------------------
87  // Public static functions for ComPortSerializer
88  // ----------------------------------------------------------------------
89 
92  Fw::ComBuffer& data,
93  U32 context,
94  Fw::SerialBufferBase& _buffer
95  );
96 
97  public:
98 
99  // ----------------------------------------------------------------------
100  // Public member variables for ComPortSerializer
101  // ----------------------------------------------------------------------
102 
105 
106  };
107 
108 #if !FW_DIRECT_PORT_CALLS
109 
112  class InputComPort :
113  public Fw::InputPortBase
114  {
115 
116  public:
117 
118  // ----------------------------------------------------------------------
119  // Public types for InputComPort
120  // ----------------------------------------------------------------------
121 
123  typedef void (*CompFuncPtr)(
124  Fw::PassiveComponentBase* callComp,
125  FwIndexType portNum,
126  Fw::ComBuffer& data,
127  U32 context
128  );
129 
130  public:
131 
132  // ----------------------------------------------------------------------
133  // Public constructors for InputComPort
134  // ----------------------------------------------------------------------
135 
137  InputComPort();
138 
139  public:
140 
141  // ----------------------------------------------------------------------
142  // Public member functions for InputComPort
143  // ----------------------------------------------------------------------
144 
146  void init();
147 
149  void addCallComp(
150  Fw::PassiveComponentBase* callComp,
151  CompFuncPtr funcPtr
152  );
153 
155  void invoke(
156  Fw::ComBuffer& data,
157  U32 context
158  );
159 
160  private:
161 
162  // ----------------------------------------------------------------------
163  // Private member functions for InputComPort
164  // ----------------------------------------------------------------------
165 
166 #if FW_PORT_SERIALIZATION == 1
167 
170  Fw::SerializeStatus invokeSerial(
171  Fw::LinearBufferBase& _buffer
172  );
173 
174 #endif
175 
176  private:
177 
178  // ----------------------------------------------------------------------
179  // Private member variables for InputComPort
180  // ----------------------------------------------------------------------
181 
183  CompFuncPtr m_func;
184 
185  };
186 
190  public Fw::OutputPortBase
191  {
192 
193  public:
194 
195  // ----------------------------------------------------------------------
196  // Public constructors for OutputComPort
197  // ----------------------------------------------------------------------
198 
200  OutputComPort();
201 
202  public:
203 
204  // ----------------------------------------------------------------------
205  // Public member functions for OutputComPort
206  // ----------------------------------------------------------------------
207 
209  void init();
210 
212  void addCallPort(
213  InputComPort* callPort
214  );
215 
217  void invoke(
218  Fw::ComBuffer& data,
219  U32 context
220  ) const;
221 
222  private:
223 
224  // ----------------------------------------------------------------------
225  // Private member variables for OutputComPort
226  // ----------------------------------------------------------------------
227 
229  InputComPort* m_port;
230 
231  };
232 
233 #endif
234 
235 }
236 
237 #endif
void invoke(Fw::ComBuffer &data, U32 context) const
Invoke a port connection.
Definition: ComPortAc.cpp:181
void init()
Initialization function.
Definition: ComPortAc.cpp:162
static Fw::SerializeStatus serializePortArgs(Fw::ComBuffer &data, U32 context, Fw::SerialBufferBase &_buffer)
Serialize port arguments into a buffer.
Definition: ComPortAc.cpp:46
PlatformSizeType FwSizeType
void invoke(Fw::ComBuffer &data, U32 context)
Invoke a port interface.
Definition: ComPortAc.cpp:101
void init()
Initialization function.
Definition: ComPortAc.cpp:81
SerializeStatus
forward declaration for string
void(* CompFuncPtr)(Fw::PassiveComponentBase *callComp, FwIndexType portNum, Fw::ComBuffer &data, U32 context)
The port callback function type.
Definition: ComPortAc.hpp:123
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: ComPortAc.cpp:87
static constexpr FwSizeType CAPACITY
Definition: ComPortAc.hpp:35
Fw::ComBuffer m_data
Definition: ComPortAc.hpp:103
ComPortSerializer()
Constructor.
Definition: ComPortAc.cpp:17
OutputComPort()
Constructor.
Definition: ComPortAc.cpp:150
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
InputComPort()
Constructor.
Definition: ComPortAc.cpp:69
PlatformIndexType FwIndexType
void addCallPort(InputComPort *callPort)
Register an input port.
Definition: ComPortAc.cpp:168
Implementation of malloc based allocator.
Fw::SerializeStatus deserializePortArgs(Fw::SerialBufferBase &_buffer)
Deserialze port arguments into members.
Definition: ComPortAc.cpp:29
ComPortBuffer()
Constructor.
Definition: ComPortAc.hpp:46