State.Host: use PDI constants

Pull string literals from PDI for xyz.openbmc_project.State.Host
interface.

Tested: Inspection only.

Change-Id: Ia5ea6e67fc6c6925c3febcc28503408d5c028075
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index de828ec..46d4475 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -12,6 +12,7 @@
 #include <sdeventplus/exception.hpp>
 #include <sdeventplus/source/io.hpp>
 #include <sdeventplus/source/time.hpp>
+#include <xyz/openbmc_project/State/Host/client.hpp>
 
 #include <cassert>
 #include <fstream>
@@ -19,6 +20,8 @@
 
 PHOSPHOR_LOG2_USING;
 
+using HostState = sdbusplus::common::xyz::openbmc_project::state::Host;
+
 namespace pldm
 {
 using namespace pldm::responder::events;
@@ -98,12 +101,13 @@
     hostOffMatch = std::make_unique<sdbusplus::bus::match_t>(
         pldm::utils::DBusHandler::getBus(),
         propertiesChanged("/xyz/openbmc_project/state/host0",
-                          "xyz.openbmc_project.State.Host"),
+                          HostState::interface),
         [this, repo, entityTree, bmcEntityTree](sdbusplus::message_t& msg) {
             DbusChangedProps props{};
             std::string intf;
             msg.read(intf, props);
-            const auto itr = props.find("CurrentHostState");
+            const auto itr =
+                props.find(HostState::property_names::current_host_state);
             if (itr != props.end())
             {
                 PropertyValue value = itr->second;
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index 86fc0d8..2a3b0b7 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -879,7 +879,8 @@
         {
             restartCause =
                 pldm::utils::DBusHandler().getDbusProperty<std::string>(
-                    "/xyz/openbmc_project/state/host0", "RestartCause",
+                    "/xyz/openbmc_project/state/host0",
+                    HostState::property_names::restart_cause,
                     sdbusplus::common::xyz::openbmc_project::state::Host::
                         interface);
             setBootTypesBiosAttr(restartCause);
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
index 380a256..6c175aa 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
@@ -16,9 +16,12 @@
 #include <sdbusplus/bus/match.hpp>
 #include <sdeventplus/event.hpp>
 #include <sdeventplus/utility/timer.hpp>
+#include <xyz/openbmc_project/State/Host/client.hpp>
 
 typedef ibm_oem_pldm_state_set_firmware_update_state_values CodeUpdateState;
 
+using HostState = sdbusplus::common::xyz::openbmc_project::state::Host;
+
 namespace pldm
 {
 namespace responder
@@ -71,12 +74,13 @@
         hostOffMatch = std::make_unique<sdbusplus::bus::match_t>(
             pldm::utils::DBusHandler::getBus(),
             propertiesChanged("/xyz/openbmc_project/state/host0",
-                              "xyz.openbmc_project.State.Host"),
+                              HostState::interface),
             [this](sdbusplus::message_t& msg) {
                 pldm::utils::DbusChangedProps props{};
                 std::string intf;
                 msg.read(intf, props);
-                const auto itr = props.find("CurrentHostState");
+                const auto itr =
+                    props.find(HostState::property_names::current_host_state);
                 if (itr != props.end())
                 {
                     pldm::utils::PropertyValue value = itr->second;
diff --git a/oem/meta/libpldmresponder/file_io_type_power_control.cpp b/oem/meta/libpldmresponder/file_io_type_power_control.cpp
index a2cd705..32de91d 100644
--- a/oem/meta/libpldmresponder/file_io_type_power_control.cpp
+++ b/oem/meta/libpldmresponder/file_io_type_power_control.cpp
@@ -1,8 +1,12 @@
 #include "file_io_type_power_control.hpp"
 
 #include <phosphor-logging/lg2.hpp>
+#include <xyz/openbmc_project/State/Host/client.hpp>
 
 PHOSPHOR_LOG2_USING;
+
+using HostState = sdbusplus::common::xyz::openbmc_project::state::Host;
+
 namespace pldm::responder::oem_meta
 {
 
@@ -52,9 +56,11 @@
             break;
         case static_cast<uint8_t>(POWER_CONTROL_OPTION::SLOT_DC_CYCLE):
             dbusMapping.objectPath =
-                std::string("/xyz/openbmc_project/state/host") + slotNum;
-            dbusMapping.interface = "xyz.openbmc_project.State.Host";
-            dbusMapping.propertyName = "RequestedHostTransition";
+                std::format("{}/{}{}", HostState::namespace_path::value,
+                            HostState::namespace_path::host, slotNum);
+            dbusMapping.interface = HostState::interface;
+            dbusMapping.propertyName =
+                HostState::property_names::requested_host_transition;
             property = "xyz.openbmc_project.State.Host.Transition.Reboot";
             break;
         case static_cast<uint8_t>(POWER_CONTROL_OPTION::NIC0_POWER_CYCLE):
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index 71fa9dc..e097988 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -22,6 +22,8 @@
 
 PHOSPHOR_LOG2_USING;
 
+using HostState = sdbusplus::common::xyz::openbmc_project::state::Host;
+
 namespace pldm
 {
 using namespace sdeventplus;
@@ -98,8 +100,9 @@
     {
         pldm::utils::PropertyValue propertyValue =
             pldm::utils::DBusHandler().getDbusPropertyVariant(
-                "/xyz/openbmc_project/state/host0", "CurrentHostState",
-                "xyz.openbmc_project.State.Host");
+                "/xyz/openbmc_project/state/host0",
+                HostState::property_names::current_host_state,
+                HostState::interface);
 
         if ((std::get<std::string>(propertyValue) !=
              "xyz.openbmc_project.State.Host.HostState.Running") &&
@@ -282,7 +285,8 @@
     uint8_t effecterState;
     auto requestHostTransition =
         pldm::utils::DBusHandler().getDbusProperty<std::string>(
-            "/xyz/openbmc_project/state/host0", "RequestedHostTransition",
+            "/xyz/openbmc_project/state/host0",
+            HostState::property_names::requested_host_transition,
             sdbusplus::common::xyz::openbmc_project::state::Host::interface);
     if (requestHostTransition !=
         "xyz.openbmc_project.State.Host.Transition.Off")