F´ Flight Software - C/C++ Documentation
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 "Fw/Com/ComPortAc.hpp"
12 #include "Fw/FPrimeBasicTypes.hpp"
13 #if !FW_DIRECT_PORT_CALLS
15 #endif
16 #if !FW_DIRECT_PORT_CALLS
18 #endif
19 #include "Fw/Tlm/TlmGetPortAc.hpp"
20 #include "Fw/Tlm/TlmPortAc.hpp"
21 #include "Os/Mutex.hpp"
22 #include "Svc/Ping/PingPortAc.hpp"
24 
25 namespace Svc {
26 
33  {
34 
35  // ----------------------------------------------------------------------
36  // Friend classes
37  // ----------------------------------------------------------------------
38 
40  friend class TlmChanTesterBase;
42  friend class TlmChanTester;
43 
44  protected:
45 
46  // ----------------------------------------------------------------------
47  // Constants
48  // ----------------------------------------------------------------------
49 
51  enum {
56  };
57 
59  enum {
62  };
63 
64  public:
65 
66  // ----------------------------------------------------------------------
67  // Component initialization
68  // ----------------------------------------------------------------------
69 
71  void init(
72  FwSizeType queueDepth,
73  FwEnumStoreType instance = 0
74  );
75 
76 #if !FW_DIRECT_PORT_CALLS
77 
78  public:
79 
80  // ----------------------------------------------------------------------
81  // Getters for typed input ports
82  // ----------------------------------------------------------------------
83 
88  FwIndexType portNum
89  );
90 
95  FwIndexType portNum
96  );
97 
102  FwIndexType portNum
103  );
104 
109  FwIndexType portNum
110  );
111 
112 #endif
113 
114 #if !FW_DIRECT_PORT_CALLS
115 
116  public:
117 
118  // ----------------------------------------------------------------------
119  // Connect typed input ports to typed output ports
120  // ----------------------------------------------------------------------
121 
124  FwIndexType portNum,
125  Fw::InputComPort* port
126  );
127 
130  FwIndexType portNum,
131  Svc::InputPingPort* port
132  );
133 
134 #endif
135 
136 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
137 
138  public:
139 
140  // ----------------------------------------------------------------------
141  // Connect serial input ports to typed output ports
142  // ----------------------------------------------------------------------
143 
146  FwIndexType portNum,
147  Fw::InputSerializePort* port
148  );
149 
152  FwIndexType portNum,
153  Fw::InputSerializePort* port
154  );
155 
156 #endif
157 
158  protected:
159 
160  // ----------------------------------------------------------------------
161  // Component construction and destruction
162  // ----------------------------------------------------------------------
163 
166  const char* compName = ""
167  );
168 
170  virtual ~TlmChanComponentBase();
171 
172  protected:
173 
174  // ----------------------------------------------------------------------
175  // Getters for numbers of typed input ports
176  // ----------------------------------------------------------------------
177 
181  static constexpr FwIndexType getNum_Run_InputPorts() {
182  return NUM_RUN_INPUT_PORTS;
183  }
184 
189  return NUM_TLMGET_INPUT_PORTS;
190  }
191 
197  }
198 
203  return NUM_PINGIN_INPUT_PORTS;
204  }
205 
206  protected:
207 
208  // ----------------------------------------------------------------------
209  // Getters for numbers of typed output ports
210  // ----------------------------------------------------------------------
211 
217  }
218 
224  }
225 
226  protected:
227 
228  // ----------------------------------------------------------------------
229  // Connection status queries for typed output ports
230  // ----------------------------------------------------------------------
231 
236  FwIndexType portNum
237  ) const;
238 
243  FwIndexType portNum
244  ) const;
245 
246  protected:
247 
248  // ----------------------------------------------------------------------
249  // Handlers to implement for typed input ports
250  // ----------------------------------------------------------------------
251 
253  virtual void Run_handler(
254  FwIndexType portNum,
255  U32 context
256  ) = 0;
257 
260  FwIndexType portNum,
261  FwChanIdType id,
262  Fw::Time& timeTag,
263  Fw::TlmBuffer& val
264  ) = 0;
267 
269  virtual void TlmRecv_handler(
270  FwIndexType portNum,
271  FwChanIdType id,
272  Fw::Time& timeTag,
273  Fw::TlmBuffer& val
274  ) = 0;
275 
277  virtual void pingIn_handler(
278  FwIndexType portNum,
279  U32 key
280  ) = 0;
281 
282 #if FW_DIRECT_PORT_CALLS
283  public:
284 #else
285  protected:
286 #endif
287 
288  // ----------------------------------------------------------------------
289  // Port handler base-class functions for typed input ports
290  //
291  // Call these functions directly to bypass the corresponding ports
292  // ----------------------------------------------------------------------
293 
295  void Run_handlerBase(
296  FwIndexType portNum,
297  U32 context
298  );
299 
302  FwIndexType portNum,
303  FwChanIdType id,
304  Fw::Time& timeTag,
305  Fw::TlmBuffer& val
306  );
309 
311  void TlmRecv_handlerBase(
312  FwIndexType portNum,
313  FwChanIdType id,
314  Fw::Time& timeTag,
315  Fw::TlmBuffer& val
316  );
317 
319  void pingIn_handlerBase(
320  FwIndexType portNum,
321  U32 key
322  );
323 
324  protected:
325 
326  // ----------------------------------------------------------------------
327  // Pre-message hooks for typed async input ports
328  //
329  // Each of these functions is invoked just before processing a message
330  // on the corresponding port. By default, they do nothing. You can
331  // override them to provide specific pre-message behavior.
332  // ----------------------------------------------------------------------
333 
335  virtual void Run_preMsgHook(
336  FwIndexType portNum,
337  U32 context
338  );
339 
341  virtual void pingIn_preMsgHook(
342  FwIndexType portNum,
343  U32 key
344  );
345 
346  protected:
347 
348  // ----------------------------------------------------------------------
349  // Invocation functions for typed output ports
350  // ----------------------------------------------------------------------
351 
353  void PktSend_out(
354  FwIndexType portNum,
355  Fw::ComBuffer& data,
356  U32 context
357  ) const;
358 
360  void pingOut_out(
361  FwIndexType portNum,
362  U32 key
363  ) const;
364 
365  protected:
366 
367  // ----------------------------------------------------------------------
368  // Mutex operations for guarded ports
369  //
370  // You can override these operations to provide more sophisticated
371  // synchronization
372  // ----------------------------------------------------------------------
373 
375  virtual void lock();
376 
378  virtual void unLock();
379 
380  private:
381 
382  // ----------------------------------------------------------------------
383  // Message dispatch functions
384  // ----------------------------------------------------------------------
385 
387  virtual MsgDispatchStatus doDispatch();
388 
389  private:
390 
391  // ----------------------------------------------------------------------
392  // Calls for messages received on typed input ports
393  // ----------------------------------------------------------------------
394 
396  static void m_p_Run_in(
397  Fw::PassiveComponentBase* callComp,
398  FwIndexType portNum,
399  U32 context
400  );
401 
403  static Fw::TlmValid m_p_TlmGet_in(
404  Fw::PassiveComponentBase* callComp,
405  FwIndexType portNum,
406  FwChanIdType id,
407  Fw::Time& timeTag,
408  Fw::TlmBuffer& val
409  );
412 
414  static void m_p_TlmRecv_in(
415  Fw::PassiveComponentBase* callComp,
416  FwIndexType portNum,
417  FwChanIdType id,
418  Fw::Time& timeTag,
419  Fw::TlmBuffer& val
420  );
421 
423  static void m_p_pingIn_in(
424  Fw::PassiveComponentBase* callComp,
425  FwIndexType portNum,
426  U32 key
427  );
428 
429 #if !FW_DIRECT_PORT_CALLS
430 
431  private:
432 
433  // ----------------------------------------------------------------------
434  // Typed input ports
435  // ----------------------------------------------------------------------
436 
438  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
439 
441  Fw::InputTlmGetPort m_TlmGet_InputPort[NUM_TLMGET_INPUT_PORTS];
442 
444  Fw::InputTlmPort m_TlmRecv_InputPort[NUM_TLMRECV_INPUT_PORTS];
445 
447  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
448 
449 #endif
450 
451 #if !FW_DIRECT_PORT_CALLS
452 
453  private:
454 
455  // ----------------------------------------------------------------------
456  // Typed output ports
457  // ----------------------------------------------------------------------
458 
460  Fw::OutputComPort m_PktSend_OutputPort[NUM_PKTSEND_OUTPUT_PORTS];
461 
463  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
464 
465 #endif
466 
467  private:
468 
469  // ----------------------------------------------------------------------
470  // Mutexes
471  // ----------------------------------------------------------------------
472 
474  Os::Mutex m_guardedPortMutex;
475 
476  };
477 
478 }
479 
480 #endif
virtual void TlmRecv_handler(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmRecv.
virtual Fw::TlmValid TlmGet_handler(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmGet.
PlatformSizeType FwSizeType
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
Fw::InputTlmPort * get_TlmRecv_InputPort(FwIndexType portNum)
I32 FwEnumStoreType
friend class TlmChanTesterBase
Friend class tester to support autocoded test harness.
Fw::TlmValid TlmGet_handlerBase(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmGet.
bool isConnected_pingOut_OutputPort(FwIndexType portNum) const
bool isConnected_PktSend_OutputPort(FwIndexType portNum) const
virtual ~TlmChanComponentBase()
Destroy TlmChanComponentBase object.
Auto-generated base for TlmChan component.
static constexpr FwIndexType getNum_Run_InputPorts()
void init()
Object initializer.
Definition: ObjBase.cpp:24
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
void PktSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context) const
Invoke output port PktSend.
virtual void lock()
Lock the guarded mutex.
Svc::InputSchedPort * get_Run_InputPort(FwIndexType portNum)
void pingOut_out(FwIndexType portNum, U32 key) const
Invoke output port pingOut.
static constexpr FwIndexType getNum_pingIn_InputPorts()
FwIdType FwChanIdType
The type of a telemetry channel identifier.
static constexpr FwIndexType getNum_TlmRecv_InputPorts()
void set_PktSend_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to PktSend[portNum].
static constexpr FwIndexType getNum_PktSend_OutputPorts()
virtual void Run_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port Run.
virtual void Run_handler(FwIndexType portNum, U32 context)=0
Handler for input port Run.
static constexpr FwIndexType getNum_pingOut_OutputPorts()
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
void TlmRecv_handlerBase(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmRecv.
PlatformIndexType FwIndexType
virtual void unLock()
Unlock the guarded mutex.
friend class TlmChanTester
Friend class tester implementation to support white-box testing.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
RateGroupDivider component implementation.
Fw::InputTlmGetPort * get_TlmGet_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_TlmGet_InputPorts()
TlmChanComponentBase(const char *compName="")
Construct TlmChanComponentBase object.
void Run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port Run.