F´ Flight Software - C/C++ Documentation
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 <atomic>
11 
12 #include "Fw/Cmd/CmdPortAc.hpp"
13 #include "Fw/Cmd/CmdRegPortAc.hpp"
15 #include "Fw/Cmd/CmdString.hpp"
17 #include "Fw/FPrimeBasicTypes.hpp"
18 #include "Fw/Log/LogPortAc.hpp"
19 #include "Fw/Log/LogString.hpp"
20 #if FW_ENABLE_TEXT_LOGGING == 1
21 #include "Fw/Log/LogTextPortAc.hpp"
22 #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"
32 
33 namespace Svc {
34 
41  {
42 
43  // ----------------------------------------------------------------------
44  // Friend classes
45  // ----------------------------------------------------------------------
46 
50  friend class HealthTesterBase;
51 
52  PROTECTED:
53 
54  // ----------------------------------------------------------------------
55  // Constants
56  // ----------------------------------------------------------------------
57 
59  enum {
61  };
62 
64  enum {
67  };
68 
70  enum {
77  };
78 
80  enum {
83  };
84 
86  enum {
90  };
91 
93  enum {
102  };
103 
105  enum {
107  };
108 
109  public:
110 
111  // ----------------------------------------------------------------------
112  // Component initialization
113  // ----------------------------------------------------------------------
114 
116  void init(
117  FwSizeType queueDepth,
118  FwEnumStoreType instance = 0
119  );
120 
121  public:
122 
123  // ----------------------------------------------------------------------
124  // Getters for special input ports
125  // ----------------------------------------------------------------------
126 
131  FwIndexType portNum
132  );
133 
134  public:
135 
136  // ----------------------------------------------------------------------
137  // Getters for typed input ports
138  // ----------------------------------------------------------------------
139 
144  FwIndexType portNum
145  );
146 
151  FwIndexType portNum
152  );
153 
154  public:
155 
156  // ----------------------------------------------------------------------
157  // Connect input ports to special output ports
158  // ----------------------------------------------------------------------
159 
162  FwIndexType portNum,
163  Fw::InputCmdRegPort* port
164  );
165 
168  FwIndexType portNum,
170  );
171 
173  void set_Log_OutputPort(
174  FwIndexType portNum,
175  Fw::InputLogPort* port
176  );
177 
178 #if FW_ENABLE_TEXT_LOGGING == 1
179 
181  void set_LogText_OutputPort(
182  FwIndexType portNum,
183  Fw::InputLogTextPort* port
184  );
185 
186 #endif
187 
189  void set_Time_OutputPort(
190  FwIndexType portNum,
191  Fw::InputTimePort* port
192  );
193 
195  void set_Tlm_OutputPort(
196  FwIndexType portNum,
197  Fw::InputTlmPort* port
198  );
199 
200  public:
201 
202  // ----------------------------------------------------------------------
203  // Connect typed input ports to typed output ports
204  // ----------------------------------------------------------------------
205 
208  FwIndexType portNum,
209  Svc::InputPingPort* port
210  );
211 
214  FwIndexType portNum,
216  );
217 
218 #if FW_PORT_SERIALIZATION
219 
220  public:
221 
222  // ----------------------------------------------------------------------
223  // Connect serial input ports to special output ports
224  // ----------------------------------------------------------------------
225 
228  FwIndexType portNum,
229  Fw::InputSerializePort* port
230  );
231 
234  FwIndexType portNum,
235  Fw::InputSerializePort* port
236  );
237 
239  void set_Log_OutputPort(
240  FwIndexType portNum,
241  Fw::InputSerializePort* port
242  );
243 
244 #if FW_ENABLE_TEXT_LOGGING == 1
245 
247  void set_LogText_OutputPort(
248  FwIndexType portNum,
249  Fw::InputSerializePort* port
250  );
251 
252 #endif
253 
255  void set_Time_OutputPort(
256  FwIndexType portNum,
257  Fw::InputSerializePort* port
258  );
259 
261  void set_Tlm_OutputPort(
262  FwIndexType portNum,
263  Fw::InputSerializePort* port
264  );
265 
266 #endif
267 
268 #if FW_PORT_SERIALIZATION
269 
270  public:
271 
272  // ----------------------------------------------------------------------
273  // Connect serial input ports to typed output ports
274  // ----------------------------------------------------------------------
275 
278  FwIndexType portNum,
279  Fw::InputSerializePort* port
280  );
281 
284  FwIndexType portNum,
285  Fw::InputSerializePort* port
286  );
287 
288 #endif
289 
290  public:
291 
292  // ----------------------------------------------------------------------
293  // Command registration
294  // ----------------------------------------------------------------------
295 
299  void regCommands();
300 
301  PROTECTED:
302 
303  // ----------------------------------------------------------------------
304  // Component construction and destruction
305  // ----------------------------------------------------------------------
306 
309  const char* compName = ""
310  );
311 
313  virtual ~HealthComponentBase();
314 
315  PROTECTED:
316 
317  // ----------------------------------------------------------------------
318  // Getters for numbers of special input ports
319  // ----------------------------------------------------------------------
320 
325 
326  PROTECTED:
327 
328  // ----------------------------------------------------------------------
329  // Getters for numbers of typed input ports
330  // ----------------------------------------------------------------------
331 
336 
341 
342  PROTECTED:
343 
344  // ----------------------------------------------------------------------
345  // Getters for numbers of special output ports
346  // ----------------------------------------------------------------------
347 
352 
357 
362 
363 #if FW_ENABLE_TEXT_LOGGING == 1
364 
368  FwIndexType getNum_LogText_OutputPorts() const;
369 
370 #endif
371 
376 
381 
382  PROTECTED:
383 
384  // ----------------------------------------------------------------------
385  // Getters for numbers of typed output ports
386  // ----------------------------------------------------------------------
387 
392 
397 
398  PROTECTED:
399 
400  // ----------------------------------------------------------------------
401  // Connection status queries for special output ports
402  // ----------------------------------------------------------------------
403 
408  FwIndexType portNum
409  );
410 
415  FwIndexType portNum
416  );
417 
422  FwIndexType portNum
423  );
424 
425 #if FW_ENABLE_TEXT_LOGGING == 1
426 
430  bool isConnected_LogText_OutputPort(
431  FwIndexType portNum
432  );
433 
434 #endif
435 
440  FwIndexType portNum
441  );
442 
447  FwIndexType portNum
448  );
449 
450  PROTECTED:
451 
452  // ----------------------------------------------------------------------
453  // Connection status queries for typed output ports
454  // ----------------------------------------------------------------------
455 
460  FwIndexType portNum
461  );
462 
467  FwIndexType portNum
468  );
469 
470  PROTECTED:
471 
472  // ----------------------------------------------------------------------
473  // Handlers to implement for typed input ports
474  // ----------------------------------------------------------------------
475 
477  virtual void PingReturn_handler(
478  FwIndexType portNum,
479  U32 key
480  ) = 0;
481 
483  virtual void Run_handler(
484  FwIndexType portNum,
485  U32 context
486  ) = 0;
487 
488  PROTECTED:
489 
490  // ----------------------------------------------------------------------
491  // Port handler base-class functions for typed input ports
492  //
493  // Call these functions directly to bypass the corresponding ports
494  // ----------------------------------------------------------------------
495 
498  FwIndexType portNum,
499  U32 key
500  );
501 
503  void Run_handlerBase(
504  FwIndexType portNum,
505  U32 context
506  );
507 
508  PROTECTED:
509 
510  // ----------------------------------------------------------------------
511  // Pre-message hooks for typed async input ports
512  //
513  // Each of these functions is invoked just before processing a message
514  // on the corresponding port. By default, they do nothing. You can
515  // override them to provide specific pre-message behavior.
516  // ----------------------------------------------------------------------
517 
519  virtual void PingReturn_preMsgHook(
520  FwIndexType portNum,
521  U32 key
522  );
523 
524  PROTECTED:
525 
526  // ----------------------------------------------------------------------
527  // Invocation functions for typed output ports
528  // ----------------------------------------------------------------------
529 
531  void PingSend_out(
532  FwIndexType portNum,
533  U32 key
534  );
535 
537  void WdogStroke_out(
538  FwIndexType portNum,
539  U32 code
540  );
541 
542  PROTECTED:
543 
544  // ----------------------------------------------------------------------
545  // Command response
546  // ----------------------------------------------------------------------
547 
549  void cmdResponse_out(
550  FwOpcodeType opCode,
551  U32 cmdSeq,
552  Fw::CmdResponse response
553  );
554 
555  PROTECTED:
556 
557  // ----------------------------------------------------------------------
558  // Command handlers to implement
559  // ----------------------------------------------------------------------
560 
564  virtual void HLTH_ENABLE_cmdHandler(
565  FwOpcodeType opCode,
566  U32 cmdSeq,
567  Fw::Enabled enable
568  ) = 0;
569 
573  virtual void HLTH_PING_ENABLE_cmdHandler(
574  FwOpcodeType opCode,
575  U32 cmdSeq,
576  const Fw::CmdStringArg& entry,
577  Fw::Enabled enable
578  ) = 0;
579 
583  virtual void HLTH_CHNG_PING_cmdHandler(
584  FwOpcodeType opCode,
585  U32 cmdSeq,
586  const Fw::CmdStringArg& entry,
587  U32 warningValue,
588  U32 fatalValue
589  ) = 0;
590 
591  PROTECTED:
592 
593  // ----------------------------------------------------------------------
594  // Command handler base-class functions
595  //
596  // Call these functions directly to bypass the command input port
597  // ----------------------------------------------------------------------
598 
603  FwOpcodeType opCode,
604  U32 cmdSeq,
605  Fw::CmdArgBuffer& args
606  );
607 
612  FwOpcodeType opCode,
613  U32 cmdSeq,
614  Fw::CmdArgBuffer& args
615  );
616 
621  FwOpcodeType opCode,
622  U32 cmdSeq,
623  Fw::CmdArgBuffer& args
624  );
625 
626  PROTECTED:
627 
628  // ----------------------------------------------------------------------
629  // Pre-message hooks for async commands
630  //
631  // Each of these functions is invoked just before processing the
632  // corresponding command. By default they do nothing. You can
633  // override them to provide specific pre-command behavior.
634  // ----------------------------------------------------------------------
635 
637  virtual void HLTH_ENABLE_preMsgHook(
638  FwOpcodeType opCode,
639  U32 cmdSeq
640  );
641 
643  virtual void HLTH_PING_ENABLE_preMsgHook(
644  FwOpcodeType opCode,
645  U32 cmdSeq
646  );
647 
649  virtual void HLTH_CHNG_PING_preMsgHook(
650  FwOpcodeType opCode,
651  U32 cmdSeq
652  );
653 
654  PROTECTED:
655 
656  // ----------------------------------------------------------------------
657  // Event logging functions
658  // ----------------------------------------------------------------------
659 
664  const Fw::StringBase& entry
665  ) const;
666 
671  const Fw::StringBase& entry
672  ) const;
673 
678  const Fw::StringBase& entry,
679  U32 badKey
680  ) const;
681 
686  Fw::Enabled enabled
687  ) const;
688 
693  Fw::Enabled enabled,
694  const Fw::StringBase& entry
695  ) const;
696 
701  const Fw::StringBase& entry
702  ) const;
703 
708  const Fw::StringBase& entry,
709  U32 warn,
710  U32 fatal
711  ) const;
712 
717  const Fw::StringBase& entry,
718  U32 warn,
719  U32 fatal
720  ) const;
721 
722  PROTECTED:
723 
724  // ----------------------------------------------------------------------
725  // Telemetry write functions
726  // ----------------------------------------------------------------------
727 
732  U32 arg,
733  Fw::Time _tlmTime = Fw::Time()
734  ) const;
735 
736  PROTECTED:
737 
738  // ----------------------------------------------------------------------
739  // Time
740  // ----------------------------------------------------------------------
741 
745  Fw::Time getTime() const;
746 
747  PROTECTED:
748 
749  // ----------------------------------------------------------------------
750  // Message dispatch functions
751  // ----------------------------------------------------------------------
752 
754  virtual MsgDispatchStatus doDispatch();
755 
756  protected:
757 
758  // ----------------------------------------------------------------------
759  // Helper functions for dispatching current messages
760  // ----------------------------------------------------------------------
761 
764 
765  PRIVATE:
766 
767  // ----------------------------------------------------------------------
768  // Calls for messages received on special input ports
769  // ----------------------------------------------------------------------
770 
772  static void m_p_CmdDisp_in(
773  Fw::PassiveComponentBase* callComp,
774  FwIndexType portNum,
775  FwOpcodeType opCode,
776  U32 cmdSeq,
777  Fw::CmdArgBuffer& args
778  );
779 
780  PRIVATE:
781 
782  // ----------------------------------------------------------------------
783  // Calls for messages received on typed input ports
784  // ----------------------------------------------------------------------
785 
787  static void m_p_PingReturn_in(
788  Fw::PassiveComponentBase* callComp,
789  FwIndexType portNum,
790  U32 key
791  );
792 
794  static void m_p_Run_in(
795  Fw::PassiveComponentBase* callComp,
796  FwIndexType portNum,
797  U32 context
798  );
799 
800  PRIVATE:
801 
802  // ----------------------------------------------------------------------
803  // Special input ports
804  // ----------------------------------------------------------------------
805 
807  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
808 
809  PRIVATE:
810 
811  // ----------------------------------------------------------------------
812  // Typed input ports
813  // ----------------------------------------------------------------------
814 
816  Svc::InputPingPort m_PingReturn_InputPort[NUM_PINGRETURN_INPUT_PORTS];
817 
819  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
820 
821  PRIVATE:
822 
823  // ----------------------------------------------------------------------
824  // Special output ports
825  // ----------------------------------------------------------------------
826 
828  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
829 
832 
834  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
835 
836 #if FW_ENABLE_TEXT_LOGGING == 1
837 
839  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
840 
841 #endif
842 
844  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
845 
847  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
848 
849  PRIVATE:
850 
851  // ----------------------------------------------------------------------
852  // Typed output ports
853  // ----------------------------------------------------------------------
854 
856  Svc::OutputPingPort m_PingSend_OutputPort[NUM_PINGSEND_OUTPUT_PORTS];
857 
859  Svc::OutputWatchDogPort m_WdogStroke_OutputPort[NUM_WDOGSTROKE_OUTPUT_PORTS];
860 
861  };
862 
863 }
864 
865 #endif
virtual void HLTH_CHNG_PING_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &entry, U32 warningValue, U32 fatalValue)=0
void regCommands()
Register commands with the Command Dispatcher.
Auto-generated base for Health component.
Definition: Time.hpp:9
virtual void Run_handler(FwIndexType portNum, U32 context)=0
Handler for input port Run.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual ~HealthComponentBase()
Destroy HealthComponentBase object.
void tlmWrite_PingLateWarnings(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
void log_FATAL_HLTH_PING_WRONG_KEY(const Fw::StringBase &entry, U32 badKey) const
PlatformSizeType FwSizeType
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
I32 FwEnumStoreType
Declare FATAL since task is no longer responding.
virtual MsgDispatchStatus doDispatch()
Called in the message loop to dispatch a message from the queue.
FwIndexType getNum_PingSend_OutputPorts() const
FwIndexType getNum_Time_OutputPorts() const
Warn that a ping target is longer than the warning value.
virtual void PingReturn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port PingReturn.
void log_WARNING_LO_HLTH_CHECK_LOOKUP_ERROR(const Fw::StringBase &entry) const
void log_WARNING_HI_HLTH_PING_INVALID_VALUES(const Fw::StringBase &entry, U32 warn, U32 fatal) const
friend class HealthComponentBaseFriend
Friend class for white-box testing.
bool isConnected_Log_OutputPort(FwIndexType portNum)
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
Enum representing a command response.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
void set_WdogStroke_OutputPort(FwIndexType portNum, Svc::InputWatchDogPort *port)
Connect port to WdogStroke[portNum].
virtual void HLTH_ENABLE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_ENABLE.
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
Report a particular entry on or off.
void init()
Object initializer.
Definition: ObjBase.cpp:26
Declare FATAL since task is no longer responding.
FwIndexType getNum_Log_OutputPorts() const
FwIndexType getNum_WdogStroke_OutputPorts() const
Svc::InputPingPort * get_PingReturn_InputPort(FwIndexType portNum)
void PingReturn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port PingReturn.
U32 FwOpcodeType
The type of a command opcode.
FwIndexType getNum_CmdReg_OutputPorts() const
FwIndexType getNum_PingReturn_InputPorts() const
FwIndexType getNum_CmdStatus_OutputPorts() const
void log_ACTIVITY_HI_HLTH_CHECK_PING(Fw::Enabled enabled, const Fw::StringBase &entry) const
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
bool isConnected_Time_OutputPort(FwIndexType portNum)
void WdogStroke_out(FwIndexType portNum, U32 code)
Invoke output port WdogStroke.
void HLTH_PING_ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
FwIndexType getNum_Run_InputPorts() const
virtual void HLTH_ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::Enabled enable)=0
void set_PingSend_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to PingSend[portNum].
Enabled and disabled states.
bool isConnected_WdogStroke_OutputPort(FwIndexType portNum)
bool isConnected_PingSend_OutputPort(FwIndexType portNum)
void log_FATAL_HLTH_PING_LATE(const Fw::StringBase &entry) const
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
HealthComponentBase(const char *compName="")
Construct HealthComponentBase object.
A command to enable or disable health checks.
virtual void HLTH_PING_ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &entry, Fw::Enabled enable)=0
virtual void HLTH_CHNG_PING_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_CHNG_PING.
PlatformIndexType FwIndexType
virtual void PingReturn_handler(FwIndexType portNum, U32 key)=0
Handler for input port PingReturn.
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
RateGroupDivider component implementation.
FwIndexType getNum_Tlm_OutputPorts() const
Svc::InputSchedPort * get_Run_InputPort(FwIndexType portNum)
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
MsgDispatchStatus dispatchCurrentMessages()
Dispatch all current messages unless ERROR or EXIT occurs.
void log_ACTIVITY_HI_HLTH_CHECK_ENABLE(Fw::Enabled enabled) const
FwIndexType getNum_CmdDisp_InputPorts() const
void HLTH_CHNG_PING_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void log_WARNING_HI_HLTH_PING_WARN(const Fw::StringBase &entry) const
void HLTH_ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual void HLTH_PING_ENABLE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_PING_ENABLE.
friend class HealthTesterBase
Friend class tester to support autocoded test harness.
void Run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port Run.
void PingSend_out(FwIndexType portNum, U32 key)
Invoke output port PingSend.
void log_ACTIVITY_HI_HLTH_PING_UPDATED(const Fw::StringBase &entry, U32 warn, U32 fatal) const