Add getSubtreePaths utility functions
Added a getSubTreePaths utility function that can return the
subtree dbus paths that implement the particular dbus interface.
Change-Id: Ifb8f6d571bcb2291ca3a47f285ebf46261646496
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/common/utils.cpp b/common/utils.cpp
index e9b2c68..72104a5 100644
--- a/common/utils.cpp
+++ b/common/utils.cpp
@@ -448,6 +448,22 @@
return response;
}
+GetSubTreePathsResponse DBusHandler::getSubTreePaths(
+ const std::string& objectPath, int depth,
+ const std::vector<std::string>& ifaceList) const
+{
+ std::vector<std::string> paths;
+ auto& bus = pldm::utils::DBusHandler::getBus();
+ auto method = bus.new_method_call(
+ ObjectMapper::default_service, ObjectMapper::instance_path,
+ ObjectMapper::interface, "GetSubTreePaths");
+ method.append(objectPath, depth, ifaceList);
+ auto reply = bus.call(method, dbusTimeout);
+
+ reply.read(paths);
+ return paths;
+}
+
void reportError(const char* errorMsg)
{
auto& bus = pldm::utils::DBusHandler::getBus();