summaryrefslogtreecommitdiff
path: root/include/dbus_utility.hpp
diff options
context:
space:
mode:
authorWilly Tu <wltu@google.com>2023-04-14 19:14:16 +0300
committerEd Tanous <ed@tanous.net>2023-04-25 19:22:59 +0300
commit8d01836c4c6db41bfd5e67be2a363f193cb4d0c5 (patch)
tree0c1754e1c079075e5a81d9387c3215a53fb2c5b5 /include/dbus_utility.hpp
parent5880f0c5ac700a78abf6b2a89afe5030a8d2f825 (diff)
downloadbmcweb-8d01836c4c6db41bfd5e67be2a363f193cb4d0c5.tar.xz
dbus_utility: Support new ObjectMapper methods
The new ObjectMapper methods are added as part of https://gerrit.openbmc.org/c/openbmc/phosphor-objmgr/+/57822 - GetAssociatedSubTree - GetAssociatedSubTreePaths The two methods are meant to be used to replace places where two dbus calls are used to get subtree and then get associated objects. Change-Id: I80a7ea935700a1ac5aebe6271f242aa103cc3d59 Signed-off-by: Willy Tu <wltu@google.com>
Diffstat (limited to 'include/dbus_utility.hpp')
-rw-r--r--include/dbus_utility.hpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index 73952a2d57..b2788829ce 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -189,6 +189,42 @@ inline void getSubTreePaths(
interfaces);
}
+inline void getAssociatedSubTree(
+ const sdbusplus::message::object_path& associatedPath,
+ const sdbusplus::message::object_path& path, int32_t depth,
+ std::span<const std::string_view> interfaces,
+ std::function<void(const boost::system::error_code&,
+ const MapperGetSubTreeResponse&)>&& callback)
+{
+ crow::connections::systemBus->async_method_call(
+ [callback{std::move(callback)}](
+ const boost::system::error_code& ec,
+ const MapperGetSubTreeResponse& subtree) { callback(ec, subtree); },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetAssociatedSubTree",
+ associatedPath, path, depth, interfaces);
+}
+
+inline void getAssociatedSubTreePaths(
+ const sdbusplus::message::object_path& associatedPath,
+ const sdbusplus::message::object_path& path, int32_t depth,
+ std::span<const std::string_view> interfaces,
+ std::function<void(const boost::system::error_code&,
+ const MapperGetSubTreePathsResponse&)>&& callback)
+{
+ crow::connections::systemBus->async_method_call(
+ [callback{std::move(callback)}](
+ const boost::system::error_code& ec,
+ const MapperGetSubTreePathsResponse& subtreePaths) {
+ callback(ec, subtreePaths);
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetAssociatedSubTreePaths",
+ associatedPath, path, depth, interfaces);
+}
+
inline void
getDbusObject(const std::string& path,
std::span<const std::string_view> interfaces,