Sensor.Value: use PDI constants
Use PDI constants instead of local definitions.
Tested: Unit Tests Pass
Change-Id: I6b513155afa760da52dc7421eedcfe78ff3a816d
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/setsensor.cpp b/setsensor.cpp
index faca6b7..3933e5d 100644
--- a/setsensor.cpp
+++ b/setsensor.cpp
@@ -1,6 +1,7 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/exception.hpp>
#include <sdbusplus/message.hpp>
+#include <xyz/openbmc_project/Sensor/Value/client.hpp>
#include <cstdint>
#include <cstdio>
@@ -14,12 +15,12 @@
static constexpr auto property = "Manual";
using Value = std::variant<bool>;
+using SensorValue = sdbusplus::common::xyz::openbmc_project::sensor::Value;
+
/* Host Sensor. */
static constexpr auto sobjectPath =
"/xyz/openbmc_project/extsensors/margin/sluggish0";
static constexpr auto sbusName = "xyz.openbmc_project.Hwmon.external";
-static constexpr auto sintf = "xyz.openbmc_project.Sensor.Value";
-static constexpr auto sproperty = "Value";
using sValue = std::variant<int64_t>;
static constexpr auto propertiesintf = "org.freedesktop.DBus.Properties";
@@ -36,8 +37,8 @@
auto pimMsg = PropertyWriteBus.new_method_call(
busname.c_str(), path.c_str(), propertiesintf, "Set");
- pimMsg.append(sintf);
- pimMsg.append(sproperty);
+ pimMsg.append(SensorValue::interface);
+ pimMsg.append(SensorValue::property_names::value);
pimMsg.append(v);
try