summaryrefslogtreecommitdiff
path: root/include/dbus_utility.hpp
diff options
context:
space:
mode:
authorGeorge Liu <liuxiwei@inspur.com>2023-03-01 05:37:08 +0300
committerEd Tanous <ed@tanous.net>2023-03-17 05:05:23 +0300
commitf5892d0d56accc51deb5e4ad1bbdad6028784c16 (patch)
tree7e343f5186cad9f09d20dceec37db2a884e48dcb /include/dbus_utility.hpp
parent915d2d4e59be56958b04a79ba96e0242ef735f44 (diff)
downloadbmcweb-f5892d0d56accc51deb5e4ad1bbdad6028784c16.tar.xz
Add the GetManagedObjects method to dbus_utility
There are currently many files that use the GetManagedObjects method. Since they are a general method, they are defined in the dbus_utility.hpp file and refactors them. Tested: 1. Built bmcweb successfully and Validator passes. 2. We got the same result as previously in the ethernet schema. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I0c25b7b6b9421bea46ff0afadbaa4783b704e664
Diffstat (limited to 'include/dbus_utility.hpp')
-rw-r--r--include/dbus_utility.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index ea0610126a..854c2c1709 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -206,5 +206,20 @@ inline void getAssociationEndPoints(
"xyz.openbmc_project.Association", "endpoints", std::move(callback));
}
+inline void
+ getManagedObjects(const std::string& service,
+ const sdbusplus::message::object_path& path,
+ std::function<void(const boost::system::error_code&,
+ const ManagedObjectType&)>&& callback)
+{
+ crow::connections::systemBus->async_method_call(
+ [callback{std::move(callback)}](const boost::system::error_code& ec,
+ const ManagedObjectType& objects) {
+ callback(ec, objects);
+ },
+ service, path, "org.freedesktop.DBus.ObjectManager",
+ "GetManagedObjects");
+}
+
} // namespace utility
} // namespace dbus