Reducing the dbus string constants

There are a large number of dbus constants scattered throughout the
code that could/should be obtained from phosphor-dbus-interface values.
Some of the minor refactoring is done in this commit to reduce the
dbus string constants.

Change-Id: I2a8441e9ab275e8f2a72c3c79a6ed80e6e444f46
Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com>
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index 7ab075d..a6ac666 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -8,6 +8,7 @@
 #include <libpldm/oem/ibm/entity.h>
 
 #include <phosphor-logging/lg2.hpp>
+#include <xyz/openbmc_project/State/BMC/client.hpp>
 
 PHOSPHOR_LOG2_USING;
 
@@ -575,12 +576,14 @@
 }
 int pldm::responder::oem_ibm_platform::Handler::checkBMCState()
 {
+    using BMC = sdbusplus::client::xyz::openbmc_project::state::BMC<>;
+    auto bmcPath = sdbusplus::message::object_path(BMC::namespace_path::value) /
+                   BMC::namespace_path::bmc;
     try
     {
         pldm::utils::PropertyValue propertyValue =
             pldm::utils::DBusHandler().getDbusPropertyVariant(
-                "/xyz/openbmc_project/state/bmc0", "CurrentBMCState",
-                "xyz.openbmc_project.State.BMC");
+                bmcPath.str.c_str(), "CurrentBMCState", BMC::interface);
 
         if (std::get<std::string>(propertyValue) ==
             "xyz.openbmc_project.State.BMC.BMCState.NotReady")
diff --git a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
index 432bfd4..5d9eea5 100644
--- a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
+++ b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
@@ -7,6 +7,7 @@
 
 #include <phosphor-logging/lg2.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/State/Boot/Progress/client.hpp>
 
 #include <iostream>
 
@@ -23,22 +24,26 @@
     const std::vector<uint16_t>& handles,
     pldm::requester::Handler<pldm::requester::Request>* handler)
 {
+    using BootProgress =
+        sdbusplus::client::xyz::openbmc_project::state::boot::Progress<>;
+
     constexpr auto hostStatePath = "/xyz/openbmc_project/state/host0";
-    constexpr auto hostStateInterface =
-        "xyz.openbmc_project.State.Boot.Progress";
     constexpr auto hostStateProperty = "BootProgress";
 
     try
     {
         auto propVal = pldm::utils::DBusHandler().getDbusPropertyVariant(
-            hostStatePath, hostStateProperty, hostStateInterface);
+            hostStatePath, hostStateProperty, BootProgress::interface);
         const auto& currHostState = std::get<std::string>(propVal);
-        if ((currHostState != "xyz.openbmc_project.State.Boot.Progress."
-                              "ProgressStages.SystemInitComplete") &&
-            (currHostState != "xyz.openbmc_project.State.Boot.Progress."
-                              "ProgressStages.OSRunning") &&
-            (currHostState != "xyz.openbmc_project.State.Boot.Progress."
-                              "ProgressStages.SystemSetup"))
+        if ((sdbusplus::message::convert_from_string<
+                 BootProgress::ProgressStages>(currHostState) !=
+             BootProgress::ProgressStages::SystemInitComplete) &&
+            (sdbusplus::message::convert_from_string<
+                 BootProgress::ProgressStages>(currHostState) !=
+             BootProgress::ProgressStages::OSRunning) &&
+            (sdbusplus::message::convert_from_string<
+                 BootProgress::ProgressStages>(currHostState) !=
+             BootProgress::ProgressStages::SystemSetup))
         {
             return PLDM_SUCCESS;
         }