data_validator_group: add a method to get the state of the sensor with the provided index

This commit is contained in:
Dusan Zivkovic
2020-01-15 12:20:47 -05:00
committed by Daniel Agar
parent 0f4439d281
commit 011b4c2e4e
2 changed files with 26 additions and 0 deletions
+19
View File
@@ -338,3 +338,22 @@ DataValidatorGroup::failover_state()
return DataValidator::ERROR_FLAG_NO_ERROR;
}
uint32_t
DataValidatorGroup::get_sensor_state(unsigned index)
{
DataValidator *next = _first;
unsigned i = 0;
while (next != nullptr) {
if (i == index) {
return next->state();
}
next = next->sibling();
i++;
}
// sensor index not found
return UINT32_MAX;
}
+7
View File
@@ -111,6 +111,13 @@ public:
*/
uint32_t failover_state();
/**
* Get the error state of the sensor with the specified index
*
* @return bitmask with error states of the sensor
*/
uint32_t get_sensor_state(unsigned index);
/**
* Print the validator value
*