F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
CmdResponsePortAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title CmdResponsePortAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for CmdResponse port
5 // ======================================================================
6 
7 #ifndef Fw_CmdResponsePortAc_HPP
8 #define Fw_CmdResponsePortAc_HPP
9 
11 #include "Fw/FPrimeBasicTypes.hpp"
14 #if !FW_DIRECT_PORT_CALLS
18 #endif
19 
20 namespace Fw {
21 
26  {
27 
28  public:
29 
30  // ----------------------------------------------------------------------
31  // Public constants for CmdResponsePortBuffer
32  // ----------------------------------------------------------------------
33 
36  static constexpr FwSizeType CAPACITY =
37  sizeof(FwOpcodeType) +
38  sizeof(U32) +
40 
41  public:
42 
43  // ----------------------------------------------------------------------
44  // Public member functions for CmdResponsePortBuffer
45  // ----------------------------------------------------------------------
46 
50  return CAPACITY;
51  }
52 
55  U8* getBuffAddr() override {
56  return m_buff;
57  }
58 
61  const U8* getBuffAddr() const override {
62  return m_buff;
63  }
64 
65  private:
66 
67  // ----------------------------------------------------------------------
68  // Private member variables
69  // ----------------------------------------------------------------------
70 
71  U8 m_buff[CAPACITY];
72 
73  };
74 
78 
79  public:
80 
81  // ----------------------------------------------------------------------
82  // Public constructors for CmdResponsePortSerializer
83  // ----------------------------------------------------------------------
84 
87 
88  public:
89 
90  // ----------------------------------------------------------------------
91  // Public member functions for CmdResponsePortSerializer
92  // ----------------------------------------------------------------------
93 
96  Fw::SerialBufferBase& _buffer
97  );
98 
99  public:
100 
101  // ----------------------------------------------------------------------
102  // Public static functions for CmdResponsePortSerializer
103  // ----------------------------------------------------------------------
104 
107  FwOpcodeType opCode,
108  U32 cmdSeq,
109  const Fw::CmdResponse& response,
110  Fw::SerialBufferBase& _buffer
111  );
112 
113  public:
114 
115  // ----------------------------------------------------------------------
116  // Public member variables for CmdResponsePortSerializer
117  // ----------------------------------------------------------------------
118 
120  U32 m_cmdSeq;
122 
123  };
124 
125 #if !FW_DIRECT_PORT_CALLS
126 
130  public Fw::InputPortBase
131  {
132 
133  public:
134 
135  // ----------------------------------------------------------------------
136  // Public types for InputCmdResponsePort
137  // ----------------------------------------------------------------------
138 
140  typedef void (*CompFuncPtr)(
141  Fw::PassiveComponentBase* callComp,
142  FwIndexType portNum,
143  FwOpcodeType opCode,
144  U32 cmdSeq,
145  const Fw::CmdResponse& response
146  );
147 
148  public:
149 
150  // ----------------------------------------------------------------------
151  // Public constructors for InputCmdResponsePort
152  // ----------------------------------------------------------------------
153 
156 
157  public:
158 
159  // ----------------------------------------------------------------------
160  // Public member functions for InputCmdResponsePort
161  // ----------------------------------------------------------------------
162 
164  void init();
165 
167  void addCallComp(
168  Fw::PassiveComponentBase* callComp,
169  CompFuncPtr funcPtr
170  );
171 
173  void invoke(
174  FwOpcodeType opCode,
175  U32 cmdSeq,
176  const Fw::CmdResponse& response
177  );
178 
179  private:
180 
181  // ----------------------------------------------------------------------
182  // Private member functions for InputCmdResponsePort
183  // ----------------------------------------------------------------------
184 
185 #if FW_PORT_SERIALIZATION == 1
186 
189  Fw::SerializeStatus invokeSerial(
190  Fw::LinearBufferBase& _buffer
191  );
192 
193 #endif
194 
195  private:
196 
197  // ----------------------------------------------------------------------
198  // Private member variables for InputCmdResponsePort
199  // ----------------------------------------------------------------------
200 
202  CompFuncPtr m_func;
203 
204  };
205 
209  public Fw::OutputPortBase
210  {
211 
212  public:
213 
214  // ----------------------------------------------------------------------
215  // Public constructors for OutputCmdResponsePort
216  // ----------------------------------------------------------------------
217 
220 
221  public:
222 
223  // ----------------------------------------------------------------------
224  // Public member functions for OutputCmdResponsePort
225  // ----------------------------------------------------------------------
226 
228  void init();
229 
231  void addCallPort(
232  InputCmdResponsePort* callPort
233  );
234 
236  void invoke(
237  FwOpcodeType opCode,
238  U32 cmdSeq,
239  const Fw::CmdResponse& response
240  ) const;
241 
242  private:
243 
244  // ----------------------------------------------------------------------
245  // Private member variables for OutputCmdResponsePort
246  // ----------------------------------------------------------------------
247 
249  InputCmdResponsePort* m_port;
250 
251  };
252 
253 #endif
254 
255 }
256 
257 #endif
static Fw::SerializeStatus serializePortArgs(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response, Fw::SerialBufferBase &_buffer)
Serialize port arguments into a buffer.
FwIdType FwOpcodeType
The type of a command opcode.
PlatformSizeType FwSizeType
void(* CompFuncPtr)(Fw::PassiveComponentBase *callComp, FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
The port callback function type.
Enum representing a command response.
InputCmdResponsePort()
Constructor.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Invoke a port interface.
SerializeStatus
forward declaration for string
The size of the serial representation.
Fw::SerializeStatus deserializePortArgs(Fw::SerialBufferBase &_buffer)
Deserialze port arguments into members.
const U8 * getBuffAddr() const override
Fw::Serializable::SizeType getCapacity() const override
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
FwSizeType SizeType
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
static constexpr FwSizeType CAPACITY
void init()
Initialization function.
PlatformIndexType FwIndexType
void init()
Initialization function.
Implementation of malloc based allocator.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.