24 HealthComponentBase(compName),
35 this->m_pingTrackerEntries[entry].enabled = Fw::Enabled::DISABLED;
40 HealthComponentBase::init(queueDepth, instance);
41 this->queue_depth = queueDepth;
49 FW_ASSERT(numPingEntries <= NUM_PINGSEND_OUTPUT_PORTS);
51 this->m_numPingEntries = numPingEntries;
52 this->m_watchDogCode = watchDogCode;
56 FW_ASSERT(pingEntries[entry].warnCycles <= pingEntries[entry].fatalCycles, pingEntries[entry].warnCycles, pingEntries[entry].fatalCycles);
57 this->m_pingTrackerEntries[entry].entry = pingEntries[entry];
58 this->m_pingTrackerEntries[entry].cycleCount = 0;
59 this->m_pingTrackerEntries[entry].enabled = Fw::Enabled::ENABLED;
60 this->m_pingTrackerEntries[entry].key = 0;
72 void HealthImpl::PingReturn_handler(
const NATIVE_INT_TYPE portNum, U32 key) {
74 if (key != this->m_pingTrackerEntries[portNum].key) {
76 this->log_FATAL_HLTH_PING_WRONG_KEY(_arg,key);
79 this->m_pingTrackerEntries[portNum].cycleCount = 0;
80 this->m_pingTrackerEntries[portNum].key = 0;
88 MsgDispatchStatus stat = this->doDispatch();
89 if (MSG_DISPATCH_EMPTY == stat) {
95 if (this->m_enabled == Fw::Enabled::ENABLED) {
101 if (Fw::Enabled::ENABLED == this->m_pingTrackerEntries[entry].enabled) {
103 if (0 == this->m_pingTrackerEntries[entry].cycleCount) {
105 this->m_pingTrackerEntries[entry].key = this->m_key;
107 this->PingSend_out(entry, this->m_pingTrackerEntries[entry].key);
111 this->m_pingTrackerEntries[entry].cycleCount++;
114 if (this->m_pingTrackerEntries[entry].cycleCount ==
115 this->m_pingTrackerEntries[entry].entry.warnCycles) {
117 this->log_WARNING_HI_HLTH_PING_WARN(_arg);
118 this->tlmWrite_PingLateWarnings(++this->m_warnings);
121 if (this->m_pingTrackerEntries[entry].entry.fatalCycles ==
122 this->m_pingTrackerEntries[entry].cycleCount) {
124 this->log_FATAL_HLTH_PING_LATE(_arg);
128 this->m_pingTrackerEntries[entry].cycleCount++;
139 if (this->isConnected_WdogStroke_OutputPort(0)) {
140 this->WdogStroke_out(0,this->m_watchDogCode);
148 void HealthImpl::HLTH_ENABLE_cmdHandler(
const FwOpcodeType opCode, U32 cmdSeq, Fw::Enabled enable) {
149 this->m_enabled = enable;
150 Fw::Enabled isEnabled = Fw::Enabled::DISABLED;
151 if (enable == Fw::Enabled::ENABLED) {
152 isEnabled = Fw::Enabled::ENABLED;
154 this->log_ACTIVITY_HI_HLTH_CHECK_ENABLE(isEnabled);
155 this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
159 void HealthImpl::HLTH_PING_ENABLE_cmdHandler(
const FwOpcodeType opCode, U32 cmdSeq,
const Fw::CmdStringArg& entry, Fw::Enabled enable) {
163 if (-1 == entryIndex) {
164 this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::VALIDATION_ERROR);
168 this->m_pingTrackerEntries[entryIndex].enabled = enable.e;
169 Fw::Enabled isEnabled(Fw::Enabled::DISABLED);
170 if (enable == Fw::Enabled::ENABLED) {
171 isEnabled = Fw::Enabled::ENABLED;
175 this->log_ACTIVITY_HI_HLTH_CHECK_PING(isEnabled,arg);
176 this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
179 void HealthImpl::HLTH_CHNG_PING_cmdHandler(
const FwOpcodeType opCode, U32 cmdSeq,
const Fw::CmdStringArg& entry, U32 warningValue, U32 fatalValue) {
182 if (-1 == entryIndex) {
183 this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::VALIDATION_ERROR);
188 if (warningValue > fatalValue) {
191 this->log_WARNING_HI_HLTH_PING_INVALID_VALUES(arg,warningValue,fatalValue);
192 this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::VALIDATION_ERROR);
196 this->m_pingTrackerEntries[entryIndex].entry.warnCycles = warningValue;
197 this->m_pingTrackerEntries[entryIndex].entry.fatalCycles = fatalValue;
199 this->log_ACTIVITY_HI_HLTH_PING_UPDATED(arg,warningValue,fatalValue);
200 this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
206 for (
NATIVE_UINT_TYPE tableEntry = 0; tableEntry < NUM_PINGSEND_OUTPUT_PORTS; tableEntry++) {
207 if (entry == this->m_pingTrackerEntries[tableEntry].entry.entryName) {
212 this->log_WARNING_LO_HLTH_CHECK_LOOKUP_ERROR(arg);
PlatformIntType NATIVE_INT_TYPE
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
PlatformUIntType NATIVE_UINT_TYPE
C++-compatible configuration header for fprime configuration.
virtual void doOtherChecks()
additional checks function
void init(const NATIVE_INT_TYPE queueDepth, const NATIVE_INT_TYPE instance)
HealthImpl initialization function.
~HealthImpl()
Component destructor.
void setPingEntries(PingEntry *pingEntries, NATIVE_INT_TYPE numPingEntries, U32 watchDogCode)
Set ping entry tables.
HealthImpl(const char *const compName)
HealthImpl constructor.
ActiveLogger_Enabled Enabled