summaryrefslogtreecommitdiffstats
path: root/sdbusplus.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'sdbusplus.hpp')
-rw-r--r--sdbusplus.hpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/sdbusplus.hpp b/sdbusplus.hpp
index 1efe54d..3fc9b9e 100644
--- a/sdbusplus.hpp
+++ b/sdbusplus.hpp
@@ -128,6 +128,44 @@ class SDBusPlus
std::forward<Args>(args)...);
}
+ /** @brief Get subtree from the mapper. */
+ static auto getSubTree(
+ sdbusplus::bus::bus& bus,
+ const std::string& path,
+ const std::string& interface,
+ int32_t depth)
+ {
+ using namespace std::literals::string_literals;
+
+ using Path = std::string;
+ using Intf = std::string;
+ using Serv = std::string;
+ using Intfs = std::vector<Intf>;
+ using Objects = std::map<Path, std::map<Serv, Intfs>>;
+ Intfs intfs = {interface};
+
+ auto mapperResp = callMethodAndRead<Objects>(
+ bus,
+ "xyz.openbmc_project.ObjectMapper"s,
+ "/xyz/openbmc_project/object_mapper"s,
+ "xyz.openbmc_project.ObjectMapper"s,
+ "GetSubTree"s,
+ path,
+ depth,
+ intfs);
+
+ if (mapperResp.empty())
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Empty response from mapper GetSubTree",
+ phosphor::logging::entry("SUBTREE=%s", path.c_str()),
+ phosphor::logging::entry(
+ "INTERFACE=%s", interface.c_str()),
+ phosphor::logging::entry("DEPTH=%u", depth));
+ phosphor::logging::elog<detail::errors::InternalFailure>();
+ }
+ return mapperResp;
+ }
/** @brief Get service from the mapper. */
static auto getService(
OpenPOWER on IntegriCloud