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/app.cpp b/app.cpp
index 260e27b..a26fa3c 100644
--- a/app.cpp
+++ b/app.cpp
@@ -3,6 +3,7 @@
#include "elog-errors.hpp"
#include "occ_events.hpp"
#include "occ_manager.hpp"
+#include "utils.hpp"
#include <org/open_power/OCC/Device/error.hpp>
#include <phosphor-logging/elog.hpp>
@@ -17,7 +18,7 @@
int main(int argc, char* argv[])
{
- auto bus = sdbusplus::bus::new_default();
+ auto& bus = open_power::occ::utils::getBus();
// Need sd_event to watch for OCC device errors
sd_event* event = nullptr;
@@ -34,7 +35,7 @@
bus.attach_event(eventP.get(), SD_EVENT_PRIORITY_NORMAL);
sdbusplus::server::manager::manager objManager(bus, OCC_CONTROL_ROOT);
- open_power::occ::Manager mgr(bus, eventP);
+ open_power::occ::Manager mgr(eventP);
// Claim the bus since all the house keeping is done now
bus.request_name(OCC_CONTROL_BUSNAME);