Add associations to sensors
This adds associations to all the sensors on dbus.
Tested: Mapper has lots of sensor associations now.
Change-Id: I9a1c51d6b139e45a228507d29637c29a84b302d9
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/sensor.hpp b/include/sensor.hpp
index bba2c4d..a6bf2b1 100644
--- a/include/sensor.hpp
+++ b/include/sensor.hpp
@@ -28,6 +28,7 @@
std::shared_ptr<sdbusplus::asio::dbus_interface> sensorInterface;
std::shared_ptr<sdbusplus::asio::dbus_interface> thresholdInterfaceWarning;
std::shared_ptr<sdbusplus::asio::dbus_interface> thresholdInterfaceCritical;
+ std::shared_ptr<sdbusplus::asio::dbus_interface> association;
double value = std::numeric_limits<double>::quiet_NaN();
double overriddenValue = std::numeric_limits<double>::quiet_NaN();
bool overridenState = false;
@@ -49,6 +50,17 @@
void
setInitialProperties(std::shared_ptr<sdbusplus::asio::connection>& conn)
{
+ if (association)
+ {
+ using Association =
+ std::tuple<std::string, std::string, std::string>;
+ std::vector<Association> associations;
+ associations.push_back(
+ Association("inventory", "sensors", configurationPath));
+ association->register_property("associations", associations);
+ association->initialize();
+ }
+
sensorInterface->register_property("MaxValue", maxValue);
sensorInterface->register_property("MinValue", minValue);
sensorInterface->register_property(