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
19 #if !FW_DIRECT_PORT_CALLS
21 #endif
22 #if !FW_DIRECT_PORT_CALLS
24 #endif
25 #include "Fw/Time/TimePortAc.hpp"
26 #include "Fw/Tlm/TlmPortAc.hpp"
27 #include "Fw/Tlm/TlmString.hpp"
29 #include "Svc/Ping/PingPortAc.hpp"
31 
32 namespace Svc {
33 
40  {
41 
42  // ----------------------------------------------------------------------
43  // Friend classes
44  // ----------------------------------------------------------------------
45 
49  friend class ActiveRateGroupTester;
50 
51  protected:
52 
53  // ----------------------------------------------------------------------
54  // Constants
55  // ----------------------------------------------------------------------
56 
58  enum {
61  };
62 
64  enum {
69  };
70 
72  enum {
75  };
76 
78  enum {
81  };
82 
84  enum {
87  };
88 
89  public:
90 
91  // ----------------------------------------------------------------------
92  // Component initialization
93  // ----------------------------------------------------------------------
94 
96  void init(
97  FwSizeType queueDepth,
98  FwEnumStoreType instance = 0
99  );
100 
101 #if !FW_DIRECT_PORT_CALLS
102 
103  public:
104 
105  // ----------------------------------------------------------------------
106  // Getters for typed input ports
107  // ----------------------------------------------------------------------
108 
113  FwIndexType portNum
114  );
115 
120  FwIndexType portNum
121  );
122 
123 #endif
124 
125 #if !FW_DIRECT_PORT_CALLS
126 
127  public:
128 
129  // ----------------------------------------------------------------------
130  // Connect input ports to special output ports
131  // ----------------------------------------------------------------------
132 
134  void set_Log_OutputPort(
135  FwIndexType portNum,
136  Fw::InputLogPort* port
137  );
138 
139 #if FW_ENABLE_TEXT_LOGGING == 1
140 
142  void set_LogText_OutputPort(
143  FwIndexType portNum,
144  Fw::InputLogTextPort* port
145  );
146 
147 #endif
148 
150  void set_Time_OutputPort(
151  FwIndexType portNum,
152  Fw::InputTimePort* port
153  );
154 
156  void set_Tlm_OutputPort(
157  FwIndexType portNum,
158  Fw::InputTlmPort* port
159  );
160 
161 #endif
162 
163 #if !FW_DIRECT_PORT_CALLS
164 
165  public:
166 
167  // ----------------------------------------------------------------------
168  // Connect typed input ports to typed output ports
169  // ----------------------------------------------------------------------
170 
173  FwIndexType portNum,
174  Svc::InputPingPort* port
175  );
176 
179  FwIndexType portNum,
180  Svc::InputSchedPort* port
181  );
182 
183 #endif
184 
185 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
186 
187  public:
188 
189  // ----------------------------------------------------------------------
190  // Connect serial input ports to special output ports
191  // ----------------------------------------------------------------------
192 
194  void set_Log_OutputPort(
195  FwIndexType portNum,
196  Fw::InputSerializePort* port
197  );
198 
199 #if FW_ENABLE_TEXT_LOGGING == 1
200 
202  void set_LogText_OutputPort(
203  FwIndexType portNum,
204  Fw::InputSerializePort* port
205  );
206 
207 #endif
208 
210  void set_Time_OutputPort(
211  FwIndexType portNum,
212  Fw::InputSerializePort* port
213  );
214 
216  void set_Tlm_OutputPort(
217  FwIndexType portNum,
218  Fw::InputSerializePort* port
219  );
220 
221 #endif
222 
223 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
224 
225  public:
226 
227  // ----------------------------------------------------------------------
228  // Connect serial input ports to typed output ports
229  // ----------------------------------------------------------------------
230 
233  FwIndexType portNum,
234  Fw::InputSerializePort* port
235  );
236 
239  FwIndexType portNum,
240  Fw::InputSerializePort* port
241  );
242 
243 #endif
244 
245  protected:
246 
247  // ----------------------------------------------------------------------
248  // Component construction and destruction
249  // ----------------------------------------------------------------------
250 
253  const char* compName = ""
254  );
255 
258 
259  protected:
260 
261  // ----------------------------------------------------------------------
262  // Getters for numbers of typed input ports
263  // ----------------------------------------------------------------------
264 
270  }
271 
276  return NUM_PINGIN_INPUT_PORTS;
277  }
278 
279  protected:
280 
281  // ----------------------------------------------------------------------
282  // Getters for numbers of special output ports
283  // ----------------------------------------------------------------------
284 
288  static constexpr FwIndexType getNum_Log_OutputPorts() {
289  return NUM_LOG_OUTPUT_PORTS;
290  }
291 
292 #if FW_ENABLE_TEXT_LOGGING == 1
293 
297  static constexpr FwIndexType getNum_LogText_OutputPorts() {
299  }
300 
301 #endif
302 
307  return NUM_TIME_OUTPUT_PORTS;
308  }
309 
313  static constexpr FwIndexType getNum_Tlm_OutputPorts() {
314  return NUM_TLM_OUTPUT_PORTS;
315  }
316 
317  protected:
318 
319  // ----------------------------------------------------------------------
320  // Getters for numbers of typed output ports
321  // ----------------------------------------------------------------------
322 
328  }
329 
335  }
336 
337  protected:
338 
339  // ----------------------------------------------------------------------
340  // Connection status queries for special output ports
341  // ----------------------------------------------------------------------
342 
347  FwIndexType portNum
348  ) const;
349 
350 #if FW_ENABLE_TEXT_LOGGING == 1
351 
355  bool isConnected_LogText_OutputPort(
356  FwIndexType portNum
357  ) const;
358 
359 #endif
360 
365  FwIndexType portNum
366  ) const;
367 
372  FwIndexType portNum
373  ) const;
374 
375  protected:
376 
377  // ----------------------------------------------------------------------
378  // Connection status queries for typed output ports
379  // ----------------------------------------------------------------------
380 
385  FwIndexType portNum
386  ) const;
387 
392  FwIndexType portNum
393  ) const;
394 
395  protected:
396 
397  // ----------------------------------------------------------------------
398  // Handlers to implement for typed input ports
399  // ----------------------------------------------------------------------
400 
402  virtual void CycleIn_handler(
403  FwIndexType portNum,
404  Os::RawTime& cycleStart
405  ) = 0;
406 
408  virtual void PingIn_handler(
409  FwIndexType portNum,
410  U32 key
411  ) = 0;
412 
413 #if FW_DIRECT_PORT_CALLS
414  public:
415 #else
416  protected:
417 #endif
418 
419  // ----------------------------------------------------------------------
420  // Port handler base-class functions for typed input ports
421  //
422  // Call these functions directly to bypass the corresponding ports
423  // ----------------------------------------------------------------------
424 
426  void CycleIn_handlerBase(
427  FwIndexType portNum,
428  Os::RawTime& cycleStart
429  );
430 
432  void PingIn_handlerBase(
433  FwIndexType portNum,
434  U32 key
435  );
436 
437  protected:
438 
439  // ----------------------------------------------------------------------
440  // Pre-message hooks for typed async input ports
441  //
442  // Each of these functions is invoked just before processing a message
443  // on the corresponding port. By default, they do nothing. You can
444  // override them to provide specific pre-message behavior.
445  // ----------------------------------------------------------------------
446 
448  virtual void CycleIn_preMsgHook(
449  FwIndexType portNum,
450  Os::RawTime& cycleStart
451  );
452 
454  virtual void PingIn_preMsgHook(
455  FwIndexType portNum,
456  U32 key
457  );
458 
459  protected:
460 
461  // ----------------------------------------------------------------------
462  // Invocation functions for typed output ports
463  // ----------------------------------------------------------------------
464 
466  void PingOut_out(
467  FwIndexType portNum,
468  U32 key
469  ) const;
470 
473  FwIndexType portNum,
474  U32 context
475  ) const;
476 
477  protected:
478 
479  // ----------------------------------------------------------------------
480  // Event logging functions
481  // ----------------------------------------------------------------------
482 
486  void log_DIAGNOSTIC_RateGroupStarted() const;
487 
492  U32 cycle
493  ) const;
494 
495  protected:
496 
497  // ----------------------------------------------------------------------
498  // Telemetry write functions
499  // ----------------------------------------------------------------------
500 
504  void tlmWrite_RgMaxTime(
505  U32 arg,
506  Fw::Time _tlmTime = Fw::Time()
507  );
508 
513  U32 arg,
514  Fw::Time _tlmTime = Fw::Time()
515  );
516 
517  protected:
518 
519  // ----------------------------------------------------------------------
520  // Time
521  // ----------------------------------------------------------------------
522 
526  Fw::Time getTime() const;
527 
528  private:
529 
530  // ----------------------------------------------------------------------
531  // Message dispatch functions
532  // ----------------------------------------------------------------------
533 
535  virtual MsgDispatchStatus doDispatch();
536 
537  private:
538 
539  // ----------------------------------------------------------------------
540  // Calls for messages received on typed input ports
541  // ----------------------------------------------------------------------
542 
544  static void m_p_CycleIn_in(
545  Fw::PassiveComponentBase* callComp,
546  FwIndexType portNum,
547  Os::RawTime& cycleStart
548  );
549 
551  static void m_p_PingIn_in(
552  Fw::PassiveComponentBase* callComp,
553  FwIndexType portNum,
554  U32 key
555  );
556 
557  private:
558 
559  // ----------------------------------------------------------------------
560  // Invocation functions for special output ports
561  // ----------------------------------------------------------------------
562 
564  void Log_out(
565  FwIndexType portNum,
566  FwEventIdType id,
567  Fw::Time& timeTag,
568  const Fw::LogSeverity& severity,
569  Fw::LogBuffer& args
570  ) const;
571 
572 #if FW_ENABLE_TEXT_LOGGING
573 
575  void LogText_out(
576  FwIndexType portNum,
577  FwEventIdType id,
578  Fw::Time& timeTag,
579  const Fw::LogSeverity& severity,
580  Fw::TextLogString& text
581  ) const;
582 
583 #endif
584 
586  void Time_out(
587  FwIndexType portNum,
588  Fw::Time& time
589  ) const;
590 
592  void Tlm_out(
593  FwIndexType portNum,
594  FwChanIdType id,
595  Fw::Time& timeTag,
596  Fw::TlmBuffer& val
597  ) const;
598 
599 #if !FW_DIRECT_PORT_CALLS
600 
601  private:
602 
603  // ----------------------------------------------------------------------
604  // Typed input ports
605  // ----------------------------------------------------------------------
606 
608  Svc::InputCyclePort m_CycleIn_InputPort[NUM_CYCLEIN_INPUT_PORTS];
609 
611  Svc::InputPingPort m_PingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
612 
613 #endif
614 
615 #if !FW_DIRECT_PORT_CALLS
616 
617  private:
618 
619  // ----------------------------------------------------------------------
620  // Special output ports
621  // ----------------------------------------------------------------------
622 
624  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
625 
626 #if FW_ENABLE_TEXT_LOGGING == 1
627 
629  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
630 
631 #endif
632 
634  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
635 
637  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
638 
639 #endif
640 
641 #if !FW_DIRECT_PORT_CALLS
642 
643  private:
644 
645  // ----------------------------------------------------------------------
646  // Typed output ports
647  // ----------------------------------------------------------------------
648 
650  Svc::OutputPingPort m_PingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
651 
653  Svc::OutputSchedPort m_RateGroupMemberOut_OutputPort[NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS];
654 
655 #endif
656 
657  private:
658 
659  // ----------------------------------------------------------------------
660  // First update flags for telemetry channels
661  // ----------------------------------------------------------------------
662 
664  bool m_first_update_RgMaxTime = true;
665 
667  bool m_first_update_RgCycleSlips = true;
668 
669  private:
670 
671  // ----------------------------------------------------------------------
672  // Last value storage for telemetry channels
673  // ----------------------------------------------------------------------
674 
676  U32 m_last_RgMaxTime = {};
677 
679  U32 m_last_RgCycleSlips = {};
680 
681  };
682 
683 }
684 
685 #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()
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.
Warning event that rate group has had a cycle slip.
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()
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.