Add associations for pwm
Pwm doesn't inheirt from Sensor as it is special, so
it needs it to be added seperate.
Tested: Saw associations on dbus
Change-Id: I2178e9346dcae845b47a013a2cc15f62e9ed9b31
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/Utils.cpp b/src/Utils.cpp
index ff06428..86afb09 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -21,6 +21,7 @@
#include <fstream>
#include <regex>
#include <sdbusplus/asio/connection.hpp>
+#include <sdbusplus/asio/object_server.hpp>
#include <sdbusplus/bus/match.hpp>
namespace fs = std::filesystem;
@@ -203,3 +204,17 @@
limits.second = std::visit(VariantToDoubleVisitor(), maxFind->second);
}
}
+
+void createAssociation(
+ std::shared_ptr<sdbusplus::asio::dbus_interface>& association,
+ const std::string& path)
+{
+ if (association)
+ {
+ using Association = std::tuple<std::string, std::string, std::string>;
+ std::vector<Association> associations;
+ associations.push_back(Association("inventory", "sensors", path));
+ association->register_property("associations", associations);
+ association->initialize();
+ }
+}
\ No newline at end of file