F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TlmPortAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TlmPortAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for Tlm port
5 // ======================================================================
6 
7 #ifndef Fw_TlmPortAc_HPP
8 #define Fw_TlmPortAc_HPP
9 
10 #include "Fw/FPrimeBasicTypes.hpp"
11 #include "Fw/Time/Time.hpp"
12 #include "Fw/Tlm/TlmBuffer.hpp"
15 #if !FW_DIRECT_PORT_CALLS
19 #endif
20 
21 namespace Fw {
22 
25  class TlmPortBuffer :
27  {
28 
29  public:
30 
31  // ----------------------------------------------------------------------
32  // Public constants for TlmPortBuffer
33  // ----------------------------------------------------------------------
34 
37  static constexpr FwSizeType CAPACITY =
38  sizeof(FwChanIdType) +
41 
42  public:
43 
44  // ----------------------------------------------------------------------
45  // Public member functions for TlmPortBuffer
46  // ----------------------------------------------------------------------
47 
51  return CAPACITY;
52  }
53 
56  U8* getBuffAddr() override {
57  return m_buff;
58  }
59 
62  const U8* getBuffAddr() const override {
63  return m_buff;
64  }
65 
66  private:
67 
68  // ----------------------------------------------------------------------
69  // Private member variables
70  // ----------------------------------------------------------------------
71 
72  U8 m_buff[CAPACITY];
73 
74  };
75 
79 
80  public:
81 
82  // ----------------------------------------------------------------------
83  // Public constructors for TlmPortSerializer
84  // ----------------------------------------------------------------------
85 
88 
89  public:
90 
91  // ----------------------------------------------------------------------
92  // Public member functions for TlmPortSerializer
93  // ----------------------------------------------------------------------
94 
97  Fw::SerialBufferBase& _buffer
98  );
99 
100  public:
101 
102  // ----------------------------------------------------------------------
103  // Public static functions for TlmPortSerializer
104  // ----------------------------------------------------------------------
105 
108  FwChanIdType id,
109  Fw::Time& timeTag,
110  Fw::TlmBuffer& val,
111  Fw::SerialBufferBase& _buffer
112  );
113 
114  public:
115 
116  // ----------------------------------------------------------------------
117  // Public member variables for TlmPortSerializer
118  // ----------------------------------------------------------------------
119 
123 
124  };
125 
126 #if !FW_DIRECT_PORT_CALLS
127 
130  class InputTlmPort :
131  public Fw::InputPortBase
132  {
133 
134  public:
135 
136  // ----------------------------------------------------------------------
137  // Public types for InputTlmPort
138  // ----------------------------------------------------------------------
139 
141  typedef void (*CompFuncPtr)(
142  Fw::PassiveComponentBase* callComp,
143  FwIndexType portNum,
144  FwChanIdType id,
145  Fw::Time& timeTag,
146  Fw::TlmBuffer& val
147  );
148 
149  public:
150 
151  // ----------------------------------------------------------------------
152  // Public constructors for InputTlmPort
153  // ----------------------------------------------------------------------
154 
156  InputTlmPort();
157 
158  public:
159 
160  // ----------------------------------------------------------------------
161  // Public member functions for InputTlmPort
162  // ----------------------------------------------------------------------
163 
165  void init();
166 
168  void addCallComp(
169  Fw::PassiveComponentBase* callComp,
170  CompFuncPtr funcPtr
171  );
172 
174  void invoke(
175  FwChanIdType id,
176  Fw::Time& timeTag,
177  Fw::TlmBuffer& val
178  );
179 
180  private:
181 
182  // ----------------------------------------------------------------------
183  // Private member functions for InputTlmPort
184  // ----------------------------------------------------------------------
185 
186 #if FW_PORT_SERIALIZATION == 1
187 
190  Fw::SerializeStatus invokeSerial(
191  Fw::LinearBufferBase& _buffer
192  );
193 
194 #endif
195 
196  private:
197 
198  // ----------------------------------------------------------------------
199  // Private member variables for InputTlmPort
200  // ----------------------------------------------------------------------
201 
203  CompFuncPtr m_func;
204 
205  };
206 
210  public Fw::OutputPortBase
211  {
212 
213  public:
214 
215  // ----------------------------------------------------------------------
216  // Public constructors for OutputTlmPort
217  // ----------------------------------------------------------------------
218 
220  OutputTlmPort();
221 
222  public:
223 
224  // ----------------------------------------------------------------------
225  // Public member functions for OutputTlmPort
226  // ----------------------------------------------------------------------
227 
229  void init();
230 
232  void addCallPort(
233  InputTlmPort* callPort
234  );
235 
237  void invoke(
238  FwChanIdType id,
239  Fw::Time& timeTag,
240  Fw::TlmBuffer& val
241  ) const;
242 
243  private:
244 
245  // ----------------------------------------------------------------------
246  // Private member variables for OutputTlmPort
247  // ----------------------------------------------------------------------
248 
250  InputTlmPort* m_port;
251 
252  };
253 
254 #endif
255 
256 }
257 
258 #endif
U8 * getBuffAddr() override
Definition: TlmPortAc.hpp:56
PlatformSizeType FwSizeType
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: TlmPortAc.cpp:95
void(* CompFuncPtr)(Fw::PassiveComponentBase *callComp, FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
The port callback function type.
Definition: TlmPortAc.hpp:141
static Fw::SerializeStatus serializePortArgs(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val, Fw::SerialBufferBase &_buffer)
Serialize port arguments into a buffer.
Definition: TlmPortAc.cpp:50
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
void init()
Initialization function.
Definition: TlmPortAc.cpp:89
Fw::SerializeStatus deserializePortArgs(Fw::SerialBufferBase &_buffer)
Deserialze port arguments into members.
Definition: TlmPortAc.cpp:30
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
InputTlmPort()
Constructor.
Definition: TlmPortAc.cpp:77
SerializeStatus
forward declaration for string
Fw::Serializable::SizeType getCapacity() const override
Definition: TlmPortAc.hpp:50
TlmPortSerializer()
Constructor.
Definition: TlmPortAc.cpp:17
FwIdType FwChanIdType
The type of a telemetry channel identifier.
FwSizeType SizeType
OutputTlmPort()
Constructor.
Definition: TlmPortAc.cpp:159
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
static constexpr FwSizeType CAPACITY
Definition: TlmPortAc.hpp:37
Fw::TlmBuffer m_val
Definition: TlmPortAc.hpp:122
PlatformIndexType FwIndexType
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Invoke a port interface.
Definition: TlmPortAc.cpp:109
const U8 * getBuffAddr() const override
Definition: TlmPortAc.hpp:62
Implementation of malloc based allocator.