regulators: Add monitorSensors support to Rail
Implemented the monitorSensors() method in the Rail class. This method
reads the sensors for a voltage rail.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: Ifbe6461349d20fee1eba233844c95c1046e1a54a
diff --git a/phosphor-regulators/src/rail.cpp b/phosphor-regulators/src/rail.cpp
index e95b396..7d90e77 100644
--- a/phosphor-regulators/src/rail.cpp
+++ b/phosphor-regulators/src/rail.cpp
@@ -32,4 +32,13 @@
}
}
+void Rail::monitorSensors(System& system, Chassis& chassis, Device& device)
+{
+ // If sensor monitoring is defined for this rail, read the sensors.
+ if (sensorMonitoring)
+ {
+ sensorMonitoring->execute(system, chassis, device, *this);
+ }
+}
+
} // namespace phosphor::power::regulators
diff --git a/phosphor-regulators/src/rail.hpp b/phosphor-regulators/src/rail.hpp
index 9e0ce3d..8340d07 100644
--- a/phosphor-regulators/src/rail.hpp
+++ b/phosphor-regulators/src/rail.hpp
@@ -102,6 +102,20 @@
}
/**
+ * Monitor the sensors for this rail.
+ *
+ * Sensor monitoring is optional. If sensor monitoring is defined for this
+ * rail, the sensor values are read.
+ *
+ * This method should be called once per second.
+ *
+ * @param system system that contains the chassis
+ * @param chassis chassis that contains the device
+ * @param device device that contains this rail
+ */
+ void monitorSensors(System& system, Chassis& chassis, Device& device);
+
+ /**
* Returns the sensor monitoring for this rail, if any.
*
* @return Pointer to SensorMonitoring object. Will equal nullptr if no