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_manager.cpp b/occ_manager.cpp
index fc9a112..4b209da 100644
--- a/occ_manager.cpp
+++ b/occ_manager.cpp
@@ -3,7 +3,6 @@
#include "occ_manager.hpp"
#include "i2c_occ.hpp"
-#include "occ_finder.hpp"
#include "utils.hpp"
#include <experimental/filesystem>
@@ -50,10 +49,10 @@
auto path = fs::path(OCC_CONTROL_ROOT) / occ;
passThroughObjects.emplace_back(
- std::make_unique<PassThrough>(bus, path.c_str()));
+ std::make_unique<PassThrough>(path.c_str()));
statusObjects.emplace_back(std::make_unique<Status>(
- bus, event, path.c_str(), *this,
+ event, path.c_str(), *this,
std::bind(std::mem_fn(&Manager::statusCallBack), this,
std::placeholders::_1)
#ifdef PLDM
@@ -67,7 +66,7 @@
if (!pcap)
{
pcap = std::make_unique<open_power::occ::powercap::PowerCap>(
- bus, *statusObjects.front());
+ *statusObjects.front());
}
}
@@ -128,11 +127,11 @@
name = std::string(OCC_NAME) + '_' + name;
auto path = fs::path(OCC_CONTROL_ROOT) / name;
statusObjects.emplace_back(
- std::make_unique<Status>(bus, event, path.c_str(), *this));
+ std::make_unique<Status>(event, path.c_str(), *this));
}
// The first device is master occ
pcap = std::make_unique<open_power::occ::powercap::PowerCap>(
- bus, *statusObjects.front(), occMasterName);
+ *statusObjects.front(), occMasterName);
}
#endif