F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
TlmChanComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TlmChanComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for TlmChan component base class
5 // ======================================================================
6 
7 #ifndef Svc_TlmChanComponentAc_HPP
8 #define Svc_TlmChanComponentAc_HPP
9 
10 #include "FpConfig.hpp"
11 #include "Fw/Com/ComPortAc.hpp"
15 #include "Fw/Tlm/TlmGetPortAc.hpp"
16 #include "Fw/Tlm/TlmPortAc.hpp"
17 #include "Os/Mutex.hpp"
18 #include "Svc/Ping/PingPortAc.hpp"
20 
21 namespace Svc {
22 
29  {
30 
31  // ----------------------------------------------------------------------
32  // Friend classes
33  // ----------------------------------------------------------------------
34 
37 
38  PROTECTED:
39 
40  // ----------------------------------------------------------------------
41  // Constants
42  // ----------------------------------------------------------------------
43 
45  enum {
50  };
51 
53  enum {
56  };
57 
58  public:
59 
60  // ----------------------------------------------------------------------
61  // Component initialization
62  // ----------------------------------------------------------------------
63 
65  void init(
66  FwSizeType queueDepth,
67  FwEnumStoreType instance = 0
68  );
69 
70  public:
71 
72  // ----------------------------------------------------------------------
73  // Getters for typed input ports
74  // ----------------------------------------------------------------------
75 
80  FwIndexType portNum
81  );
82 
87  FwIndexType portNum
88  );
89 
94  FwIndexType portNum
95  );
96 
101  FwIndexType portNum
102  );
103 
104  public:
105 
106  // ----------------------------------------------------------------------
107  // Connect typed input ports to typed output ports
108  // ----------------------------------------------------------------------
109 
112  FwIndexType portNum,
113  Fw::InputComPort* port
114  );
115 
118  FwIndexType portNum,
119  Svc::InputPingPort* port
120  );
121 
122 #if FW_PORT_SERIALIZATION
123 
124  public:
125 
126  // ----------------------------------------------------------------------
127  // Connect serial input ports to typed output ports
128  // ----------------------------------------------------------------------
129 
132  FwIndexType portNum,
133  Fw::InputSerializePort* port
134  );
135 
138  FwIndexType portNum,
139  Fw::InputSerializePort* port
140  );
141 
142 #endif
143 
144  PROTECTED:
145 
146  // ----------------------------------------------------------------------
147  // Component construction and destruction
148  // ----------------------------------------------------------------------
149 
152  const char* compName = ""
153  );
154 
156  virtual ~TlmChanComponentBase();
157 
158  PROTECTED:
159 
160  // ----------------------------------------------------------------------
161  // Getters for numbers of typed input ports
162  // ----------------------------------------------------------------------
163 
168 
173 
178 
183 
184  PROTECTED:
185 
186  // ----------------------------------------------------------------------
187  // Getters for numbers of typed output ports
188  // ----------------------------------------------------------------------
189 
194 
199 
200  PROTECTED:
201 
202  // ----------------------------------------------------------------------
203  // Connection status queries for typed output ports
204  // ----------------------------------------------------------------------
205 
210  FwIndexType portNum
211  );
212 
217  FwIndexType portNum
218  );
219 
220  PROTECTED:
221 
222  // ----------------------------------------------------------------------
223  // Handlers to implement for typed input ports
224  // ----------------------------------------------------------------------
225 
227  virtual void Run_handler(
228  FwIndexType portNum,
229  U32 context
230  ) = 0;
231 
233  virtual void TlmGet_handler(
234  FwIndexType portNum,
235  FwChanIdType id,
236  Fw::Time& timeTag,
237  Fw::TlmBuffer& val
238  ) = 0;
239 
241  virtual void TlmRecv_handler(
242  FwIndexType portNum,
243  FwChanIdType id,
244  Fw::Time& timeTag,
245  Fw::TlmBuffer& val
246  ) = 0;
247 
249  virtual void pingIn_handler(
250  FwIndexType portNum,
251  U32 key
252  ) = 0;
253 
254  PROTECTED:
255 
256  // ----------------------------------------------------------------------
257  // Port handler base-class functions for typed input ports
258  //
259  // Call these functions directly to bypass the corresponding ports
260  // ----------------------------------------------------------------------
261 
263  void Run_handlerBase(
264  FwIndexType portNum,
265  U32 context
266  );
267 
269  void TlmGet_handlerBase(
270  FwIndexType portNum,
271  FwChanIdType id,
272  Fw::Time& timeTag,
273  Fw::TlmBuffer& val
274  );
275 
277  void TlmRecv_handlerBase(
278  FwIndexType portNum,
279  FwChanIdType id,
280  Fw::Time& timeTag,
281  Fw::TlmBuffer& val
282  );
283 
285  void pingIn_handlerBase(
286  FwIndexType portNum,
287  U32 key
288  );
289 
290  PROTECTED:
291 
292  // ----------------------------------------------------------------------
293  // Pre-message hooks for typed async input ports
294  //
295  // Each of these functions is invoked just before processing a message
296  // on the corresponding port. By default, they do nothing. You can
297  // override them to provide specific pre-message behavior.
298  // ----------------------------------------------------------------------
299 
301  virtual void Run_preMsgHook(
302  FwIndexType portNum,
303  U32 context
304  );
305 
307  virtual void pingIn_preMsgHook(
308  FwIndexType portNum,
309  U32 key
310  );
311 
312  PROTECTED:
313 
314  // ----------------------------------------------------------------------
315  // Invocation functions for typed output ports
316  // ----------------------------------------------------------------------
317 
319  void PktSend_out(
320  FwIndexType portNum,
321  Fw::ComBuffer& data,
322  U32 context
323  );
324 
326  void pingOut_out(
327  FwIndexType portNum,
328  U32 key
329  );
330 
331  PROTECTED:
332 
333  // ----------------------------------------------------------------------
334  // Mutex operations for guarded ports
335  //
336  // You can override these operations to provide more sophisticated
337  // synchronization
338  // ----------------------------------------------------------------------
339 
341  virtual void lock();
342 
344  virtual void unLock();
345 
346  PRIVATE:
347 
348  // ----------------------------------------------------------------------
349  // Message dispatch functions
350  // ----------------------------------------------------------------------
351 
353  virtual MsgDispatchStatus doDispatch();
354 
355  PRIVATE:
356 
357  // ----------------------------------------------------------------------
358  // Calls for messages received on typed input ports
359  // ----------------------------------------------------------------------
360 
362  static void m_p_Run_in(
363  Fw::PassiveComponentBase* callComp,
364  FwIndexType portNum,
365  U32 context
366  );
367 
369  static void m_p_TlmGet_in(
370  Fw::PassiveComponentBase* callComp,
371  FwIndexType portNum,
372  FwChanIdType id,
373  Fw::Time& timeTag,
374  Fw::TlmBuffer& val
375  );
376 
378  static void m_p_TlmRecv_in(
379  Fw::PassiveComponentBase* callComp,
380  FwIndexType portNum,
381  FwChanIdType id,
382  Fw::Time& timeTag,
383  Fw::TlmBuffer& val
384  );
385 
387  static void m_p_pingIn_in(
388  Fw::PassiveComponentBase* callComp,
389  FwIndexType portNum,
390  U32 key
391  );
392 
393  PRIVATE:
394 
395  // ----------------------------------------------------------------------
396  // Typed input ports
397  // ----------------------------------------------------------------------
398 
400  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
401 
403  Fw::InputTlmGetPort m_TlmGet_InputPort[NUM_TLMGET_INPUT_PORTS];
404 
406  Fw::InputTlmPort m_TlmRecv_InputPort[NUM_TLMRECV_INPUT_PORTS];
407 
409  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
410 
411  PRIVATE:
412 
413  // ----------------------------------------------------------------------
414  // Typed output ports
415  // ----------------------------------------------------------------------
416 
418  Fw::OutputComPort m_PktSend_OutputPort[NUM_PKTSEND_OUTPUT_PORTS];
419 
421  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
422 
423  PRIVATE:
424 
425  // ----------------------------------------------------------------------
426  // Mutexes
427  // ----------------------------------------------------------------------
428 
430  Os::Mutex m_guardedPortMutex;
431 
432  };
433 
434 }
435 
436 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:64
U32 FwChanIdType
Definition: FpConfig.h:95
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
C++-compatible configuration header for fprime configuration.
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9
Auto-generated base for TlmChan component.
FwIndexType getNum_PktSend_OutputPorts() const
virtual void Run_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port Run.
FwIndexType getNum_TlmGet_InputPorts() const
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
virtual void unLock()
Unlock the guarded mutex.
virtual void Run_handler(FwIndexType portNum, U32 context)=0
Handler for input port Run.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
virtual ~TlmChanComponentBase()
Destroy TlmChanComponentBase object.
virtual void TlmRecv_handler(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmRecv.
void TlmRecv_handlerBase(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmRecv.
void PktSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port PktSend.
bool isConnected_PktSend_OutputPort(FwIndexType portNum)
FwIndexType getNum_pingIn_InputPorts() const
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
void Run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port Run.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
friend class TlmChanComponentBaseFriend
Friend class for white-box testing.
FwIndexType getNum_TlmRecv_InputPorts() const
TlmChanComponentBase(const char *compName="")
Construct TlmChanComponentBase object.
Fw::InputTlmGetPort * get_TlmGet_InputPort(FwIndexType portNum)
virtual void TlmGet_handler(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmGet.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
Svc::InputSchedPort * get_Run_InputPort(FwIndexType portNum)
FwIndexType getNum_Run_InputPorts() const
Fw::InputTlmPort * get_TlmRecv_InputPort(FwIndexType portNum)
FwIndexType getNum_pingOut_OutputPorts() const
virtual void lock()
Lock the guarded mutex.
void TlmGet_handlerBase(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmGet.
void set_PktSend_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to PktSend[portNum].