F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
HealthComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title HealthComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for Health component base class
5 // ======================================================================
6 
7 #ifndef Svc_HealthComponentAc_HPP
8 #define Svc_HealthComponentAc_HPP
9 
10 #include "FpConfig.hpp"
11 #include "Fw/Cmd/CmdPortAc.hpp"
12 #include "Fw/Cmd/CmdRegPortAc.hpp"
14 #include "Fw/Cmd/CmdString.hpp"
16 #include "Fw/Log/LogPortAc.hpp"
17 #include "Fw/Log/LogString.hpp"
18 #if FW_ENABLE_TEXT_LOGGING == 1
19 #include "Fw/Log/LogTextPortAc.hpp"
20 #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"
30 
31 namespace Svc {
32 
39  {
40 
41  // ----------------------------------------------------------------------
42  // Friend classes
43  // ----------------------------------------------------------------------
44 
47 
48  PROTECTED:
49 
50  // ----------------------------------------------------------------------
51  // Constants
52  // ----------------------------------------------------------------------
53 
55  enum {
57  };
58 
60  enum {
63  };
64 
66  enum {
73  };
74 
76  enum {
79  };
80 
82  enum {
86  };
87 
89  enum {
98  };
99 
101  enum {
103  };
104 
105  public:
106 
107  // ----------------------------------------------------------------------
108  // Component initialization
109  // ----------------------------------------------------------------------
110 
112  void init(
113  FwSizeType queueDepth,
114  FwEnumStoreType instance = 0
115  );
116 
117  public:
118 
119  // ----------------------------------------------------------------------
120  // Getters for special input ports
121  // ----------------------------------------------------------------------
122 
127  FwIndexType portNum
128  );
129 
130  public:
131 
132  // ----------------------------------------------------------------------
133  // Getters for typed input ports
134  // ----------------------------------------------------------------------
135 
140  FwIndexType portNum
141  );
142 
147  FwIndexType portNum
148  );
149 
150  public:
151 
152  // ----------------------------------------------------------------------
153  // Connect input ports to special output ports
154  // ----------------------------------------------------------------------
155 
158  FwIndexType portNum,
159  Fw::InputCmdRegPort* port
160  );
161 
164  FwIndexType portNum,
166  );
167 
169  void set_Log_OutputPort(
170  FwIndexType portNum,
171  Fw::InputLogPort* port
172  );
173 
174 #if FW_ENABLE_TEXT_LOGGING == 1
175 
177  void set_LogText_OutputPort(
178  FwIndexType portNum,
179  Fw::InputLogTextPort* port
180  );
181 
182 #endif
183 
185  void set_Time_OutputPort(
186  FwIndexType portNum,
187  Fw::InputTimePort* port
188  );
189 
191  void set_Tlm_OutputPort(
192  FwIndexType portNum,
193  Fw::InputTlmPort* port
194  );
195 
196  public:
197 
198  // ----------------------------------------------------------------------
199  // Connect typed input ports to typed output ports
200  // ----------------------------------------------------------------------
201 
204  FwIndexType portNum,
205  Svc::InputPingPort* port
206  );
207 
210  FwIndexType portNum,
212  );
213 
214 #if FW_PORT_SERIALIZATION
215 
216  public:
217 
218  // ----------------------------------------------------------------------
219  // Connect serial input ports to special output ports
220  // ----------------------------------------------------------------------
221 
224  FwIndexType portNum,
225  Fw::InputSerializePort* port
226  );
227 
230  FwIndexType portNum,
231  Fw::InputSerializePort* port
232  );
233 
235  void set_Log_OutputPort(
236  FwIndexType portNum,
237  Fw::InputSerializePort* port
238  );
239 
240 #if FW_ENABLE_TEXT_LOGGING == 1
241 
243  void set_LogText_OutputPort(
244  FwIndexType portNum,
245  Fw::InputSerializePort* port
246  );
247 
248 #endif
249 
251  void set_Time_OutputPort(
252  FwIndexType portNum,
253  Fw::InputSerializePort* port
254  );
255 
257  void set_Tlm_OutputPort(
258  FwIndexType portNum,
259  Fw::InputSerializePort* port
260  );
261 
262 #endif
263 
264 #if FW_PORT_SERIALIZATION
265 
266  public:
267 
268  // ----------------------------------------------------------------------
269  // Connect serial input ports to typed output ports
270  // ----------------------------------------------------------------------
271 
274  FwIndexType portNum,
275  Fw::InputSerializePort* port
276  );
277 
280  FwIndexType portNum,
281  Fw::InputSerializePort* port
282  );
283 
284 #endif
285 
286  public:
287 
288  // ----------------------------------------------------------------------
289  // Command registration
290  // ----------------------------------------------------------------------
291 
295  void regCommands();
296 
297  PROTECTED:
298 
299  // ----------------------------------------------------------------------
300  // Component construction and destruction
301  // ----------------------------------------------------------------------
302 
305  const char* compName = ""
306  );
307 
309  virtual ~HealthComponentBase();
310 
311  PROTECTED:
312 
313  // ----------------------------------------------------------------------
314  // Getters for numbers of special input ports
315  // ----------------------------------------------------------------------
316 
321 
322  PROTECTED:
323 
324  // ----------------------------------------------------------------------
325  // Getters for numbers of typed input ports
326  // ----------------------------------------------------------------------
327 
332 
337 
338  PROTECTED:
339 
340  // ----------------------------------------------------------------------
341  // Getters for numbers of special output ports
342  // ----------------------------------------------------------------------
343 
348 
353 
358 
359 #if FW_ENABLE_TEXT_LOGGING == 1
360 
364  FwIndexType getNum_LogText_OutputPorts() const;
365 
366 #endif
367 
372 
377 
378  PROTECTED:
379 
380  // ----------------------------------------------------------------------
381  // Getters for numbers of typed output ports
382  // ----------------------------------------------------------------------
383 
388 
393 
394  PROTECTED:
395 
396  // ----------------------------------------------------------------------
397  // Connection status queries for special output ports
398  // ----------------------------------------------------------------------
399 
404  FwIndexType portNum
405  );
406 
411  FwIndexType portNum
412  );
413 
418  FwIndexType portNum
419  );
420 
421 #if FW_ENABLE_TEXT_LOGGING == 1
422 
426  bool isConnected_LogText_OutputPort(
427  FwIndexType portNum
428  );
429 
430 #endif
431 
436  FwIndexType portNum
437  );
438 
443  FwIndexType portNum
444  );
445 
446  PROTECTED:
447 
448  // ----------------------------------------------------------------------
449  // Connection status queries for typed output ports
450  // ----------------------------------------------------------------------
451 
456  FwIndexType portNum
457  );
458 
463  FwIndexType portNum
464  );
465 
466  PROTECTED:
467 
468  // ----------------------------------------------------------------------
469  // Handlers to implement for typed input ports
470  // ----------------------------------------------------------------------
471 
473  virtual void PingReturn_handler(
474  FwIndexType portNum,
475  U32 key
476  ) = 0;
477 
479  virtual void Run_handler(
480  FwIndexType portNum,
481  U32 context
482  ) = 0;
483 
484  PROTECTED:
485 
486  // ----------------------------------------------------------------------
487  // Port handler base-class functions for typed input ports
488  //
489  // Call these functions directly to bypass the corresponding ports
490  // ----------------------------------------------------------------------
491 
494  FwIndexType portNum,
495  U32 key
496  );
497 
499  void Run_handlerBase(
500  FwIndexType portNum,
501  U32 context
502  );
503 
504  PROTECTED:
505 
506  // ----------------------------------------------------------------------
507  // Pre-message hooks for typed async input ports
508  //
509  // Each of these functions is invoked just before processing a message
510  // on the corresponding port. By default, they do nothing. You can
511  // override them to provide specific pre-message behavior.
512  // ----------------------------------------------------------------------
513 
515  virtual void PingReturn_preMsgHook(
516  FwIndexType portNum,
517  U32 key
518  );
519 
520  PROTECTED:
521 
522  // ----------------------------------------------------------------------
523  // Invocation functions for typed output ports
524  // ----------------------------------------------------------------------
525 
527  void PingSend_out(
528  FwIndexType portNum,
529  U32 key
530  );
531 
533  void WdogStroke_out(
534  FwIndexType portNum,
535  U32 code
536  );
537 
538  PROTECTED:
539 
540  // ----------------------------------------------------------------------
541  // Command response
542  // ----------------------------------------------------------------------
543 
545  void cmdResponse_out(
546  FwOpcodeType opCode,
547  U32 cmdSeq,
548  Fw::CmdResponse response
549  );
550 
551  PROTECTED:
552 
553  // ----------------------------------------------------------------------
554  // Command handlers to implement
555  // ----------------------------------------------------------------------
556 
561  FwOpcodeType opCode,
562  U32 cmdSeq,
563  Fw::Enabled enable
564  ) = 0;
565 
570  FwOpcodeType opCode,
571  U32 cmdSeq,
572  const Fw::CmdStringArg& entry,
573  Fw::Enabled enable
574  ) = 0;
575 
580  FwOpcodeType opCode,
581  U32 cmdSeq,
582  const Fw::CmdStringArg& entry,
583  U32 warningValue,
584  U32 fatalValue
585  ) = 0;
586 
587  PROTECTED:
588 
589  // ----------------------------------------------------------------------
590  // Command handler base-class functions
591  //
592  // Call these functions directly to bypass the command input port
593  // ----------------------------------------------------------------------
594 
599  FwOpcodeType opCode,
600  U32 cmdSeq,
601  Fw::CmdArgBuffer& args
602  );
603 
608  FwOpcodeType opCode,
609  U32 cmdSeq,
610  Fw::CmdArgBuffer& args
611  );
612 
617  FwOpcodeType opCode,
618  U32 cmdSeq,
619  Fw::CmdArgBuffer& args
620  );
621 
622  PROTECTED:
623 
624  // ----------------------------------------------------------------------
625  // Pre-message hooks for async commands
626  //
627  // Each of these functions is invoked just before processing the
628  // corresponding command. By default they do nothing. You can
629  // override them to provide specific pre-command behavior.
630  // ----------------------------------------------------------------------
631 
633  virtual void HLTH_ENABLE_preMsgHook(
634  FwOpcodeType opCode,
635  U32 cmdSeq
636  );
637 
639  virtual void HLTH_PING_ENABLE_preMsgHook(
640  FwOpcodeType opCode,
641  U32 cmdSeq
642  );
643 
645  virtual void HLTH_CHNG_PING_preMsgHook(
646  FwOpcodeType opCode,
647  U32 cmdSeq
648  );
649 
650  PROTECTED:
651 
652  // ----------------------------------------------------------------------
653  // Event logging functions
654  // ----------------------------------------------------------------------
655 
660  const Fw::StringBase& entry
661  );
662 
667  const Fw::StringBase& entry
668  );
669 
674  const Fw::StringBase& entry,
675  U32 badKey
676  );
677 
682  Fw::Enabled enabled
683  );
684 
689  Fw::Enabled enabled,
690  const Fw::StringBase& entry
691  );
692 
697  const Fw::StringBase& entry
698  );
699 
704  const Fw::StringBase& entry,
705  U32 warn,
706  U32 fatal
707  );
708 
713  const Fw::StringBase& entry,
714  U32 warn,
715  U32 fatal
716  );
717 
718  PROTECTED:
719 
720  // ----------------------------------------------------------------------
721  // Telemetry write functions
722  // ----------------------------------------------------------------------
723 
728  U32 arg,
729  Fw::Time _tlmTime = Fw::Time()
730  );
731 
732  PROTECTED:
733 
734  // ----------------------------------------------------------------------
735  // Time
736  // ----------------------------------------------------------------------
737 
741  Fw::Time getTime();
742 
743  PROTECTED:
744 
745  // ----------------------------------------------------------------------
746  // Message dispatch functions
747  // ----------------------------------------------------------------------
748 
750  virtual MsgDispatchStatus doDispatch();
751 
752  PRIVATE:
753 
754  // ----------------------------------------------------------------------
755  // Calls for messages received on special input ports
756  // ----------------------------------------------------------------------
757 
759  static void m_p_CmdDisp_in(
760  Fw::PassiveComponentBase* callComp,
761  FwIndexType portNum,
762  FwOpcodeType opCode,
763  U32 cmdSeq,
764  Fw::CmdArgBuffer& args
765  );
766 
767  PRIVATE:
768 
769  // ----------------------------------------------------------------------
770  // Calls for messages received on typed input ports
771  // ----------------------------------------------------------------------
772 
774  static void m_p_PingReturn_in(
775  Fw::PassiveComponentBase* callComp,
776  FwIndexType portNum,
777  U32 key
778  );
779 
781  static void m_p_Run_in(
782  Fw::PassiveComponentBase* callComp,
783  FwIndexType portNum,
784  U32 context
785  );
786 
787  PRIVATE:
788 
789  // ----------------------------------------------------------------------
790  // Special input ports
791  // ----------------------------------------------------------------------
792 
794  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
795 
796  PRIVATE:
797 
798  // ----------------------------------------------------------------------
799  // Typed input ports
800  // ----------------------------------------------------------------------
801 
803  Svc::InputPingPort m_PingReturn_InputPort[NUM_PINGRETURN_INPUT_PORTS];
804 
806  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
807 
808  PRIVATE:
809 
810  // ----------------------------------------------------------------------
811  // Special output ports
812  // ----------------------------------------------------------------------
813 
815  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
816 
819 
821  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
822 
823 #if FW_ENABLE_TEXT_LOGGING == 1
824 
826  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
827 
828 #endif
829 
831  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
832 
834  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
835 
836  PRIVATE:
837 
838  // ----------------------------------------------------------------------
839  // Typed output ports
840  // ----------------------------------------------------------------------
841 
843  Svc::OutputPingPort m_PingSend_OutputPort[NUM_PINGSEND_OUTPUT_PORTS];
844 
846  Svc::OutputWatchDogPort m_WdogStroke_OutputPort[NUM_WDOGSTROKE_OUTPUT_PORTS];
847 
848  };
849 
850 }
851 
852 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:64
U32 FwOpcodeType
Definition: FpConfig.h:91
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
C++-compatible configuration header for fprime configuration.
Enum representing a command response.
Enabled and disabled states.
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9
Auto-generated base for Health component.
bool isConnected_WdogStroke_OutputPort(FwIndexType portNum)
Svc::InputSchedPort * get_Run_InputPort(FwIndexType portNum)
Svc::InputPingPort * get_PingReturn_InputPort(FwIndexType portNum)
void log_FATAL_HLTH_PING_WRONG_KEY(const Fw::StringBase &entry, U32 badKey)
FwIndexType getNum_WdogStroke_OutputPorts() const
void WdogStroke_out(FwIndexType portNum, U32 code)
Invoke output port WdogStroke.
void tlmWrite_PingLateWarnings(U32 arg, Fw::Time _tlmTime=Fw::Time())
FwIndexType getNum_CmdStatus_OutputPorts() const
void set_PingSend_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to PingSend[portNum].
bool isConnected_Time_OutputPort(FwIndexType portNum)
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
bool isConnected_PingSend_OutputPort(FwIndexType portNum)
virtual MsgDispatchStatus doDispatch()
Called in the message loop to dispatch a message from the queue.
virtual void HLTH_PING_ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &entry, Fw::Enabled enable)=0
void HLTH_PING_ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void HLTH_CHNG_PING_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual void PingReturn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port PingReturn.
@ OPCODE_HLTH_CHNG_PING
Change ping value.
@ OPCODE_HLTH_ENABLE
A command to enable or disable health checks.
@ OPCODE_HLTH_PING_ENABLE
Ignore a particular ping entry.
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
void log_ACTIVITY_HI_HLTH_CHECK_PING(Fw::Enabled enabled, const Fw::StringBase &entry)
void PingReturn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port PingReturn.
virtual ~HealthComponentBase()
Destroy HealthComponentBase object.
virtual void PingReturn_handler(FwIndexType portNum, U32 key)=0
Handler for input port PingReturn.
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
void log_ACTIVITY_HI_HLTH_PING_UPDATED(const Fw::StringBase &entry, U32 warn, U32 fatal)
bool isConnected_Log_OutputPort(FwIndexType portNum)
FwIndexType getNum_CmdReg_OutputPorts() const
virtual void HLTH_ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::Enabled enable)=0
FwIndexType getNum_Time_OutputPorts() const
void HLTH_ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void log_WARNING_LO_HLTH_CHECK_LOOKUP_ERROR(const Fw::StringBase &entry)
void Run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port Run.
FwIndexType getNum_PingReturn_InputPorts() const
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
void log_ACTIVITY_HI_HLTH_CHECK_ENABLE(Fw::Enabled enabled)
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
FwIndexType getNum_CmdDisp_InputPorts() const
FwIndexType getNum_Tlm_OutputPorts() const
@ EVENTID_HLTH_PING_UPDATED
Report changed ping.
@ EVENTID_HLTH_CHECK_LOOKUP_ERROR
Entry was not found.
@ EVENTID_HLTH_CHECK_PING
Report a particular entry on or off.
@ EVENTID_HLTH_CHECK_ENABLE
Report checking turned on or off.
@ EVENTID_HLTH_PING_LATE
Declare FATAL since task is no longer responding.
@ EVENTID_HLTH_PING_INVALID_VALUES
Report changed ping.
@ EVENTID_HLTH_PING_WRONG_KEY
Declare FATAL since task is no longer responding.
@ EVENTID_HLTH_PING_WARN
Warn that a ping target is longer than the warning value.
void regCommands()
Register commands with the Command Dispatcher.
friend class HealthComponentBaseFriend
Friend class for white-box testing.
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
virtual void HLTH_CHNG_PING_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_CHNG_PING.
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
FwIndexType getNum_Run_InputPorts() const
FwIndexType getNum_Log_OutputPorts() const
virtual void HLTH_PING_ENABLE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_PING_ENABLE.
void set_WdogStroke_OutputPort(FwIndexType portNum, Svc::InputWatchDogPort *port)
Connect port to WdogStroke[portNum].
void log_WARNING_HI_HLTH_PING_INVALID_VALUES(const Fw::StringBase &entry, U32 warn, U32 fatal)
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
FwIndexType getNum_PingSend_OutputPorts() const
void PingSend_out(FwIndexType portNum, U32 key)
Invoke output port PingSend.
HealthComponentBase(const char *compName="")
Construct HealthComponentBase object.
@ CHANNELID_PINGLATEWARNINGS
Channel ID for PingLateWarnings.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
virtual void Run_handler(FwIndexType portNum, U32 context)=0
Handler for input port Run.
virtual void HLTH_ENABLE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_ENABLE.
void log_WARNING_HI_HLTH_PING_WARN(const Fw::StringBase &entry)
void log_FATAL_HLTH_PING_LATE(const Fw::StringBase &entry)
virtual void HLTH_CHNG_PING_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &entry, U32 warningValue, U32 fatalValue)=0