F´ Flight Software - C/C++ Documentation  devel
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 <cstdio>
11 #include <cstring>
12 
13 #include "FpConfig.hpp"
14 #include "Fw/Cmd/CmdArgBuffer.hpp"
19 #include "Fw/Types/StringType.hpp"
20 
21 namespace Fw {
22 
25  class InputCmdPort :
26  public Fw::InputPortBase
27  {
28 
29  public:
30 
31  // ----------------------------------------------------------------------
32  // Constants
33  // ----------------------------------------------------------------------
34 
35  enum {
38  sizeof(FwOpcodeType) +
39  sizeof(U32) +
41  };
42 
43  public:
44 
45  // ----------------------------------------------------------------------
46  // Types
47  // ----------------------------------------------------------------------
48 
50  typedef void (*CompFuncPtr)(
51  Fw::PassiveComponentBase* callComp,
52  FwIndexType portNum,
53  FwOpcodeType opCode,
54  U32 cmdSeq,
55  Fw::CmdArgBuffer& args
56  );
57 
58  public:
59 
60  // ----------------------------------------------------------------------
61  // Input Port Member functions
62  // ----------------------------------------------------------------------
63 
65  InputCmdPort();
66 
68  void init();
69 
71  void addCallComp(
72  Fw::PassiveComponentBase* callComp,
73  CompFuncPtr funcPtr
74  );
75 
77  void invoke(
78  FwOpcodeType opCode,
79  U32 cmdSeq,
80  Fw::CmdArgBuffer& args
81  );
82 
83  private:
84 
85 #if FW_PORT_SERIALIZATION == 1
86 
88  Fw::SerializeStatus invokeSerial(Fw::SerializeBufferBase& _buffer);
89 
90 #endif
91 
92  private:
93 
94  // ----------------------------------------------------------------------
95  // Member variables
96  // ----------------------------------------------------------------------
97 
99  CompFuncPtr m_func;
100 
101  };
102 
106  public Fw::OutputPortBase
107  {
108 
109  public:
110 
111  // ----------------------------------------------------------------------
112  // Output Port Member functions
113  // ----------------------------------------------------------------------
114 
116  OutputCmdPort();
117 
119  void init();
120 
122  void addCallPort(
123  InputCmdPort* callPort
124  );
125 
127  void invoke(
128  FwOpcodeType opCode,
129  U32 cmdSeq,
130  Fw::CmdArgBuffer& args
131  );
132 
133  private:
134 
135  // ----------------------------------------------------------------------
136  // Member variables
137  // ----------------------------------------------------------------------
138 
140  InputCmdPort* m_port;
141 
142  };
143 
144 }
145 
146 #endif
U32 FwOpcodeType
Definition: FpConfig.h:78
PlatformIndexType FwIndexType
Definition: FpConfig.h:20
C++-compatible configuration header for fprime configuration.
@ SERIALIZED_SIZE
size when serialized. Buffer + size of buffer
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
InputCmdPort()
Constructor.
Definition: CmdPortAc.cpp:48
void invoke(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Invoke a port interface.
Definition: CmdPortAc.cpp:76
void(* CompFuncPtr)(Fw::PassiveComponentBase *callComp, FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
The port callback function type.
Definition: CmdPortAc.hpp:50
void addCallPort(InputCmdPort *callPort)
Register an input port.
Definition: CmdPortAc.cpp:150
void invoke(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Invoke a port interface.
Definition: CmdPortAc.cpp:163
void init()
Initialization function.
Definition: CmdPortAc.cpp:144
OutputCmdPort()
Constructor.
Definition: CmdPortAc.cpp:136
SerializeStatus
forward declaration for string