dataset base bugfixes

This commit is contained in:
Robin Müller 2020-06-11 16:03:09 +02:00
parent a9c7ad84c8
commit 206235ed47
2 changed files with 8 additions and 4 deletions

View File

@ -36,7 +36,7 @@ ReturnValue_t DataSetBase::read(uint32_t lockTimeout) {
if (state == States::DATA_SET_UNINITIALISED) { if (state == States::DATA_SET_UNINITIALISED) {
lockDataPool(lockTimeout); lockDataPool(lockTimeout);
for (uint16_t count = 0; count < fillCount; count++) { for (uint16_t count = 0; count < fillCount; count++) {
ReturnValue_t result = readVariable(count); result = readVariable(count);
if(result != RETURN_OK) { if(result != RETURN_OK) {
break; break;
} }
@ -46,14 +46,15 @@ ReturnValue_t DataSetBase::read(uint32_t lockTimeout) {
} }
else { else {
sif::error << "DataSet::read(): " sif::error << "DataSet::read(): "
"Call made in wrong position." << std::endl; "Call made in wrong position. Don't forget to commit"
" member datasets!" << std::endl;
result = SET_WAS_ALREADY_READ; result = SET_WAS_ALREADY_READ;
} }
return result; return result;
} }
ReturnValue_t DataSetBase::readVariable(uint16_t count) { ReturnValue_t DataSetBase::readVariable(uint16_t count) {
ReturnValue_t result = DataSetIF::INVALID_PARAMETER_DEFINITION; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
// These checks are often performed by the respective // These checks are often performed by the respective
// variable implementation too, but I guess a double check does not hurt. // variable implementation too, but I guess a double check does not hurt.
if (registeredVariables[count]->getReadWriteMode() != if (registeredVariables[count]->getReadWriteMode() !=
@ -62,6 +63,9 @@ ReturnValue_t DataSetBase::readVariable(uint16_t count) {
!= PoolVariableIF::NO_PARAMETER) != PoolVariableIF::NO_PARAMETER)
{ {
result = registeredVariables[count]->readWithoutLock(); result = registeredVariables[count]->readWithoutLock();
if(result != HasReturnvaluesIF::RETURN_OK) {
result = INVALID_PARAMETER_DEFINITION;
}
} }
return result; return result;
} }

View File

@ -62,7 +62,7 @@ void HealthHelper::setHealth(HasHealthIF::HealthState health) {
void HealthHelper::informParent(HasHealthIF::HealthState health, void HealthHelper::informParent(HasHealthIF::HealthState health,
HasHealthIF::HealthState oldHealth) { HasHealthIF::HealthState oldHealth) {
if (parentQueue == 0) { if (parentQueue == MessageQueueMessageIF::NO_QUEUE) {
return; return;
} }
MessageQueueMessage message; MessageQueueMessage message;