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.hpp b/occ_manager.hpp
index 4db762c..c4218c9 100644
--- a/occ_manager.hpp
+++ b/occ_manager.hpp
@@ -6,6 +6,7 @@
#include "pldm.hpp"
#endif
#include "powercap.hpp"
+#include "utils.hpp"
#include <cstring>
#include <functional>
@@ -39,11 +40,10 @@
/** @brief Adds OCC pass-through and status objects on the bus
* when corresponding CPU inventory is created.
*
- * @param[in] bus - handle to the bus
* @param[in] event - Unique ptr reference to sd_event
*/
- Manager(sdbusplus::bus::bus& bus, EventPtr& event) :
- bus(bus), event(event), pollInterval(defaultPollingInterval),
+ Manager(EventPtr& event) :
+ event(event), pollInterval(defaultPollingInterval),
sdpEvent(sdeventplus::Event::get_default()),
_pollTimer(
std::make_unique<
@@ -52,8 +52,8 @@
#ifdef PLDM
,
pldmHandle(std::make_unique<pldm::Interface>(
- bus, std::bind(std::mem_fn(&Manager::updateOCCActive), this,
- std::placeholders::_1, std::placeholders::_2)))
+ std::bind(std::mem_fn(&Manager::updateOCCActive), this,
+ std::placeholders::_1, std::placeholders::_2)))
#endif
{
@@ -107,9 +107,6 @@
/** @brief Sends a Heartbeat command to host control command handler */
void sendHeartBeat();
- /** @brief reference to the bus */
- sdbusplus::bus::bus& bus;
-
/** @brief reference to sd_event wrapped in unique_ptr */
EventPtr& event;