F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ActiveRateGroupComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ActiveRateGroupComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for ActiveRateGroup component base class
5 // ======================================================================
6 
7 #ifndef Svc_ActiveRateGroupComponentAc_HPP
8 #define Svc_ActiveRateGroupComponentAc_HPP
9 
10 #include <atomic>
11 
13 #include "Fw/FPrimeBasicTypes.hpp"
14 #include "Fw/Log/LogPortAc.hpp"
15 #include "Fw/Log/LogString.hpp"
16 #if FW_ENABLE_TEXT_LOGGING == 1
17 #include "Fw/Log/LogTextPortAc.hpp"
18 #endif
21 #include "Fw/Time/TimePortAc.hpp"
22 #include "Fw/Tlm/TlmPortAc.hpp"
23 #include "Fw/Tlm/TlmString.hpp"
25 #include "Svc/Ping/PingPortAc.hpp"
27 
28 namespace Svc {
29 
36  {
37 
38  // ----------------------------------------------------------------------
39  // Friend classes
40  // ----------------------------------------------------------------------
41 
45  friend class ActiveRateGroupTester;
46 
47  protected:
48 
49  // ----------------------------------------------------------------------
50  // Constants
51  // ----------------------------------------------------------------------
52 
54  enum {
57  };
58 
60  enum {
65  };
66 
68  enum {
71  };
72 
74  enum {
77  };
78 
80  enum {
83  };
84 
85  public:
86 
87  // ----------------------------------------------------------------------
88  // Component initialization
89  // ----------------------------------------------------------------------
90 
92  void init(
93  FwSizeType queueDepth,
94  FwEnumStoreType instance = 0
95  );
96 
97  public:
98 
99  // ----------------------------------------------------------------------
100  // Getters for typed input ports
101  // ----------------------------------------------------------------------
102 
107  FwIndexType portNum
108  );
109 
114  FwIndexType portNum
115  );
116 
117  public:
118 
119  // ----------------------------------------------------------------------
120  // Connect input ports to special output ports
121  // ----------------------------------------------------------------------
122 
124  void set_Log_OutputPort(
125  FwIndexType portNum,
126  Fw::InputLogPort* port
127  );
128 
129 #if FW_ENABLE_TEXT_LOGGING == 1
130 
132  void set_LogText_OutputPort(
133  FwIndexType portNum,
134  Fw::InputLogTextPort* port
135  );
136 
137 #endif
138 
140  void set_Time_OutputPort(
141  FwIndexType portNum,
142  Fw::InputTimePort* port
143  );
144 
146  void set_Tlm_OutputPort(
147  FwIndexType portNum,
148  Fw::InputTlmPort* port
149  );
150 
151  public:
152 
153  // ----------------------------------------------------------------------
154  // Connect typed input ports to typed output ports
155  // ----------------------------------------------------------------------
156 
159  FwIndexType portNum,
160  Svc::InputPingPort* port
161  );
162 
165  FwIndexType portNum,
166  Svc::InputSchedPort* port
167  );
168 
169 #if FW_PORT_SERIALIZATION
170 
171  public:
172 
173  // ----------------------------------------------------------------------
174  // Connect serial input ports to special output ports
175  // ----------------------------------------------------------------------
176 
178  void set_Log_OutputPort(
179  FwIndexType portNum,
180  Fw::InputSerializePort* port
181  );
182 
183 #if FW_ENABLE_TEXT_LOGGING == 1
184 
186  void set_LogText_OutputPort(
187  FwIndexType portNum,
188  Fw::InputSerializePort* port
189  );
190 
191 #endif
192 
194  void set_Time_OutputPort(
195  FwIndexType portNum,
196  Fw::InputSerializePort* port
197  );
198 
200  void set_Tlm_OutputPort(
201  FwIndexType portNum,
202  Fw::InputSerializePort* port
203  );
204 
205 #endif
206 
207 #if FW_PORT_SERIALIZATION
208 
209  public:
210 
211  // ----------------------------------------------------------------------
212  // Connect serial input ports to typed output ports
213  // ----------------------------------------------------------------------
214 
217  FwIndexType portNum,
218  Fw::InputSerializePort* port
219  );
220 
223  FwIndexType portNum,
224  Fw::InputSerializePort* port
225  );
226 
227 #endif
228 
229  protected:
230 
231  // ----------------------------------------------------------------------
232  // Component construction and destruction
233  // ----------------------------------------------------------------------
234 
237  const char* compName = ""
238  );
239 
242 
243  protected:
244 
245  // ----------------------------------------------------------------------
246  // Getters for numbers of typed input ports
247  // ----------------------------------------------------------------------
248 
254  }
255 
260  return NUM_PINGIN_INPUT_PORTS;
261  }
262 
263  protected:
264 
265  // ----------------------------------------------------------------------
266  // Getters for numbers of special output ports
267  // ----------------------------------------------------------------------
268 
272  static constexpr FwIndexType getNum_Log_OutputPorts() {
273  return NUM_LOG_OUTPUT_PORTS;
274  }
275 
276 #if FW_ENABLE_TEXT_LOGGING == 1
277 
281  static constexpr FwIndexType getNum_LogText_OutputPorts() {
283  }
284 
285 #endif
286 
291  return NUM_TIME_OUTPUT_PORTS;
292  }
293 
297  static constexpr FwIndexType getNum_Tlm_OutputPorts() {
298  return NUM_TLM_OUTPUT_PORTS;
299  }
300 
301  protected:
302 
303  // ----------------------------------------------------------------------
304  // Getters for numbers of typed output ports
305  // ----------------------------------------------------------------------
306 
312  }
313 
319  }
320 
321  protected:
322 
323  // ----------------------------------------------------------------------
324  // Connection status queries for special output ports
325  // ----------------------------------------------------------------------
326 
331  FwIndexType portNum
332  );
333 
334 #if FW_ENABLE_TEXT_LOGGING == 1
335 
339  bool isConnected_LogText_OutputPort(
340  FwIndexType portNum
341  );
342 
343 #endif
344 
349  FwIndexType portNum
350  );
351 
356  FwIndexType portNum
357  );
358 
359  protected:
360 
361  // ----------------------------------------------------------------------
362  // Connection status queries for typed output ports
363  // ----------------------------------------------------------------------
364 
369  FwIndexType portNum
370  );
371 
376  FwIndexType portNum
377  );
378 
379  protected:
380 
381  // ----------------------------------------------------------------------
382  // Handlers to implement for typed input ports
383  // ----------------------------------------------------------------------
384 
386  virtual void CycleIn_handler(
387  FwIndexType portNum,
388  Os::RawTime& cycleStart
389  ) = 0;
390 
392  virtual void PingIn_handler(
393  FwIndexType portNum,
394  U32 key
395  ) = 0;
396 
397  protected:
398 
399  // ----------------------------------------------------------------------
400  // Port handler base-class functions for typed input ports
401  //
402  // Call these functions directly to bypass the corresponding ports
403  // ----------------------------------------------------------------------
404 
406  void CycleIn_handlerBase(
407  FwIndexType portNum,
408  Os::RawTime& cycleStart
409  );
410 
412  void PingIn_handlerBase(
413  FwIndexType portNum,
414  U32 key
415  );
416 
417  protected:
418 
419  // ----------------------------------------------------------------------
420  // Pre-message hooks for typed async input ports
421  //
422  // Each of these functions is invoked just before processing a message
423  // on the corresponding port. By default, they do nothing. You can
424  // override them to provide specific pre-message behavior.
425  // ----------------------------------------------------------------------
426 
428  virtual void CycleIn_preMsgHook(
429  FwIndexType portNum,
430  Os::RawTime& cycleStart
431  );
432 
434  virtual void PingIn_preMsgHook(
435  FwIndexType portNum,
436  U32 key
437  );
438 
439  protected:
440 
441  // ----------------------------------------------------------------------
442  // Invocation functions for typed output ports
443  // ----------------------------------------------------------------------
444 
446  void PingOut_out(
447  FwIndexType portNum,
448  U32 key
449  );
450 
453  FwIndexType portNum,
454  U32 context
455  );
456 
457  protected:
458 
459  // ----------------------------------------------------------------------
460  // Event logging functions
461  // ----------------------------------------------------------------------
462 
466  void log_DIAGNOSTIC_RateGroupStarted() const;
467 
472  U32 cycle
473  ) const;
474 
475  protected:
476 
477  // ----------------------------------------------------------------------
478  // Telemetry write functions
479  // ----------------------------------------------------------------------
480 
484  void tlmWrite_RgMaxTime(
485  U32 arg,
486  Fw::Time _tlmTime = Fw::Time()
487  );
488 
493  U32 arg,
494  Fw::Time _tlmTime = Fw::Time()
495  );
496 
497  protected:
498 
499  // ----------------------------------------------------------------------
500  // Time
501  // ----------------------------------------------------------------------
502 
506  Fw::Time getTime() const;
507 
508  private:
509 
510  // ----------------------------------------------------------------------
511  // Message dispatch functions
512  // ----------------------------------------------------------------------
513 
515  virtual MsgDispatchStatus doDispatch();
516 
517  private:
518 
519  // ----------------------------------------------------------------------
520  // Calls for messages received on typed input ports
521  // ----------------------------------------------------------------------
522 
524  static void m_p_CycleIn_in(
525  Fw::PassiveComponentBase* callComp,
526  FwIndexType portNum,
527  Os::RawTime& cycleStart
528  );
529 
531  static void m_p_PingIn_in(
532  Fw::PassiveComponentBase* callComp,
533  FwIndexType portNum,
534  U32 key
535  );
536 
537  private:
538 
539  // ----------------------------------------------------------------------
540  // Typed input ports
541  // ----------------------------------------------------------------------
542 
544  Svc::InputCyclePort m_CycleIn_InputPort[NUM_CYCLEIN_INPUT_PORTS];
545 
547  Svc::InputPingPort m_PingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
548 
549  private:
550 
551  // ----------------------------------------------------------------------
552  // Special output ports
553  // ----------------------------------------------------------------------
554 
556  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
557 
558 #if FW_ENABLE_TEXT_LOGGING == 1
559 
561  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
562 
563 #endif
564 
566  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
567 
569  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
570 
571  private:
572 
573  // ----------------------------------------------------------------------
574  // Typed output ports
575  // ----------------------------------------------------------------------
576 
578  Svc::OutputPingPort m_PingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
579 
581  Svc::OutputSchedPort m_RateGroupMemberOut_OutputPort[NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS];
582 
583  private:
584 
585  // ----------------------------------------------------------------------
586  // First update flags for telemetry channels
587  // ----------------------------------------------------------------------
588 
590  bool m_first_update_RgMaxTime = true;
591 
593  bool m_first_update_RgCycleSlips = true;
594 
595  private:
596 
597  // ----------------------------------------------------------------------
598  // Last value storage for telemetry channels
599  // ----------------------------------------------------------------------
600 
602  U32 m_last_RgMaxTime = {};
603 
605  U32 m_last_RgCycleSlips = {};
606 
607  };
608 
609 }
610 
611 #endif
void set_PingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to PingOut[portNum].
void tlmWrite_RgCycleSlips(U32 arg, Fw::Time _tlmTime=Fw::Time())
friend class ActiveRateGroupTesterBase
Friend class tester to support autocoded test harness.
PlatformSizeType FwSizeType
static constexpr FwIndexType getNum_PingIn_InputPorts()
static constexpr FwIndexType getNum_RateGroupMemberOut_OutputPorts()
void CycleIn_handlerBase(FwIndexType portNum, Os::RawTime &cycleStart)
Handler base-class function for input port CycleIn.
void PingOut_out(FwIndexType portNum, U32 key)
Invoke output port PingOut.
I32 FwEnumStoreType
static constexpr FwIndexType getNum_Log_OutputPorts()
static constexpr FwIndexType getNum_Time_OutputPorts()
virtual void PingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port PingIn.
virtual ~ActiveRateGroupComponentBase()
Destroy ActiveRateGroupComponentBase object.
bool isConnected_Time_OutputPort(FwIndexType portNum)
virtual void CycleIn_preMsgHook(FwIndexType portNum, Os::RawTime &cycleStart)
Pre-message hook for async input port CycleIn.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
Warning event that rate group has had a cycle slip.
void init()
Object initializer.
Definition: ObjBase.cpp:24
ActiveRateGroupComponentBase(const char *compName="")
Construct ActiveRateGroupComponentBase object.
void set_RateGroupMemberOut_OutputPort(FwIndexType portNum, Svc::InputSchedPort *port)
Connect port to RateGroupMemberOut[portNum].
bool isConnected_Log_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_PingOut_OutputPorts()
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
void tlmWrite_RgMaxTime(U32 arg, Fw::Time _tlmTime=Fw::Time())
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
bool isConnected_RateGroupMemberOut_OutputPort(FwIndexType portNum)
virtual void CycleIn_handler(FwIndexType portNum, Os::RawTime &cycleStart)=0
Handler for input port CycleIn.
Auto-generated base for ActiveRateGroup component.
PlatformIndexType FwIndexType
static constexpr FwIndexType getNum_Tlm_OutputPorts()
static constexpr FwIndexType getNum_CycleIn_InputPorts()
Svc::InputPingPort * get_PingIn_InputPort(FwIndexType portNum)
RateGroupDivider component implementation.
virtual void PingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port PingIn.
friend class ActiveRateGroupTester
Friend class tester implementation to support white-box testing.
bool isConnected_PingOut_OutputPort(FwIndexType portNum)
Svc::InputCyclePort * get_CycleIn_InputPort(FwIndexType portNum)
void RateGroupMemberOut_out(FwIndexType portNum, U32 context)
Invoke output port RateGroupMemberOut.
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
void PingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port PingIn.