monitor: Trust group cancel/start monitoring
Any fan monitoring trust groups configured should cancel the monitoring
of all fan sensors configured in the trust group for all monitoring
methods(timer based or count based) when the group is determined not to
be trusted.
Also, the trust manager should restart monitoring all the sensors in the
group by processing each sensor against the configured monitoring
method. This matches how each sensor is processed on each tach changed
signal where only when a tach changed signal is received does the trust
state of the sensor get checked prior to processing the state of the
sensor.
Tested:
Verify fan sensors in trust group's functional state is correct
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Change-Id: I7b2ffc538eb1f17017826235353dba85e4f92ebe
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index 605aff5..95d52b2 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -167,6 +167,34 @@
return std::make_pair(min, max);
}
+void TachSensor::processState()
+{
+ _fan.process(*this);
+}
+
+void TachSensor::resetMethod()
+{
+ switch (_method)
+ {
+ case MethodMode::timebased:
+ if (timerRunning())
+ {
+ stopTimer();
+ }
+ break;
+ case MethodMode::count:
+ if (_functional)
+ {
+ _counter = 0;
+ }
+ else
+ {
+ _counter = _threshold;
+ }
+ break;
+ }
+}
+
void TachSensor::setFunctional(bool functional)
{
_functional = functional;