Add support for sensor override value
Write support Value property under xyz.openbmc_project.Sensor.Value
interface is added which will be used to do sensor override.
Sensor can be overridden by setting a value, which will be preserved,
till the service is restarted or Value is overridden again with NaN.
Change-Id: Ia606031a97e532cd12d768e36f1feaa4c7350620
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/sensor.hpp b/include/sensor.hpp
index dc9cdbe..62eec62 100644
--- a/include/sensor.hpp
+++ b/include/sensor.hpp
@@ -20,4 +20,17 @@
std::shared_ptr<sdbusplus::asio::dbus_interface> thresholdInterfaceWarning;
std::shared_ptr<sdbusplus::asio::dbus_interface> thresholdInterfaceCritical;
double value = std::numeric_limits<double>::quiet_NaN();
+ double overriddenValue = std::numeric_limits<double>::quiet_NaN();
+ bool internalSet = false;
+ int setSensorValue(const double& newValue, double& oldValue)
+ {
+ if (internalSet)
+ {
+ internalSet = false;
+ oldValue = newValue;
+ return 1;
+ }
+ overriddenValue = newValue;
+ return 1;
+ }
};
\ No newline at end of file