Control.FanPwm: use PDI constants
Use PDI constants instead of local definitions.
Tested: Unit Tests Pass
Change-Id: Iac724d87ddac326d825b843675f314decd6e0de4
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/dbus/dbuswrite.cpp b/dbus/dbuswrite.cpp
index efb7dee..8a87116 100644
--- a/dbus/dbuswrite.cpp
+++ b/dbus/dbuswrite.cpp
@@ -22,6 +22,7 @@
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/exception.hpp>
+#include <xyz/openbmc_project/Control/FanPwm/client.hpp>
#include <cstdint>
#include <exception>
@@ -29,11 +30,11 @@
#include <string>
#include <variant>
+using ControlFanPwm = sdbusplus::common::xyz::openbmc_project::control::FanPwm;
+
namespace pid_control
{
-constexpr const char* pwmInterface = "xyz.openbmc_project.Control.FanPwm";
-
using namespace phosphor::logging;
std::unique_ptr<WriteInterface> DbusWritePercent::createDbusWrite(
@@ -44,7 +45,7 @@
try
{
- connectionName = helper->getService(pwmInterface, path);
+ connectionName = helper->getService(ControlFanPwm::interface, path);
}
catch (const std::exception& e)
{
@@ -83,7 +84,7 @@
auto mesg =
writeBus.new_method_call(connectionName.c_str(), path.c_str(),
"org.freedesktop.DBus.Properties", "Set");
- mesg.append(pwmInterface, "Target",
+ mesg.append(ControlFanPwm::interface, ControlFanPwm::property_names::target,
std::variant<uint64_t>(static_cast<uint64_t>(ovalue)));
try
@@ -113,7 +114,7 @@
try
{
- connectionName = helper->getService(pwmInterface, path);
+ connectionName = helper->getService(ControlFanPwm::interface, path);
}
catch (const std::exception& e)
{
@@ -145,7 +146,7 @@
auto mesg =
writeBus.new_method_call(connectionName.c_str(), path.c_str(),
"org.freedesktop.DBus.Properties", "Set");
- mesg.append(pwmInterface, "Target",
+ mesg.append(ControlFanPwm::interface, ControlFanPwm::property_names::target,
std::variant<uint64_t>(static_cast<uint64_t>(value)));
try