F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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"
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
20#endif
24#include "Fw/Tlm/TlmPortAc.hpp"
25#include "Fw/Tlm/TlmString.hpp"
30
31namespace 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 NATIVE_INT_TYPE queueDepth,
114 NATIVE_INT_TYPE instance = 0
115 );
116
117 public:
118
119 // ----------------------------------------------------------------------
120 // Getters for special input ports
121 // ----------------------------------------------------------------------
122
127 NATIVE_INT_TYPE portNum
128 );
129
130 public:
131
132 // ----------------------------------------------------------------------
133 // Getters for typed input ports
134 // ----------------------------------------------------------------------
135
140 NATIVE_INT_TYPE portNum
141 );
142
147 NATIVE_INT_TYPE portNum
148 );
149
150 public:
151
152 // ----------------------------------------------------------------------
153 // Connect special input ports to special output ports
154 // ----------------------------------------------------------------------
155
158 NATIVE_INT_TYPE portNum,
160 );
161
164 NATIVE_INT_TYPE portNum,
166 );
167
170 NATIVE_INT_TYPE portNum,
171 Fw::InputLogPort* port
172 );
173
174#if FW_ENABLE_TEXT_LOGGING == 1
175
177 void set_LogText_OutputPort(
178 NATIVE_INT_TYPE portNum,
180 );
181
182#endif
183
186 NATIVE_INT_TYPE portNum,
187 Fw::InputTimePort* port
188 );
189
192 NATIVE_INT_TYPE portNum,
193 Fw::InputTlmPort* port
194 );
195
196 public:
197
198 // ----------------------------------------------------------------------
199 // Connect typed input ports to typed output ports
200 // ----------------------------------------------------------------------
201
204 NATIVE_INT_TYPE portNum,
205 Svc::InputPingPort* port
206 );
207
210 NATIVE_INT_TYPE 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 NATIVE_INT_TYPE portNum,
225 Fw::InputSerializePort* port
226 );
227
230 NATIVE_INT_TYPE portNum,
231 Fw::InputSerializePort* port
232 );
233
236 NATIVE_INT_TYPE portNum,
237 Fw::InputSerializePort* port
238 );
239
240#if FW_ENABLE_TEXT_LOGGING == 1
241
243 void set_LogText_OutputPort(
244 NATIVE_INT_TYPE portNum,
245 Fw::InputSerializePort* port
246 );
247
248#endif
249
252 NATIVE_INT_TYPE portNum,
253 Fw::InputSerializePort* port
254 );
255
258 NATIVE_INT_TYPE 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 NATIVE_INT_TYPE portNum,
275 Fw::InputSerializePort* port
276 );
277
280 NATIVE_INT_TYPE 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 NATIVE_INT_TYPE getNum_LogText_OutputPorts();
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 NATIVE_INT_TYPE portNum
405 );
406
411 NATIVE_INT_TYPE portNum
412 );
413
418 NATIVE_INT_TYPE portNum
419 );
420
421#if FW_ENABLE_TEXT_LOGGING == 1
422
426 bool isConnected_LogText_OutputPort(
427 NATIVE_INT_TYPE portNum
428 );
429
430#endif
431
436 NATIVE_INT_TYPE portNum
437 );
438
443 NATIVE_INT_TYPE portNum
444 );
445
446 PROTECTED:
447
448 // ----------------------------------------------------------------------
449 // Connection status queries for typed output ports
450 // ----------------------------------------------------------------------
451
456 NATIVE_INT_TYPE portNum
457 );
458
463 NATIVE_INT_TYPE portNum
464 );
465
466 PROTECTED:
467
468 // ----------------------------------------------------------------------
469 // Handlers to implement for typed input ports
470 // ----------------------------------------------------------------------
471
473 virtual void PingReturn_handler(
474 NATIVE_INT_TYPE portNum,
475 U32 key
476 ) = 0;
477
479 virtual void Run_handler(
480 NATIVE_INT_TYPE portNum,
481 NATIVE_UINT_TYPE 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 NATIVE_INT_TYPE portNum,
495 U32 key
496 );
497
499 void Run_handlerBase(
500 NATIVE_INT_TYPE portNum,
501 NATIVE_UINT_TYPE 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 NATIVE_INT_TYPE portNum,
517 U32 key
518 );
519
520 PROTECTED:
521
522 // ----------------------------------------------------------------------
523 // Invocation functions for typed output ports
524 // ----------------------------------------------------------------------
525
527 void PingSend_out(
528 NATIVE_INT_TYPE portNum,
529 U32 key
530 );
531
533 void WdogStroke_out(
534 NATIVE_INT_TYPE 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::LogStringArg& entry
661 );
662
667 const Fw::LogStringArg& entry
668 );
669
674 const Fw::LogStringArg& entry,
675 U32 badKey
676 );
677
682 Fw::Enabled enabled
683 );
684
689 Fw::Enabled enabled,
690 const Fw::LogStringArg& entry
691 );
692
697 const Fw::LogStringArg& entry
698 );
699
704 const Fw::LogStringArg& entry,
705 U32 warn,
706 U32 fatal
707 );
708
713 const Fw::LogStringArg& 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
742
743 PROTECTED:
744
745 // ----------------------------------------------------------------------
746 // Message dispatch functions
747 // ----------------------------------------------------------------------
748
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 NATIVE_INT_TYPE 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 NATIVE_INT_TYPE portNum,
777 U32 key
778 );
779
781 static void m_p_Run_in(
782 Fw::PassiveComponentBase* callComp,
783 NATIVE_INT_TYPE portNum,
784 NATIVE_UINT_TYPE 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
807
808 PRIVATE:
809
810 // ----------------------------------------------------------------------
811 // Special output ports
812 // ----------------------------------------------------------------------
813
816
819
821 Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
822
823#if FW_ENABLE_TEXT_LOGGING == 1
824
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
847
848 };
849
850}
851
852#endif
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
PlatformUIntType NATIVE_UINT_TYPE
Definition BasicTypes.h:52
U32 FwOpcodeType
Definition FpConfig.h:56
C++-compatible configuration header for fprime configuration.
Enum representing a command response.
Enabled and disabled states.
void init()
Object initializer.
Definition ObjBase.cpp:27
Auto-generated base for Health component.
bool isConnected_CmdStatus_OutputPort(NATIVE_INT_TYPE portNum)
void tlmWrite_PingLateWarnings(U32 arg, Fw::Time _tlmTime=Fw::Time())
NATIVE_INT_TYPE getNum_CmdStatus_OutputPorts()
void PingReturn_handlerBase(NATIVE_INT_TYPE portNum, U32 key)
Handler base-class function for 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.
void log_ACTIVITY_HI_HLTH_CHECK_PING(Fw::Enabled enabled, const Fw::LogStringArg &entry)
virtual void PingReturn_handler(NATIVE_INT_TYPE portNum, U32 key)=0
Handler for input port PingReturn.
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)
bool isConnected_Log_OutputPort(NATIVE_INT_TYPE portNum)
void log_FATAL_HLTH_PING_WRONG_KEY(const Fw::LogStringArg &entry, U32 badKey)
virtual void PingReturn_preMsgHook(NATIVE_INT_TYPE portNum, U32 key)
Pre-message hook for async input port PingReturn.
bool isConnected_WdogStroke_OutputPort(NATIVE_INT_TYPE portNum)
Svc::InputPingPort * get_PingReturn_InputPort(NATIVE_INT_TYPE portNum)
@ CHANNELID_PINGLATEWARNINGS
Channel ID for PingLateWarnings.
void set_PingSend_OutputPort(NATIVE_INT_TYPE portNum, Svc::InputPingPort *port)
Connect port to PingSend[portNum].
void log_FATAL_HLTH_PING_LATE(const Fw::LogStringArg &entry)
void set_CmdReg_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
void set_WdogStroke_OutputPort(NATIVE_INT_TYPE portNum, Svc::InputWatchDogPort *port)
Connect port to WdogStroke[portNum].
void log_WARNING_LO_HLTH_CHECK_LOOKUP_ERROR(const Fw::LogStringArg &entry)
bool isConnected_PingSend_OutputPort(NATIVE_INT_TYPE portNum)
NATIVE_INT_TYPE getNum_Time_OutputPorts()
virtual ~HealthComponentBase()
Destroy HealthComponentBase object.
Svc::InputSchedPort * get_Run_InputPort(NATIVE_INT_TYPE portNum)
NATIVE_INT_TYPE getNum_CmdDisp_InputPorts()
void log_WARNING_HI_HLTH_PING_WARN(const Fw::LogStringArg &entry)
virtual void HLTH_ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::Enabled enable)=0
void HLTH_ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
NATIVE_INT_TYPE getNum_Tlm_OutputPorts()
virtual void Run_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context)=0
Handler for input port Run.
void log_ACTIVITY_HI_HLTH_CHECK_ENABLE(Fw::Enabled enabled)
bool isConnected_Tlm_OutputPort(NATIVE_INT_TYPE portNum)
void regCommands()
Register commands with the Command Dispatcher.
void set_Log_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
bool isConnected_CmdReg_OutputPort(NATIVE_INT_TYPE portNum)
friend class HealthComponentBaseFriend
Friend class for white-box testing.
NATIVE_INT_TYPE getNum_PingReturn_InputPorts()
void set_Time_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
virtual void HLTH_CHNG_PING_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_CHNG_PING.
NATIVE_INT_TYPE getNum_PingSend_OutputPorts()
NATIVE_INT_TYPE getNum_Log_OutputPorts()
virtual void HLTH_PING_ENABLE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_PING_ENABLE.
Fw::InputCmdPort * get_CmdDisp_InputPort(NATIVE_INT_TYPE portNum)
void PingSend_out(NATIVE_INT_TYPE portNum, U32 key)
Invoke output port PingSend.
@ 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 log_WARNING_HI_HLTH_PING_INVALID_VALUES(const Fw::LogStringArg &entry, U32 warn, U32 fatal)
NATIVE_INT_TYPE getNum_WdogStroke_OutputPorts()
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void set_CmdStatus_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
void set_Tlm_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
HealthComponentBase(const char *compName="")
Construct HealthComponentBase object.
bool isConnected_Time_OutputPort(NATIVE_INT_TYPE portNum)
virtual void HLTH_ENABLE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command HLTH_ENABLE.
void Run_handlerBase(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context)
Handler base-class function for input port Run.
void log_ACTIVITY_HI_HLTH_PING_UPDATED(const Fw::LogStringArg &entry, U32 warn, U32 fatal)
void WdogStroke_out(NATIVE_INT_TYPE portNum, U32 code)
Invoke output port WdogStroke.
NATIVE_INT_TYPE getNum_Run_InputPorts()
NATIVE_INT_TYPE getNum_CmdReg_OutputPorts()
virtual void HLTH_CHNG_PING_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &entry, U32 warningValue, U32 fatalValue)=0