Esempio n. 1
0
void
DataValidatorGroup::print()
{
	/* print the group's state */
	ECL_INFO("validator: best: %d, prev best: %d, failsafe: %s (%u events)",
		 _curr_best, _prev_best, (_toggle_count > 0) ? "YES" : "NO",
		 _toggle_count);

	DataValidator *next = _first;
	unsigned i = 0;

	while (next != nullptr) {
		if (next->used()) {
			uint32_t flags = next->state();

			ECL_INFO("sensor #%u, prio: %d, state:%s%s%s%s%s%s", i, next->priority(),
				 ((flags & DataValidator::ERROR_FLAG_NO_DATA) ? " OFF" : ""),
				 ((flags & DataValidator::ERROR_FLAG_STALE_DATA) ? " STALE" : ""),
				 ((flags & DataValidator::ERROR_FLAG_TIMEOUT) ? " TOUT" : ""),
				 ((flags & DataValidator::ERROR_FLAG_HIGH_ERRCOUNT) ? " ECNT" : ""),
				 ((flags & DataValidator::ERROR_FLAG_HIGH_ERRDENSITY) ? " EDNST" : ""),
				 ((flags == DataValidator::ERROR_FLAG_NO_ERROR) ? " OK" : ""));

			next->print();
		}

		next = next->sibling();
		i++;
	}
}
Esempio n. 2
0
uint32_t
DataValidatorGroup::failover_state()
{
	DataValidator *next = _first;
	unsigned i = 0;

	while (next != nullptr) {
		if (next->used() && (next->state() != DataValidator::ERROR_FLAG_NO_ERROR) && (i == (unsigned)_prev_best)) {
			return next->state();
		}

		next = next->sibling();
		i++;
	}

	return DataValidator::ERROR_FLAG_NO_ERROR;
}