Refactor D-Bus object
- The intent behind this commit is to refactor D-Bus, and abstract
the bus, getService, getProperty and other methods into the utils
file, and other file operations D-Bus only need to include
uitls.hpp.
- We can also continue to add other general methods such as
setPropery, getSubTree in the utils file in the future.
- Also, removed redundant files(occ_finder.hpp and occ_finder.cpp).
Tested: built openpower-occ-control successfully and worked.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I53e61e30a76173c154a9f47fc122936468abbc4b
diff --git a/occ_command.cpp b/occ_command.cpp
index e9b03a9..d07c06f 100644
--- a/occ_command.cpp
+++ b/occ_command.cpp
@@ -56,13 +56,12 @@
}
}
-OccCommand::OccCommand(uint8_t instance, sdbusplus::bus::bus& bus,
- const char* path) :
- occInstance(instance),
- path(path),
+OccCommand::OccCommand(uint8_t instance, const char* path) :
+ occInstance(instance), path(path),
devicePath(OCC_DEV_PATH + std::to_string((this->path.back() - '0') + 1)),
activeStatusSignal(
- bus, sdbusRule::propertiesChanged(path, "org.open_power.OCC.Status"),
+ utils::getBus(),
+ sdbusRule::propertiesChanged(path, "org.open_power.OCC.Status"),
std::bind(std::mem_fn(&OccCommand::activeStatusEvent), this,
std::placeholders::_1))
{