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"
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 
36  friend class TlmChanTesterBase;
38  friend class TlmChanTester;
39 
40  protected:
41 
42  // ----------------------------------------------------------------------
43  // Constants
44  // ----------------------------------------------------------------------
45 
47  enum {
52  };
53 
55  enum {
58  };
59 
60  public:
61 
62  // ----------------------------------------------------------------------
63  // Component initialization
64  // ----------------------------------------------------------------------
65 
67  void init(
68  FwSizeType queueDepth,
69  FwEnumStoreType instance = 0
70  );
71 
72  public:
73 
74  // ----------------------------------------------------------------------
75  // Getters for typed input ports
76  // ----------------------------------------------------------------------
77 
82  FwIndexType portNum
83  );
84 
89  FwIndexType portNum
90  );
91 
96  FwIndexType portNum
97  );
98 
103  FwIndexType portNum
104  );
105 
106  public:
107 
108  // ----------------------------------------------------------------------
109  // Connect typed input ports to typed output ports
110  // ----------------------------------------------------------------------
111 
114  FwIndexType portNum,
115  Fw::InputComPort* port
116  );
117 
120  FwIndexType portNum,
121  Svc::InputPingPort* port
122  );
123 
124 #if FW_PORT_SERIALIZATION
125 
126  public:
127 
128  // ----------------------------------------------------------------------
129  // Connect serial input ports to typed output ports
130  // ----------------------------------------------------------------------
131 
134  FwIndexType portNum,
135  Fw::InputSerializePort* port
136  );
137 
140  FwIndexType portNum,
141  Fw::InputSerializePort* port
142  );
143 
144 #endif
145 
146  protected:
147 
148  // ----------------------------------------------------------------------
149  // Component construction and destruction
150  // ----------------------------------------------------------------------
151 
154  const char* compName = ""
155  );
156 
158  virtual ~TlmChanComponentBase();
159 
160  protected:
161 
162  // ----------------------------------------------------------------------
163  // Getters for numbers of typed input ports
164  // ----------------------------------------------------------------------
165 
169  static constexpr FwIndexType getNum_Run_InputPorts() {
170  return NUM_RUN_INPUT_PORTS;
171  }
172 
177  return NUM_TLMGET_INPUT_PORTS;
178  }
179 
185  }
186 
191  return NUM_PINGIN_INPUT_PORTS;
192  }
193 
194  protected:
195 
196  // ----------------------------------------------------------------------
197  // Getters for numbers of typed output ports
198  // ----------------------------------------------------------------------
199 
205  }
206 
212  }
213 
214  protected:
215 
216  // ----------------------------------------------------------------------
217  // Connection status queries for typed output ports
218  // ----------------------------------------------------------------------
219 
224  FwIndexType portNum
225  );
226 
231  FwIndexType portNum
232  );
233 
234  protected:
235 
236  // ----------------------------------------------------------------------
237  // Handlers to implement for typed input ports
238  // ----------------------------------------------------------------------
239 
241  virtual void Run_handler(
242  FwIndexType portNum,
243  U32 context
244  ) = 0;
245 
248  FwIndexType portNum,
249  FwChanIdType id,
250  Fw::Time& timeTag,
251  Fw::TlmBuffer& val
252  ) = 0;
255 
257  virtual void TlmRecv_handler(
258  FwIndexType portNum,
259  FwChanIdType id,
260  Fw::Time& timeTag,
261  Fw::TlmBuffer& val
262  ) = 0;
263 
265  virtual void pingIn_handler(
266  FwIndexType portNum,
267  U32 key
268  ) = 0;
269 
270  protected:
271 
272  // ----------------------------------------------------------------------
273  // Port handler base-class functions for typed input ports
274  //
275  // Call these functions directly to bypass the corresponding ports
276  // ----------------------------------------------------------------------
277 
279  void Run_handlerBase(
280  FwIndexType portNum,
281  U32 context
282  );
283 
286  FwIndexType portNum,
287  FwChanIdType id,
288  Fw::Time& timeTag,
289  Fw::TlmBuffer& val
290  );
293 
295  void TlmRecv_handlerBase(
296  FwIndexType portNum,
297  FwChanIdType id,
298  Fw::Time& timeTag,
299  Fw::TlmBuffer& val
300  );
301 
303  void pingIn_handlerBase(
304  FwIndexType portNum,
305  U32 key
306  );
307 
308  protected:
309 
310  // ----------------------------------------------------------------------
311  // Pre-message hooks for typed async input ports
312  //
313  // Each of these functions is invoked just before processing a message
314  // on the corresponding port. By default, they do nothing. You can
315  // override them to provide specific pre-message behavior.
316  // ----------------------------------------------------------------------
317 
319  virtual void Run_preMsgHook(
320  FwIndexType portNum,
321  U32 context
322  );
323 
325  virtual void pingIn_preMsgHook(
326  FwIndexType portNum,
327  U32 key
328  );
329 
330  protected:
331 
332  // ----------------------------------------------------------------------
333  // Invocation functions for typed output ports
334  // ----------------------------------------------------------------------
335 
337  void PktSend_out(
338  FwIndexType portNum,
339  Fw::ComBuffer& data,
340  U32 context
341  );
342 
344  void pingOut_out(
345  FwIndexType portNum,
346  U32 key
347  );
348 
349  protected:
350 
351  // ----------------------------------------------------------------------
352  // Mutex operations for guarded ports
353  //
354  // You can override these operations to provide more sophisticated
355  // synchronization
356  // ----------------------------------------------------------------------
357 
359  virtual void lock();
360 
362  virtual void unLock();
363 
364  private:
365 
366  // ----------------------------------------------------------------------
367  // Message dispatch functions
368  // ----------------------------------------------------------------------
369 
371  virtual MsgDispatchStatus doDispatch();
372 
373  private:
374 
375  // ----------------------------------------------------------------------
376  // Calls for messages received on typed input ports
377  // ----------------------------------------------------------------------
378 
380  static void m_p_Run_in(
381  Fw::PassiveComponentBase* callComp,
382  FwIndexType portNum,
383  U32 context
384  );
385 
387  static Fw::TlmValid m_p_TlmGet_in(
388  Fw::PassiveComponentBase* callComp,
389  FwIndexType portNum,
390  FwChanIdType id,
391  Fw::Time& timeTag,
392  Fw::TlmBuffer& val
393  );
396 
398  static void m_p_TlmRecv_in(
399  Fw::PassiveComponentBase* callComp,
400  FwIndexType portNum,
401  FwChanIdType id,
402  Fw::Time& timeTag,
403  Fw::TlmBuffer& val
404  );
405 
407  static void m_p_pingIn_in(
408  Fw::PassiveComponentBase* callComp,
409  FwIndexType portNum,
410  U32 key
411  );
412 
413  private:
414 
415  // ----------------------------------------------------------------------
416  // Typed input ports
417  // ----------------------------------------------------------------------
418 
420  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
421 
423  Fw::InputTlmGetPort m_TlmGet_InputPort[NUM_TLMGET_INPUT_PORTS];
424 
426  Fw::InputTlmPort m_TlmRecv_InputPort[NUM_TLMRECV_INPUT_PORTS];
427 
429  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
430 
431  private:
432 
433  // ----------------------------------------------------------------------
434  // Typed output ports
435  // ----------------------------------------------------------------------
436 
438  Fw::OutputComPort m_PktSend_OutputPort[NUM_PKTSEND_OUTPUT_PORTS];
439 
441  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
442 
443  private:
444 
445  // ----------------------------------------------------------------------
446  // Mutexes
447  // ----------------------------------------------------------------------
448 
450  Os::Mutex m_guardedPortMutex;
451 
452  };
453 
454 }
455 
456 #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
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
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.
void PktSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port PktSend.
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.
virtual void lock()
Lock the guarded mutex.
Svc::InputSchedPort * get_Run_InputPort(FwIndexType portNum)
bool isConnected_PktSend_OutputPort(FwIndexType portNum)
void pingOut_out(FwIndexType portNum, U32 key)
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.