Add status interface to sensors
When a fault sysfs file is present for a sensor, the OperationalStatus
interface is attached to the sensor object. The functional property is
initially set to the corresponding value read from the fault sysfs file
when the sensor object is created. A follow-up commit will address
updating the functional property based on reading the fault sysfs file
during the polling interval.
Tested:
OperationalStatus interface created for sensors with fault files
Interface not created for sensors without fault file
Functional property set to correct value from sensor's fault file
Change-Id: Id75b3711d048d4667d2173a3255512cf5482ab67
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/interface.hpp b/interface.hpp
index da939c2..a2fa21f 100644
--- a/interface.hpp
+++ b/interface.hpp
@@ -5,6 +5,7 @@
#include "xyz/openbmc_project/Sensor/Threshold/Critical/server.hpp"
#include "xyz/openbmc_project/Control/FanSpeed/server.hpp"
#include "xyz/openbmc_project/Control/FanPwm/server.hpp"
+#include "xyz/openbmc_project/State/Decorator/OperationalStatus/server.hpp"
#include <sdbusplus/server.hpp>
template <typename... T>
@@ -24,6 +25,9 @@
using FanPwmInterface =
sdbusplus::xyz::openbmc_project::Control::server::FanPwm;
using FanPwmObject = ServerObject<FanPwmInterface>;
+using StatusInterface =
+ sdbusplus::xyz::openbmc_project::State::Decorator::server::OperationalStatus;
+using StatusObject = ServerObject<StatusInterface>;
enum class InterfaceType
{
@@ -32,6 +36,7 @@
CRIT,
FAN_SPEED,
FAN_PWM,
+ STATUS,
};
// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4