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_pass_through.cpp b/occ_pass_through.cpp
index 11ef469..a53cba4 100644
--- a/occ_pass_through.cpp
+++ b/occ_pass_through.cpp
@@ -21,15 +21,16 @@
namespace occ
{
-PassThrough::PassThrough(sdbusplus::bus::bus& bus, const char* path) :
- Iface(bus, path), path(path),
+PassThrough::PassThrough(const char* path) :
+ Iface(utils::getBus(), path), path(path),
devicePath(OCC_DEV_PATH + std::to_string((this->path.back() - '0') + 1)),
occInstance(this->path.back() - '0'),
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(&PassThrough::activeStatusEvent), this,
std::placeholders::_1)),
- occCmd(occInstance, bus, path)
+ occCmd(occInstance, path)
{
// Nothing to do.
}