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"
27 #include "Svc/Ping/PingPortAc.hpp"
29 
30 namespace Svc {
31 
38  {
39 
40  // ----------------------------------------------------------------------
41  // Friend classes
42  // ----------------------------------------------------------------------
43 
47  friend class ActiveRateGroupTester;
48 
49  protected:
50 
51  // ----------------------------------------------------------------------
52  // Constants
53  // ----------------------------------------------------------------------
54 
56  enum {
59  };
60 
62  enum {
67  };
68 
70  enum {
73  };
74 
76  enum {
79  };
80 
82  enum {
85  };
86 
87  public:
88 
89  // ----------------------------------------------------------------------
90  // Component initialization
91  // ----------------------------------------------------------------------
92 
94  void init(
95  FwSizeType queueDepth,
96  FwEnumStoreType instance = 0
97  );
98 
99 #if !FW_DIRECT_PORT_CALLS
100 
101  public:
102 
103  // ----------------------------------------------------------------------
104  // Getters for typed input ports
105  // ----------------------------------------------------------------------
106 
111  FwIndexType portNum
112  );
113 
118  FwIndexType portNum
119  );
120 
121 #endif
122 
123 #if !FW_DIRECT_PORT_CALLS
124 
125  public:
126 
127  // ----------------------------------------------------------------------
128  // Connect input ports to special output ports
129  // ----------------------------------------------------------------------
130 
132  void set_Log_OutputPort(
133  FwIndexType portNum,
134  Fw::InputLogPort* port
135  );
136 
137 #if FW_ENABLE_TEXT_LOGGING == 1
138 
140  void set_LogText_OutputPort(
141  FwIndexType portNum,
142  Fw::InputLogTextPort* port
143  );
144 
145 #endif
146 
148  void set_Time_OutputPort(
149  FwIndexType portNum,
150  Fw::InputTimePort* port
151  );
152 
154  void set_Tlm_OutputPort(
155  FwIndexType portNum,
156  Fw::InputTlmPort* port
157  );
158 
159 #endif
160 
161 #if !FW_DIRECT_PORT_CALLS
162 
163  public:
164 
165  // ----------------------------------------------------------------------
166  // Connect typed input ports to typed output ports
167  // ----------------------------------------------------------------------
168 
171  FwIndexType portNum,
172  Svc::InputPingPort* port
173  );
174 
177  FwIndexType portNum,
178  Svc::InputSchedPort* port
179  );
180 
181 #endif
182 
183 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
184 
185  public:
186 
187  // ----------------------------------------------------------------------
188  // Connect serial input ports to special output ports
189  // ----------------------------------------------------------------------
190 
192  void set_Log_OutputPort(
193  FwIndexType portNum,
194  Fw::InputSerializePort* port
195  );
196 
197 #if FW_ENABLE_TEXT_LOGGING == 1
198 
200  void set_LogText_OutputPort(
201  FwIndexType portNum,
202  Fw::InputSerializePort* port
203  );
204 
205 #endif
206 
208  void set_Time_OutputPort(
209  FwIndexType portNum,
210  Fw::InputSerializePort* port
211  );
212 
214  void set_Tlm_OutputPort(
215  FwIndexType portNum,
216  Fw::InputSerializePort* port
217  );
218 
219 #endif
220 
221 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
222 
223  public:
224 
225  // ----------------------------------------------------------------------
226  // Connect serial input ports to typed output ports
227  // ----------------------------------------------------------------------
228 
231  FwIndexType portNum,
232  Fw::InputSerializePort* port
233  );
234 
237  FwIndexType portNum,
238  Fw::InputSerializePort* port
239  );
240 
241 #endif
242 
243  protected:
244 
245  // ----------------------------------------------------------------------
246  // Component construction and destruction
247  // ----------------------------------------------------------------------
248 
251  const char* compName = ""
252  );
253 
256 
257  protected:
258 
259  // ----------------------------------------------------------------------
260  // Getters for numbers of typed input ports
261  // ----------------------------------------------------------------------
262 
268  }
269 
274  return NUM_PINGIN_INPUT_PORTS;
275  }
276 
277  protected:
278 
279  // ----------------------------------------------------------------------
280  // Getters for numbers of special output ports
281  // ----------------------------------------------------------------------
282 
286  static constexpr FwIndexType getNum_Log_OutputPorts() {
287  return NUM_LOG_OUTPUT_PORTS;
288  }
289 
290 #if FW_ENABLE_TEXT_LOGGING == 1
291 
295  static constexpr FwIndexType getNum_LogText_OutputPorts() {
297  }
298 
299 #endif
300 
305  return NUM_TIME_OUTPUT_PORTS;
306  }
307 
311  static constexpr FwIndexType getNum_Tlm_OutputPorts() {
312  return NUM_TLM_OUTPUT_PORTS;
313  }
314 
315  protected:
316 
317  // ----------------------------------------------------------------------
318  // Getters for numbers of typed output ports
319  // ----------------------------------------------------------------------
320 
326  }
327 
333  }
334 
335  protected:
336 
337  // ----------------------------------------------------------------------
338  // Connection status queries for special output ports
339  // ----------------------------------------------------------------------
340 
345  FwIndexType portNum
346  ) const;
347 
348 #if FW_ENABLE_TEXT_LOGGING == 1
349 
353  bool isConnected_LogText_OutputPort(
354  FwIndexType portNum
355  ) const;
356 
357 #endif
358 
363  FwIndexType portNum
364  ) const;
365 
370  FwIndexType portNum
371  ) const;
372 
373  protected:
374 
375  // ----------------------------------------------------------------------
376  // Connection status queries for typed output ports
377  // ----------------------------------------------------------------------
378 
383  FwIndexType portNum
384  ) const;
385 
390  FwIndexType portNum
391  ) const;
392 
393  protected:
394 
395  // ----------------------------------------------------------------------
396  // Handlers to implement for typed input ports
397  // ----------------------------------------------------------------------
398 
400  virtual void CycleIn_handler(
401  FwIndexType portNum,
402  Os::RawTime& cycleStart
403  ) = 0;
404 
406  virtual void PingIn_handler(
407  FwIndexType portNum,
408  U32 key
409  ) = 0;
410 
411 #if FW_DIRECT_PORT_CALLS
412  public:
413 #else
414  protected:
415 #endif
416 
417  // ----------------------------------------------------------------------
418  // Port handler base-class functions for typed input ports
419  //
420  // Call these functions directly to bypass the corresponding ports
421  // ----------------------------------------------------------------------
422 
424  void CycleIn_handlerBase(
425  FwIndexType portNum,
426  Os::RawTime& cycleStart
427  );
428 
430  void PingIn_handlerBase(
431  FwIndexType portNum,
432  U32 key
433  );
434 
435  protected:
436 
437  // ----------------------------------------------------------------------
438  // Pre-message hooks for typed async input ports
439  //
440  // Each of these functions is invoked just before processing a message
441  // on the corresponding port. By default, they do nothing. You can
442  // override them to provide specific pre-message behavior.
443  // ----------------------------------------------------------------------
444 
446  virtual void CycleIn_preMsgHook(
447  FwIndexType portNum,
448  Os::RawTime& cycleStart
449  );
450 
452  virtual void PingIn_preMsgHook(
453  FwIndexType portNum,
454  U32 key
455  );
456 
457  protected:
458 
459  // ----------------------------------------------------------------------
460  // Invocation functions for typed output ports
461  // ----------------------------------------------------------------------
462 
464  void PingOut_out(
465  FwIndexType portNum,
466  U32 key
467  ) const;
468 
471  FwIndexType portNum,
472  U32 context
473  ) const;
474 
475  protected:
476 
477  // ----------------------------------------------------------------------
478  // Event logging functions
479  // ----------------------------------------------------------------------
480 
484  void log_DIAGNOSTIC_RateGroupStarted() const;
485 
490  U32 cycle
491  ) const;
492 
493  protected:
494 
495  // ----------------------------------------------------------------------
496  // Telemetry serialized write
497  // ----------------------------------------------------------------------
498 
503  void tlmWrite(
504  FwChanIdType id,
505  Fw::TlmBuffer& _tlmBuff,
506  Fw::Time _tlmTime = Fw::Time()
507  ) const;
508 
509  protected:
510 
511  // ----------------------------------------------------------------------
512  // Telemetry write functions
513  // ----------------------------------------------------------------------
514 
518  void tlmWrite_RgMaxTime(
519  U32 arg,
520  Fw::Time _tlmTime = Fw::Time()
521  );
522 
527  U32 arg,
528  Fw::Time _tlmTime = Fw::Time()
529  );
530 
531  protected:
532 
533  // ----------------------------------------------------------------------
534  // Time
535  // ----------------------------------------------------------------------
536 
540  Fw::Time getTime() const;
541 
542  private:
543 
544  // ----------------------------------------------------------------------
545  // Message dispatch functions
546  // ----------------------------------------------------------------------
547 
549  virtual MsgDispatchStatus doDispatch();
550 
551  private:
552 
553  // ----------------------------------------------------------------------
554  // Calls for messages received on typed input ports
555  // ----------------------------------------------------------------------
556 
558  static void m_p_CycleIn_in(
559  Fw::PassiveComponentBase* callComp,
560  FwIndexType portNum,
561  Os::RawTime& cycleStart
562  );
563 
565  static void m_p_PingIn_in(
566  Fw::PassiveComponentBase* callComp,
567  FwIndexType portNum,
568  U32 key
569  );
570 
571  private:
572 
573  // ----------------------------------------------------------------------
574  // Invocation functions for special output ports
575  // ----------------------------------------------------------------------
576 
578  void Log_out(
579  FwIndexType portNum,
580  FwEventIdType id,
581  Fw::Time& timeTag,
582  const Fw::LogSeverity& severity,
583  Fw::LogBuffer& args
584  ) const;
585 
586 #if FW_ENABLE_TEXT_LOGGING
587 
589  void LogText_out(
590  FwIndexType portNum,
591  FwEventIdType id,
592  Fw::Time& timeTag,
593  const Fw::LogSeverity& severity,
594  Fw::TextLogString& text
595  ) const;
596 
597 #endif
598 
600  void Time_out(
601  FwIndexType portNum,
602  Fw::Time& time
603  ) const;
604 
606  void Tlm_out(
607  FwIndexType portNum,
608  FwChanIdType id,
609  Fw::Time& timeTag,
610  Fw::TlmBuffer& val
611  ) const;
612 
613 #if !FW_DIRECT_PORT_CALLS
614 
615  private:
616 
617  // ----------------------------------------------------------------------
618  // Typed input ports
619  // ----------------------------------------------------------------------
620 
622  Svc::InputCyclePort m_CycleIn_InputPort[NUM_CYCLEIN_INPUT_PORTS];
623 
625  Svc::InputPingPort m_PingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
626 
627 #endif
628 
629 #if !FW_DIRECT_PORT_CALLS
630 
631  private:
632 
633  // ----------------------------------------------------------------------
634  // Special output ports
635  // ----------------------------------------------------------------------
636 
638  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
639 
640 #if FW_ENABLE_TEXT_LOGGING == 1
641 
643  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
644 
645 #endif
646 
648  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
649 
651  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
652 
653 #endif
654 
655 #if !FW_DIRECT_PORT_CALLS
656 
657  private:
658 
659  // ----------------------------------------------------------------------
660  // Typed output ports
661  // ----------------------------------------------------------------------
662 
664  Svc::OutputPingPort m_PingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
665 
667  Svc::OutputSchedPort m_RateGroupMemberOut_OutputPort[NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS];
668 
669 #endif
670 
671  private:
672 
673  // ----------------------------------------------------------------------
674  // First update flags for telemetry channels
675  // ----------------------------------------------------------------------
676 
678  bool m_first_update_RgMaxTime = true;
679 
681  bool m_first_update_RgCycleSlips = true;
682 
683  private:
684 
685  // ----------------------------------------------------------------------
686  // Last value storage for telemetry channels
687  // ----------------------------------------------------------------------
688 
690  U32 m_last_RgMaxTime = {};
691 
693  U32 m_last_RgCycleSlips = {};
694 
695  };
696 
697 }
698 
699 #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.
I32 FwEnumStoreType
static constexpr FwIndexType getNum_Log_OutputPorts()
Warning event that rate group has had a cycle slip.
void PingOut_out(FwIndexType portNum, U32 key) const
Invoke output port PingOut.
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
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.