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 
48  return CAPACITY;
49  }
50 
53  U8* getBuffAddr() override {
54  return m_buff;
55  }
56 
59  const U8* getBuffAddr() const override {
60  return m_buff;
61  }
62 
63  private:
64 
65  // ----------------------------------------------------------------------
66  // Private member variables
67  // ----------------------------------------------------------------------
68 
69  U8 m_buff[CAPACITY];
70 
71  };
72 
76 
77  public:
78 
79  // ----------------------------------------------------------------------
80  // Public constructors for ComPortSerializer
81  // ----------------------------------------------------------------------
82 
85 
86  public:
87 
88  // ----------------------------------------------------------------------
89  // Public member functions for ComPortSerializer
90  // ----------------------------------------------------------------------
91 
94  Fw::SerialBufferBase& _buffer
95  );
96 
97  public:
98 
99  // ----------------------------------------------------------------------
100  // Public static functions for ComPortSerializer
101  // ----------------------------------------------------------------------
102 
105  Fw::ComBuffer& data,
106  U32 context,
107  Fw::SerialBufferBase& _buffer
108  );
109 
110  public:
111 
112  // ----------------------------------------------------------------------
113  // Public member variables for ComPortSerializer
114  // ----------------------------------------------------------------------
115 
118 
119  };
120 
121 #if !FW_DIRECT_PORT_CALLS
122 
125  class InputComPort :
126  public Fw::InputPortBase
127  {
128 
129  public:
130 
131  // ----------------------------------------------------------------------
132  // Public types for InputComPort
133  // ----------------------------------------------------------------------
134 
136  typedef void (*CompFuncPtr)(
137  Fw::PassiveComponentBase* callComp,
138  FwIndexType portNum,
139  Fw::ComBuffer& data,
140  U32 context
141  );
142 
143  public:
144 
145  // ----------------------------------------------------------------------
146  // Public constructors for InputComPort
147  // ----------------------------------------------------------------------
148 
150  InputComPort();
151 
152  public:
153 
154  // ----------------------------------------------------------------------
155  // Public member functions for InputComPort
156  // ----------------------------------------------------------------------
157 
159  void init();
160 
162  void addCallComp(
163  Fw::PassiveComponentBase* callComp,
164  CompFuncPtr funcPtr
165  );
166 
168  void invoke(
169  Fw::ComBuffer& data,
170  U32 context
171  );
172 
173  private:
174 
175  // ----------------------------------------------------------------------
176  // Private member functions for InputComPort
177  // ----------------------------------------------------------------------
178 
179 #if FW_PORT_SERIALIZATION == 1
180 
183  Fw::SerializeStatus invokeSerial(
184  Fw::LinearBufferBase& _buffer
185  );
186 
187 #endif
188 
189  private:
190 
191  // ----------------------------------------------------------------------
192  // Private member variables for InputComPort
193  // ----------------------------------------------------------------------
194 
196  CompFuncPtr m_func;
197 
198  };
199 
203  public Fw::OutputPortBase
204  {
205 
206  public:
207 
208  // ----------------------------------------------------------------------
209  // Public constructors for OutputComPort
210  // ----------------------------------------------------------------------
211 
213  OutputComPort();
214 
215  public:
216 
217  // ----------------------------------------------------------------------
218  // Public member functions for OutputComPort
219  // ----------------------------------------------------------------------
220 
222  void init();
223 
225  void addCallPort(
226  InputComPort* callPort
227  );
228 
230  void invoke(
231  Fw::ComBuffer& data,
232  U32 context
233  ) const;
234 
235  private:
236 
237  // ----------------------------------------------------------------------
238  // Private member variables for OutputComPort
239  // ----------------------------------------------------------------------
240 
242  InputComPort* m_port;
243 
244  };
245 
246 #endif
247 
248 }
249 
250 #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
const U8 * getBuffAddr() const override
Definition: ComPortAc.hpp:59
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:136
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:116
Fw::Serializable::SizeType getCapacity() const override
Definition: ComPortAc.hpp:47
FwSizeType SizeType
ComPortSerializer()
Constructor.
Definition: ComPortAc.cpp:17
OutputComPort()
Constructor.
Definition: ComPortAc.cpp:150
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
InputComPort()
Constructor.
Definition: ComPortAc.cpp:69
PlatformIndexType FwIndexType
void addCallPort(InputComPort *callPort)
Register an input port.
Definition: ComPortAc.cpp:168
U8 * getBuffAddr() override
Definition: ComPortAc.hpp:53
Implementation of malloc based allocator.
Fw::SerializeStatus deserializePortArgs(Fw::SerialBufferBase &_buffer)
Deserialze port arguments into members.
Definition: ComPortAc.cpp:29