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 
170 
175 
180 
185 
186  PROTECTED:
187 
188  // ----------------------------------------------------------------------
189  // Getters for numbers of typed output ports
190  // ----------------------------------------------------------------------
191 
196 
201 
202  PROTECTED:
203 
204  // ----------------------------------------------------------------------
205  // Connection status queries for typed output ports
206  // ----------------------------------------------------------------------
207 
212  FwIndexType portNum
213  );
214 
219  FwIndexType portNum
220  );
221 
222  PROTECTED:
223 
224  // ----------------------------------------------------------------------
225  // Handlers to implement for typed input ports
226  // ----------------------------------------------------------------------
227 
229  virtual void Run_handler(
230  FwIndexType portNum,
231  U32 context
232  ) = 0;
233 
236  FwIndexType portNum,
237  FwChanIdType id,
238  Fw::Time& timeTag,
239  Fw::TlmBuffer& val
240  ) = 0;
243 
245  virtual void TlmRecv_handler(
246  FwIndexType portNum,
247  FwChanIdType id,
248  Fw::Time& timeTag,
249  Fw::TlmBuffer& val
250  ) = 0;
251 
253  virtual void pingIn_handler(
254  FwIndexType portNum,
255  U32 key
256  ) = 0;
257 
258  PROTECTED:
259 
260  // ----------------------------------------------------------------------
261  // Port handler base-class functions for typed input ports
262  //
263  // Call these functions directly to bypass the corresponding ports
264  // ----------------------------------------------------------------------
265 
267  void Run_handlerBase(
268  FwIndexType portNum,
269  U32 context
270  );
271 
274  FwIndexType portNum,
275  FwChanIdType id,
276  Fw::Time& timeTag,
277  Fw::TlmBuffer& val
278  );
281 
283  void TlmRecv_handlerBase(
284  FwIndexType portNum,
285  FwChanIdType id,
286  Fw::Time& timeTag,
287  Fw::TlmBuffer& val
288  );
289 
291  void pingIn_handlerBase(
292  FwIndexType portNum,
293  U32 key
294  );
295 
296  PROTECTED:
297 
298  // ----------------------------------------------------------------------
299  // Pre-message hooks for typed async input ports
300  //
301  // Each of these functions is invoked just before processing a message
302  // on the corresponding port. By default, they do nothing. You can
303  // override them to provide specific pre-message behavior.
304  // ----------------------------------------------------------------------
305 
307  virtual void Run_preMsgHook(
308  FwIndexType portNum,
309  U32 context
310  );
311 
313  virtual void pingIn_preMsgHook(
314  FwIndexType portNum,
315  U32 key
316  );
317 
318  PROTECTED:
319 
320  // ----------------------------------------------------------------------
321  // Invocation functions for typed output ports
322  // ----------------------------------------------------------------------
323 
325  void PktSend_out(
326  FwIndexType portNum,
327  Fw::ComBuffer& data,
328  U32 context
329  );
330 
332  void pingOut_out(
333  FwIndexType portNum,
334  U32 key
335  );
336 
337  PROTECTED:
338 
339  // ----------------------------------------------------------------------
340  // Mutex operations for guarded ports
341  //
342  // You can override these operations to provide more sophisticated
343  // synchronization
344  // ----------------------------------------------------------------------
345 
347  virtual void lock();
348 
350  virtual void unLock();
351 
352  PRIVATE:
353 
354  // ----------------------------------------------------------------------
355  // Message dispatch functions
356  // ----------------------------------------------------------------------
357 
359  virtual MsgDispatchStatus doDispatch();
360 
361  PRIVATE:
362 
363  // ----------------------------------------------------------------------
364  // Calls for messages received on typed input ports
365  // ----------------------------------------------------------------------
366 
368  static void m_p_Run_in(
369  Fw::PassiveComponentBase* callComp,
370  FwIndexType portNum,
371  U32 context
372  );
373 
375  static Fw::TlmValid m_p_TlmGet_in(
376  Fw::PassiveComponentBase* callComp,
377  FwIndexType portNum,
378  FwChanIdType id,
379  Fw::Time& timeTag,
380  Fw::TlmBuffer& val
381  );
384 
386  static void m_p_TlmRecv_in(
387  Fw::PassiveComponentBase* callComp,
388  FwIndexType portNum,
389  FwChanIdType id,
390  Fw::Time& timeTag,
391  Fw::TlmBuffer& val
392  );
393 
395  static void m_p_pingIn_in(
396  Fw::PassiveComponentBase* callComp,
397  FwIndexType portNum,
398  U32 key
399  );
400 
401  PRIVATE:
402 
403  // ----------------------------------------------------------------------
404  // Typed input ports
405  // ----------------------------------------------------------------------
406 
408  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
409 
411  Fw::InputTlmGetPort m_TlmGet_InputPort[NUM_TLMGET_INPUT_PORTS];
412 
414  Fw::InputTlmPort m_TlmRecv_InputPort[NUM_TLMRECV_INPUT_PORTS];
415 
417  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
418 
419  PRIVATE:
420 
421  // ----------------------------------------------------------------------
422  // Typed output ports
423  // ----------------------------------------------------------------------
424 
426  Fw::OutputComPort m_PktSend_OutputPort[NUM_PKTSEND_OUTPUT_PORTS];
427 
429  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
430 
431  PRIVATE:
432 
433  // ----------------------------------------------------------------------
434  // Mutexes
435  // ----------------------------------------------------------------------
436 
438  Os::Mutex m_guardedPortMutex;
439 
440  };
441 
442 }
443 
444 #endif
virtual void TlmRecv_handler(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmRecv.
Definition: Time.hpp:9
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.
FwIndexType getNum_TlmRecv_InputPorts() const
Auto-generated base for TlmChan component.
FwIndexType getNum_TlmGet_InputPorts() const
FwIndexType getNum_Run_InputPorts() const
void init()
Object initializer.
Definition: ObjBase.cpp:26
FwIndexType getNum_PktSend_OutputPorts() const
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.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
FwIndexType getNum_pingIn_InputPorts() const
FwIndexType getNum_pingOut_OutputPorts() const
void set_PktSend_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to PktSend[portNum].
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.
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)
TlmChanComponentBase(const char *compName="")
Construct TlmChanComponentBase object.
void Run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port Run.