1
0
forked from fsfw/fsfw

health table init now mandatory, better

diagnostic output for uninit health table or invalid health helper owner
This commit is contained in:
2020-07-16 12:38:21 +02:00
parent 47b3a428c6
commit aaafed7b28
3 changed files with 21 additions and 34 deletions

View File

@ -164,12 +164,8 @@ ReturnValue_t DeviceHandlerBase::initialize() {
}
result = healthHelper.initialize();
if (result == RETURN_OK) {
healthHelperActive = true;
}
else {
sif::warning << "DeviceHandlerBase::initialize: Health Helper "
"initialization failure." << std::endl;
if (result != RETURN_OK) {
return result;
}
result = modeHelper.initialize();
@ -246,11 +242,9 @@ void DeviceHandlerBase::readCommandQueue() {
return;
}
if(healthHelperActive) {
result = healthHelper.handleHealthCommand(&command);
if (result == RETURN_OK) {
return;
}
result = healthHelper.handleHealthCommand(&command);
if (result == RETURN_OK) {
return;
}
result = modeHelper.handleModeCommand(&command);
@ -1028,9 +1022,7 @@ void DeviceHandlerBase::getMode(Mode_t* mode, Submode_t* submode) {
}
void DeviceHandlerBase::setToExternalControl() {
if(healthHelperActive) {
healthHelper.setHealth(EXTERNAL_CONTROL);
}
healthHelper.setHealth(EXTERNAL_CONTROL);
}
void DeviceHandlerBase::announceMode(bool recursive) {
@ -1050,25 +1042,12 @@ void DeviceHandlerBase::missedReply(DeviceCommandId_t id) {
}
HasHealthIF::HealthState DeviceHandlerBase::getHealth() {
if(healthHelperActive) {
return healthHelper.getHealth();
}
else {
sif::warning << "DeviceHandlerBase::getHealth: Health helper not active"
<< std::endl;
return HasHealthIF::HEALTHY;
}
return healthHelper.getHealth();
}
ReturnValue_t DeviceHandlerBase::setHealth(HealthState health) {
if(healthHelperActive) {
healthHelper.setHealth(health);
}
else {
sif::warning << "DeviceHandlerBase::getHealth: Health helper not active"
<< std::endl;
}
return HasReturnvaluesIF::RETURN_OK;
healthHelper.setHealth(health);
return HasReturnvaluesIF::RETURN_OK;
}
void DeviceHandlerBase::checkSwitchState() {