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")