summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGeorge Liu <liuxiwei@inspur.com>2023-06-20 12:03:24 +0300
committerEd Tanous <ed@tanous.net>2023-06-20 19:29:29 +0300
commit5eb468da982d6b02cafc6d3b7e4413d01b28be80 (patch)
tree4bc0524b9f38b93dace0a2a191575e8c8a216058 /include
parentc3b3ad033400cc455cdce6601a982fa94405e84a (diff)
downloadbmcweb-5eb468da982d6b02cafc6d3b7e4413d01b28be80.tar.xz
Refactor getManagedObjects method
Since the getManagedObjects method has been implemented in dbus_utility and this commit is to integrate all the places where the GetManagedObjects method is obtained, and use the method in dbus_utility uniformly. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ic13f2bef7b30f805cd3444a75d7df17b031f2eb0
Diffstat (limited to 'include')
-rw-r--r--include/nbd_proxy.hpp10
-rw-r--r--include/openbmc_dbus_rest.hpp8
2 files changed, 8 insertions, 10 deletions
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index e4d709b65e..62bd324363 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -327,15 +327,13 @@ inline void onOpen(crow::websocket::Connection& conn)
{
BMCWEB_LOG_DEBUG << "nbd-proxy.onopen(" << &conn << ")";
- auto openHandler =
+ sdbusplus::message::object_path path("/xyz/openbmc_project/VirtualMedia");
+ dbus::utility::getManagedObjects(
+ "xyz.openbmc_project.VirtualMedia", path,
[&conn](const boost::system::error_code& ec,
const dbus::utility::ManagedObjectType& objects) {
afterGetManagedObjects(conn, ec, objects);
- };
- crow::connections::systemBus->async_method_call(
- std::move(openHandler), "xyz.openbmc_project.VirtualMedia",
- "/xyz/openbmc_project/VirtualMedia",
- "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
+ });
// We need to wait for dbus and the websockets to hook up before data is
// sent/received. Tell the core to hold off messages until the sockets are
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 0fbef04921..4dbf12e910 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -302,7 +302,9 @@ inline void getManagedObjectsForEnumerate(
BMCWEB_LOG_DEBUG << "getManagedObjectsForEnumerate " << objectName
<< " object_manager_path " << objectManagerPath
<< " connection_name " << connectionName;
- crow::connections::systemBus->async_method_call(
+ sdbusplus::message::object_path path(objectManagerPath);
+ dbus::utility::getManagedObjects(
+ connectionName, path,
[transaction, objectName,
connectionName](const boost::system::error_code& ec,
const dbus::utility::ManagedObjectType& objects) {
@@ -360,9 +362,7 @@ inline void getManagedObjectsForEnumerate(
}
}
}
- },
- connectionName, objectManagerPath, "org.freedesktop.DBus.ObjectManager",
- "GetManagedObjects");
+ });
}
inline void findObjectManagerPathForEnumerate(