WIP: somethings wrong.. #19
@ -139,10 +139,12 @@ ReturnValue_t DeviceHandlerBase::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = healthHelper.initialize();
|
result = healthHelper.initialize();
|
||||||
if (result != RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
sif::error << "DeviceHandlerBase::initialize: Health Helper "
|
healthHelperActive = true;
|
||||||
"initialization failure" << std::endl;
|
}
|
||||||
return result;
|
else {
|
||||||
|
sif::warning << "DeviceHandlerBase::initialize: Health Helper "
|
||||||
|
"initialization failure." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = modeHelper.initialize();
|
result = modeHelper.initialize();
|
||||||
@ -215,9 +217,11 @@ void DeviceHandlerBase::readCommandQueue() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = healthHelper.handleHealthCommand(&message);
|
if(healthHelperActive) {
|
||||||
if (result == RETURN_OK) {
|
result = healthHelper.handleHealthCommand(&message);
|
||||||
return;
|
if (result == RETURN_OK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = modeHelper.handleModeCommand(&message);
|
result = modeHelper.handleModeCommand(&message);
|
||||||
@ -996,7 +1000,9 @@ void DeviceHandlerBase::getMode(Mode_t* mode, Submode_t* submode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandlerBase::setToExternalControl() {
|
void DeviceHandlerBase::setToExternalControl() {
|
||||||
healthHelper.setHealth(EXTERNAL_CONTROL);
|
if(healthHelperActive) {
|
||||||
|
healthHelper.setHealth(EXTERNAL_CONTROL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandlerBase::announceMode(bool recursive) {
|
void DeviceHandlerBase::announceMode(bool recursive) {
|
||||||
@ -1016,11 +1022,24 @@ void DeviceHandlerBase::missedReply(DeviceCommandId_t id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HasHealthIF::HealthState DeviceHandlerBase::getHealth() {
|
HasHealthIF::HealthState DeviceHandlerBase::getHealth() {
|
||||||
return healthHelper.getHealth();
|
if(healthHelperActive) {
|
||||||
|
return healthHelper.getHealth();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sif::warning << "DeviceHandlerBase::getHealth: Health helper not active"
|
||||||
|
<< std::endl;
|
||||||
|
return HasHealthIF::HEALTHY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::setHealth(HealthState health) {
|
ReturnValue_t DeviceHandlerBase::setHealth(HealthState health) {
|
||||||
healthHelper.setHealth(health);
|
if(healthHelperActive) {
|
||||||
|
healthHelper.setHealth(health);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sif::warning << "DeviceHandlerBase::getHealth: Health helper not active"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,6 +601,7 @@ protected:
|
|||||||
|
|
||||||
/** Health helper for HasHealthIF */
|
/** Health helper for HasHealthIF */
|
||||||
HealthHelper healthHelper;
|
HealthHelper healthHelper;
|
||||||
|
bool healthHelperActive = false;
|
||||||
/** Mode helper for HasModesIF */
|
/** Mode helper for HasModesIF */
|
||||||
ModeHelper modeHelper;
|
ModeHelper modeHelper;
|
||||||
/** Parameter helper for ReceivesParameterMessagesIF */
|
/** Parameter helper for ReceivesParameterMessagesIF */
|
||||||
|
@ -163,6 +163,8 @@ void DeviceHandlerFailureIsolation::clearFaultCounters() {
|
|||||||
ReturnValue_t DeviceHandlerFailureIsolation::initialize() {
|
ReturnValue_t DeviceHandlerFailureIsolation::initialize() {
|
||||||
ReturnValue_t result = FailureIsolationBase::initialize();
|
ReturnValue_t result = FailureIsolationBase::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "DeviceHandlerFailureIsolation::initialize: Could not"
|
||||||
|
" initialize FailureIsolationBase." << std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
ConfirmsFailuresIF* power = objectManager->get<ConfirmsFailuresIF>(
|
ConfirmsFailuresIF* power = objectManager->get<ConfirmsFailuresIF>(
|
||||||
|
@ -19,7 +19,9 @@ FailureIsolationBase::~FailureIsolationBase() {
|
|||||||
ReturnValue_t FailureIsolationBase::initialize() {
|
ReturnValue_t FailureIsolationBase::initialize() {
|
||||||
EventManagerIF* manager = objectManager->get<EventManagerIF>(
|
EventManagerIF* manager = objectManager->get<EventManagerIF>(
|
||||||
objects::EVENT_MANAGER);
|
objects::EVENT_MANAGER);
|
||||||
if (manager == NULL) {
|
if (manager == nullptr) {
|
||||||
|
sif::error << "FailureIsolationBase::initialize: Event Manager has not"
|
||||||
|
" been initialized!" << std::endl;
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
ReturnValue_t result = manager->registerListener(eventQueue->getId());
|
ReturnValue_t result = manager->registerListener(eventQueue->getId());
|
||||||
|
@ -69,9 +69,10 @@ void ObjectManager::initialize() {
|
|||||||
return_value = it.second->initialize();
|
return_value = it.second->initialize();
|
||||||
if ( return_value != RETURN_OK ) {
|
if ( return_value != RETURN_OK ) {
|
||||||
object_id_t var = it.first;
|
object_id_t var = it.first;
|
||||||
sif::error << "Object 0x" << std::hex << std::setw(8) <<
|
sif::error << "ObjectManager::initialize: Object 0x" << std::hex <<
|
||||||
std::setfill('0')<< var << " failed to initialize " <<
|
std::setw(8) << std::setfill('0')<< var << " failed to "
|
||||||
"with code 0x" << return_value << std::dec << std::endl;
|
"initialize with code 0x" << return_value << std::dec <<
|
||||||
|
std::endl;
|
||||||
error_count++;
|
error_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user