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 #include "Fw/Log/LogTextPortAc.hpp"
17 #if !FW_DIRECT_PORT_CALLS
19 #endif
20 #if !FW_DIRECT_PORT_CALLS
22 #endif
23 #include "Fw/Time/TimePortAc.hpp"
24 #include "Fw/Tlm/TlmPortAc.hpp"
25 #include "Fw/Tlm/TlmString.hpp"
28 #include "Svc/Ping/PingPortAc.hpp"
30 
31 namespace Svc {
32 
39  {
40 
41  // ----------------------------------------------------------------------
42  // Friend classes
43  // ----------------------------------------------------------------------
44 
48  friend class ActiveRateGroupTester;
49 
50  protected:
51 
52  // ----------------------------------------------------------------------
53  // Constants
54  // ----------------------------------------------------------------------
55 
57  enum {
60  };
61 
63  enum {
68  };
69 
71  enum {
74  };
75 
77  enum {
81  };
82 
84  enum {
86  };
87 
89  enum {
92  };
93 
94  public:
95 
96  // ----------------------------------------------------------------------
97  // Component initialization
98  // ----------------------------------------------------------------------
99 
101  void init(
102  FwSizeType queueDepth,
103  FwEnumStoreType instance = 0
104  );
105 
106 #if !FW_DIRECT_PORT_CALLS
107 
108  public:
109 
110  // ----------------------------------------------------------------------
111  // Getters for typed input ports
112  // ----------------------------------------------------------------------
113 
118  FwIndexType portNum
119  );
120 
125  FwIndexType portNum
126  );
127 
128 #endif
129 
130 #if !FW_DIRECT_PORT_CALLS
131 
132  public:
133 
134  // ----------------------------------------------------------------------
135  // Connect input ports to special output ports
136  // ----------------------------------------------------------------------
137 
139  void set_Log_OutputPort(
140  FwIndexType portNum,
141  Fw::InputLogPort* port
142  );
143 
144 #if FW_ENABLE_TEXT_LOGGING == 1
145 
147  void set_LogText_OutputPort(
148  FwIndexType portNum,
149  Fw::InputLogTextPort* port
150  );
151 
152 #endif
153 
155  void set_Time_OutputPort(
156  FwIndexType portNum,
157  Fw::InputTimePort* port
158  );
159 
161  void set_Tlm_OutputPort(
162  FwIndexType portNum,
163  Fw::InputTlmPort* port
164  );
165 
166 #endif
167 
168 #if !FW_DIRECT_PORT_CALLS
169 
170  public:
171 
172  // ----------------------------------------------------------------------
173  // Connect typed input ports to typed output ports
174  // ----------------------------------------------------------------------
175 
178  FwIndexType portNum,
179  Svc::InputPingPort* port
180  );
181 
184  FwIndexType portNum,
185  Svc::InputSchedPort* port
186  );
187 
188 #endif
189 
190 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
191 
192  public:
193 
194  // ----------------------------------------------------------------------
195  // Connect serial input ports to special output ports
196  // ----------------------------------------------------------------------
197 
199  void set_Log_OutputPort(
200  FwIndexType portNum,
201  Fw::InputSerializePort* port
202  );
203 
204 #if FW_ENABLE_TEXT_LOGGING == 1
205 
207  void set_LogText_OutputPort(
208  FwIndexType portNum,
209  Fw::InputSerializePort* port
210  );
211 
212 #endif
213 
215  void set_Time_OutputPort(
216  FwIndexType portNum,
217  Fw::InputSerializePort* port
218  );
219 
221  void set_Tlm_OutputPort(
222  FwIndexType portNum,
223  Fw::InputSerializePort* port
224  );
225 
226 #endif
227 
228 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
229 
230  public:
231 
232  // ----------------------------------------------------------------------
233  // Connect serial input ports to typed output ports
234  // ----------------------------------------------------------------------
235 
238  FwIndexType portNum,
239  Fw::InputSerializePort* port
240  );
241 
244  FwIndexType portNum,
245  Fw::InputSerializePort* port
246  );
247 
248 #endif
249 
250  protected:
251 
252  // ----------------------------------------------------------------------
253  // Component construction and destruction
254  // ----------------------------------------------------------------------
255 
258  const char* compName = ""
259  );
260 
263 
264  protected:
265 
266  // ----------------------------------------------------------------------
267  // Getters for numbers of typed input ports
268  // ----------------------------------------------------------------------
269 
275  }
276 
281  return NUM_PINGIN_INPUT_PORTS;
282  }
283 
284  protected:
285 
286  // ----------------------------------------------------------------------
287  // Getters for numbers of special output ports
288  // ----------------------------------------------------------------------
289 
293  static constexpr FwIndexType getNum_Log_OutputPorts() {
294  return NUM_LOG_OUTPUT_PORTS;
295  }
296 
297 #if FW_ENABLE_TEXT_LOGGING == 1
298 
302  static constexpr FwIndexType getNum_LogText_OutputPorts() {
304  }
305 
306 #endif
307 
312  return NUM_TIME_OUTPUT_PORTS;
313  }
314 
318  static constexpr FwIndexType getNum_Tlm_OutputPorts() {
319  return NUM_TLM_OUTPUT_PORTS;
320  }
321 
322  protected:
323 
324  // ----------------------------------------------------------------------
325  // Getters for numbers of typed output ports
326  // ----------------------------------------------------------------------
327 
333  }
334 
340  }
341 
342  protected:
343 
344  // ----------------------------------------------------------------------
345  // Connection status queries for special output ports
346  // ----------------------------------------------------------------------
347 
352  FwIndexType portNum
353  ) const;
354 
355 #if FW_ENABLE_TEXT_LOGGING == 1
356 
360  bool isConnected_LogText_OutputPort(
361  FwIndexType portNum
362  ) const;
363 
364 #endif
365 
370  FwIndexType portNum
371  ) const;
372 
377  FwIndexType portNum
378  ) const;
379 
380  protected:
381 
382  // ----------------------------------------------------------------------
383  // Connection status queries for typed output ports
384  // ----------------------------------------------------------------------
385 
390  FwIndexType portNum
391  ) const;
392 
397  FwIndexType portNum
398  ) const;
399 
400  protected:
401 
402  // ----------------------------------------------------------------------
403  // Handlers to implement for typed input ports
404  // ----------------------------------------------------------------------
405 
407  virtual void CycleIn_handler(
408  FwIndexType portNum,
409  Os::RawTime& cycleStart
410  ) = 0;
411 
413  virtual void PingIn_handler(
414  FwIndexType portNum,
415  U32 key
416  ) = 0;
417 
418 #if FW_DIRECT_PORT_CALLS
419  public:
420 #else
421  protected:
422 #endif
423 
424  // ----------------------------------------------------------------------
425  // Port handler base-class functions for typed input ports
426  //
427  // Call these functions directly to bypass the corresponding ports
428  // ----------------------------------------------------------------------
429 
431  void CycleIn_handlerBase(
432  FwIndexType portNum,
433  Os::RawTime& cycleStart
434  );
435 
437  void PingIn_handlerBase(
438  FwIndexType portNum,
439  U32 key
440  );
441 
442  protected:
443 
444  // ----------------------------------------------------------------------
445  // Pre-message hooks for typed async input ports
446  //
447  // Each of these functions is invoked just before processing a message
448  // on the corresponding port. By default, they do nothing. You can
449  // override them to provide specific pre-message behavior.
450  // ----------------------------------------------------------------------
451 
453  virtual void CycleIn_preMsgHook(
454  FwIndexType portNum,
455  Os::RawTime& cycleStart
456  );
457 
459  virtual void PingIn_preMsgHook(
460  FwIndexType portNum,
461  U32 key
462  );
463 
464  protected:
465 
466  // ----------------------------------------------------------------------
467  // Invocation functions for typed output ports
468  // ----------------------------------------------------------------------
469 
471  void PingOut_out(
472  FwIndexType portNum,
473  U32 key
474  ) const;
475 
478  FwIndexType portNum,
479  U32 context
480  ) const;
481 
482  protected:
483 
484  // ----------------------------------------------------------------------
485  // Event logging functions
486  // ----------------------------------------------------------------------
487 
491  void log_DIAGNOSTIC_RateGroupStarted() const;
492 
497  U32 cycle
498  ) const;
499 
504  const Os::RawTimeStatus& status
505  );
506 
507  protected:
508 
509  // ----------------------------------------------------------------------
510  // Event throttle reset functions
511  // ----------------------------------------------------------------------
512 
515 
516  protected:
517 
518  // ----------------------------------------------------------------------
519  // Telemetry serialized write
520  // ----------------------------------------------------------------------
521 
526  void tlmWrite(
527  FwChanIdType id,
528  Fw::TlmBuffer& _tlmBuff,
529  Fw::Time _tlmTime = Fw::Time()
530  ) const;
531 
532  protected:
533 
534  // ----------------------------------------------------------------------
535  // Telemetry write functions
536  // ----------------------------------------------------------------------
537 
541  void tlmWrite_RgMaxTime(
542  U32 arg,
543  Fw::Time _tlmTime = Fw::Time()
544  );
545 
550  U32 arg,
551  Fw::Time _tlmTime = Fw::Time()
552  );
553 
554  protected:
555 
556  // ----------------------------------------------------------------------
557  // Time
558  // ----------------------------------------------------------------------
559 
563  Fw::Time getTime() const;
564 
565  private:
566 
567  // ----------------------------------------------------------------------
568  // Message dispatch functions
569  // ----------------------------------------------------------------------
570 
572  virtual MsgDispatchStatus doDispatch();
573 
574  private:
575 
576  // ----------------------------------------------------------------------
577  // Calls for messages received on typed input ports
578  // ----------------------------------------------------------------------
579 
581  static void m_p_CycleIn_in(
582  Fw::PassiveComponentBase* callComp,
583  FwIndexType portNum,
584  Os::RawTime& cycleStart
585  );
586 
588  static void m_p_PingIn_in(
589  Fw::PassiveComponentBase* callComp,
590  FwIndexType portNum,
591  U32 key
592  );
593 
594  private:
595 
596  // ----------------------------------------------------------------------
597  // Invocation functions for special output ports
598  // ----------------------------------------------------------------------
599 
601  void Log_out(
602  FwIndexType portNum,
603  FwEventIdType id,
604  Fw::Time& timeTag,
605  const Fw::LogSeverity& severity,
606  Fw::LogBuffer& args
607  ) const;
608 
609 #if FW_ENABLE_TEXT_LOGGING
610 
612  void LogText_out(
613  FwIndexType portNum,
614  FwEventIdType id,
615  Fw::Time& timeTag,
616  const Fw::LogSeverity& severity,
617  Fw::TextLogString& text
618  ) const;
619 
620 #endif
621 
623  void Time_out(
624  FwIndexType portNum,
625  Fw::Time& time
626  ) const;
627 
629  void Tlm_out(
630  FwIndexType portNum,
631  FwChanIdType id,
632  Fw::Time& timeTag,
633  Fw::TlmBuffer& val
634  ) const;
635 
636 #if !FW_DIRECT_PORT_CALLS
637 
638  private:
639 
640  // ----------------------------------------------------------------------
641  // Typed input ports
642  // ----------------------------------------------------------------------
643 
645  Svc::InputCyclePort m_CycleIn_InputPort[NUM_CYCLEIN_INPUT_PORTS];
646 
648  Svc::InputPingPort m_PingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
649 
650 #endif
651 
652 #if !FW_DIRECT_PORT_CALLS
653 
654  private:
655 
656  // ----------------------------------------------------------------------
657  // Special output ports
658  // ----------------------------------------------------------------------
659 
661  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
662 
663 #if FW_ENABLE_TEXT_LOGGING == 1
664 
666  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
667 
668 #endif
669 
671  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
672 
674  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
675 
676 #endif
677 
678 #if !FW_DIRECT_PORT_CALLS
679 
680  private:
681 
682  // ----------------------------------------------------------------------
683  // Typed output ports
684  // ----------------------------------------------------------------------
685 
687  Svc::OutputPingPort m_PingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
688 
690  Svc::OutputSchedPort m_RateGroupMemberOut_OutputPort[NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS];
691 
692 #endif
693 
694  private:
695 
696  // ----------------------------------------------------------------------
697  // Counter values for event throttling
698  // ----------------------------------------------------------------------
699 
701  std::atomic<FwIndexType> m_RateGroupTimeGetErrorThrottle;
702 
703  private:
704 
705  // ----------------------------------------------------------------------
706  // First update flags for telemetry channels
707  // ----------------------------------------------------------------------
708 
710  bool m_first_update_RgMaxTime = true;
711 
713  bool m_first_update_RgCycleSlips = true;
714 
715  private:
716 
717  // ----------------------------------------------------------------------
718  // Last value storage for telemetry channels
719  // ----------------------------------------------------------------------
720 
722  U32 m_last_RgMaxTime = {};
723 
725  U32 m_last_RgCycleSlips = {};
726 
727  };
728 
729 }
730 
731 #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())
Warning event that rate group has had a cycle slip.
friend class ActiveRateGroupTesterBase
Friend class tester to support autocoded test harness.
FPP shadow-enum representing Os::RawTime::Status.
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.
I32 FwEnumStoreType
static constexpr FwIndexType getNum_Log_OutputPorts()
void log_WARNING_HI_RateGroupTimeGetError(const Os::RawTimeStatus &status)
void PingOut_out(FwIndexType portNum, U32 key) const
Invoke output port PingOut.
Warning event that reading the cycle end time failed.
bool isConnected_Tlm_OutputPort(FwIndexType portNum) const
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.
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].
void init()
Object initializer.
Definition: ObjBase.cpp:24
ActiveRateGroupComponentBase(const char *compName="")
Construct ActiveRateGroupComponentBase object.
bool isConnected_Time_OutputPort(FwIndexType portNum) const
void set_RateGroupMemberOut_OutputPort(FwIndexType portNum, Svc::InputSchedPort *port)
Connect port to RateGroupMemberOut[portNum].
FwIdType FwEventIdType
The type of an event identifier.
bool isConnected_PingOut_OutputPort(FwIndexType portNum) const
void log_WARNING_HI_RateGroupTimeGetError_ThrottleClear()
Reset throttle value for RateGroupTimeGetError.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
static constexpr FwIndexType getNum_PingOut_OutputPorts()
void tlmWrite_RgMaxTime(U32 arg, Fw::Time _tlmTime=Fw::Time())
Enum representing event severity.
bool isConnected_Log_OutputPort(FwIndexType portNum) const
void RateGroupMemberOut_out(FwIndexType portNum, U32 context) const
Invoke output port RateGroupMemberOut.
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[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()
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
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_RateGroupMemberOut_OutputPort(FwIndexType portNum) const
Svc::InputCyclePort * get_CycleIn_InputPort(FwIndexType portNum)
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.