F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
CmdPortAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title CmdPortAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for Cmd port
5 // ======================================================================
6 
7 #ifndef Fw_CmdPortAc_HPP
8 #define Fw_CmdPortAc_HPP
9 
10 #include "Fw/Cmd/CmdArgBuffer.hpp"
11 #include "Fw/FPrimeBasicTypes.hpp"
14 #if !FW_DIRECT_PORT_CALLS
18 #endif
19 
20 namespace Fw {
21 
24  class CmdPortBuffer :
26  {
27 
28  public:
29 
30  // ----------------------------------------------------------------------
31  // Public constants for CmdPortBuffer
32  // ----------------------------------------------------------------------
33 
36  static constexpr FwSizeType CAPACITY =
37  sizeof(FwOpcodeType) +
38  sizeof(U32) +
40 
41  public:
42 
43  // ----------------------------------------------------------------------
44  // Public member functions for CmdPortBuffer
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 CmdPortSerializer
83  // ----------------------------------------------------------------------
84 
87 
88  public:
89 
90  // ----------------------------------------------------------------------
91  // Public member functions for CmdPortSerializer
92  // ----------------------------------------------------------------------
93 
96  Fw::SerialBufferBase& _buffer
97  );
98 
99  public:
100 
101  // ----------------------------------------------------------------------
102  // Public static functions for CmdPortSerializer
103  // ----------------------------------------------------------------------
104 
107  FwOpcodeType opCode,
108  U32 cmdSeq,
109  Fw::CmdArgBuffer& args,
110  Fw::SerialBufferBase& _buffer
111  );
112 
113  public:
114 
115  // ----------------------------------------------------------------------
116  // Public member variables for CmdPortSerializer
117  // ----------------------------------------------------------------------
118 
120  U32 m_cmdSeq;
122 
123  };
124 
125 #if !FW_DIRECT_PORT_CALLS
126 
129  class InputCmdPort :
130  public Fw::InputPortBase
131  {
132 
133  public:
134 
135  // ----------------------------------------------------------------------
136  // Public types for InputCmdPort
137  // ----------------------------------------------------------------------
138 
140  typedef void (*CompFuncPtr)(
141  Fw::PassiveComponentBase* callComp,
142  FwIndexType portNum,
143  FwOpcodeType opCode,
144  U32 cmdSeq,
145  Fw::CmdArgBuffer& args
146  );
147 
148  public:
149 
150  // ----------------------------------------------------------------------
151  // Public constructors for InputCmdPort
152  // ----------------------------------------------------------------------
153 
155  InputCmdPort();
156 
157  public:
158 
159  // ----------------------------------------------------------------------
160  // Public member functions for InputCmdPort
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  Fw::CmdArgBuffer& args
177  );
178 
179  private:
180 
181  // ----------------------------------------------------------------------
182  // Private member functions for InputCmdPort
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 InputCmdPort
199  // ----------------------------------------------------------------------
200 
202  CompFuncPtr m_func;
203 
204  };
205 
209  public Fw::OutputPortBase
210  {
211 
212  public:
213 
214  // ----------------------------------------------------------------------
215  // Public constructors for OutputCmdPort
216  // ----------------------------------------------------------------------
217 
219  OutputCmdPort();
220 
221  public:
222 
223  // ----------------------------------------------------------------------
224  // Public member functions for OutputCmdPort
225  // ----------------------------------------------------------------------
226 
228  void init();
229 
231  void addCallPort(
232  InputCmdPort* callPort
233  );
234 
236  void invoke(
237  FwOpcodeType opCode,
238  U32 cmdSeq,
239  Fw::CmdArgBuffer& args
240  ) const;
241 
242  private:
243 
244  // ----------------------------------------------------------------------
245  // Private member variables for OutputCmdPort
246  // ----------------------------------------------------------------------
247 
249  InputCmdPort* m_port;
250 
251  };
252 
253 #endif
254 
255 }
256 
257 #endif
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
FwIdType FwOpcodeType
The type of a command opcode.
void invoke(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args) const
Invoke a port connection.
Definition: CmdPortAc.cpp:190
PlatformSizeType FwSizeType
static Fw::SerializeStatus serializePortArgs(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args, Fw::SerialBufferBase &_buffer)
Serialize port arguments into a buffer.
Definition: CmdPortAc.cpp:50
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
Fw::Serializable::SizeType getCapacity() const override
Definition: CmdPortAc.hpp:49
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
U8 * getBuffAddr() override
Definition: CmdPortAc.hpp:55
const U8 * getBuffAddr() const override
Definition: CmdPortAc.hpp:61
void addCallPort(InputCmdPort *callPort)
Register an input port.
Definition: CmdPortAc.cpp:177
OutputCmdPort()
Constructor.
Definition: CmdPortAc.cpp:159
FwSizeType SizeType
FwOpcodeType m_opCode
Definition: CmdPortAc.hpp:119
Fw::CmdArgBuffer m_args
Definition: CmdPortAc.hpp:121
void init()
Initialization function.
Definition: CmdPortAc.cpp:171
InputCmdPort()
Constructor.
Definition: CmdPortAc.cpp:77
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
size when serialized. Buffer + size of buffer
void(* CompFuncPtr)(Fw::PassiveComponentBase *callComp, FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
The port callback function type.
Definition: CmdPortAc.hpp:140
PlatformIndexType FwIndexType
void invoke(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Invoke a port interface.
Definition: CmdPortAc.cpp:109
Implementation of malloc based allocator.
Fw::SerializeStatus deserializePortArgs(Fw::SerialBufferBase &_buffer)
Deserialze port arguments into members.
Definition: CmdPortAc.cpp:30
CmdPortSerializer()
Constructor.
Definition: CmdPortAc.cpp:17