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/chassis_state_manager_main.cpp b/chassis_state_manager_main.cpp
index 377786e..0d169b9 100644
--- a/chassis_state_manager_main.cpp
+++ b/chassis_state_manager_main.cpp
@@ -17,6 +17,8 @@
constexpr auto LEGACY_STATE_CHANGE_PERSIST_PATH =
"/var/lib/phosphor-state-manager/chassisStateChangeTime";
+using ChassisState = sdbusplus::server::xyz::openbmc_project::state::Chassis;
+
int main(int argc, char** argv)
{
size_t chassisId = 0;
@@ -41,9 +43,12 @@
auto bus = sdbusplus::bus::new_default();
- auto chassisBusName =
- std::string{CHASSIS_BUSNAME} + std::to_string(chassisId);
- auto objPathInst = std::string{CHASSIS_OBJPATH} + std::to_string(chassisId);
+ auto chassisBusName = ChassisState::interface + std::to_string(chassisId);
+ const auto* objPath = ChassisState::namespace_path::value;
+ auto chassisName = std::string(ChassisState::namespace_path::chassis) +
+ std::to_string(chassisId);
+ std::string objPathInst =
+ sdbusplus::message::object_path(objPath) / chassisName;
if (chassisId == 0)
{
@@ -77,7 +82,7 @@
// input id is 0.
if (chassisId == 0)
{
- bus.request_name(CHASSIS_BUSNAME);
+ bus.request_name(ChassisState::interface);
}
bus.request_name(chassisBusName.c_str());