Switch to Use phosphor-dbus-interface defined constants
We are redefining a lot of the constants which are already
defined in the phosphor-dbus-interface auto-generated
headers. This change switches the code to use those instead
of allowing compile time definition of those.
Allowing for compile time definition would probably break
clients who are not aware of the new paths anyway.
Tested by build a harma image and loading in qemu to test
the added interfaces are unchanged.
```
busctl introspect xyz.openbmc_project.State.BMC \
/xyz/openbmc_project/state/bmc0
busctl introspect xyz.openbmc_project.State.Host \
/xyz/openbmc_project/state/host0
busctl introspect xyz.openbmc_project.State.Chassis \
/xyz/openbmc_project/state/chassis0
```
Change-Id: Ib4c77d2789c13f509b75a2b1837ea454e53e8ae9
Signed-off-by: Amithash Prasasd <amithash@meta.com>
diff --git a/bmc_state_manager_main.cpp b/bmc_state_manager_main.cpp
index 1d6f617..f574a52 100644
--- a/bmc_state_manager_main.cpp
+++ b/bmc_state_manager_main.cpp
@@ -4,20 +4,25 @@
#include <sdbusplus/bus.hpp>
+using BMCState = sdbusplus::server::xyz::openbmc_project::state::BMC;
+
int main()
{
auto bus = sdbusplus::bus::new_default();
// For now, we only have one instance of the BMC
// 0 is for the current instance
- auto objPathInst = std::string(BMC_OBJPATH) + '0';
+ const auto* BMCName = BMCState::namespace_path::bmc;
+ const auto* objPath = BMCState::namespace_path::value;
+ std::string objPathInst =
+ sdbusplus::message::object_path(objPath) / BMCName;
// Add sdbusplus ObjectManager.
sdbusplus::server::manager_t objManager(bus, objPathInst.c_str());
phosphor::state::manager::BMC manager(bus, objPathInst.c_str());
- bus.request_name(BMC_BUSNAME);
+ bus.request_name(BMCState::interface);
while (true)
{