Refactor GetSubTreePaths method

Since the GetSubTreePaths method has been implemented in dbus_utility
and this commit is to integrate all the places where the
GetSubTreePaths method is called, and use the method in dbus_utility
uniformly.

Requires https://gerrit.openbmc.org/c/openbmc/sdbusplus/+/60020 to
build.

Tested: Redfish Validator Passed

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ie4140d4484a7e4f4b943013f4371ffd2d44a22e9
diff --git a/redfish-core/include/utils/collection.hpp b/redfish-core/include/utils/collection.hpp
index f117302..b66ab5d 100644
--- a/redfish-core/include/utils/collection.hpp
+++ b/redfish-core/include/utils/collection.hpp
@@ -1,8 +1,12 @@
 #pragma once
 
+#include "dbus_utility.hpp"
+
 #include <human_sort.hpp>
 
+#include <span>
 #include <string>
+#include <string_view>
 #include <vector>
 
 namespace redfish
@@ -25,14 +29,15 @@
 inline void
     getCollectionMembers(std::shared_ptr<bmcweb::AsyncResp> aResp,
                          const boost::urls::url& collectionPath,
-                         const std::vector<const char*>& interfaces,
+                         std::span<const std::string_view> interfaces,
                          const char* subtree = "/xyz/openbmc_project/inventory")
 {
     BMCWEB_LOG_DEBUG << "Get collection members for: "
                      << collectionPath.buffer();
-    crow::connections::systemBus->async_method_call(
+    dbus::utility::getSubTreePaths(
+        subtree, 0, interfaces,
         [collectionPath, aResp{std::move(aResp)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::MapperGetSubTreePathsResponse& objects) {
         if (ec == boost::system::errc::io_error)
         {
@@ -73,11 +78,7 @@
             members.push_back(std::move(member));
         }
         aResp->res.jsonValue["Members@odata.count"] = members.size();
-        },
-        "xyz.openbmc_project.ObjectMapper",
-        "/xyz/openbmc_project/object_mapper",
-        "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", subtree, 0,
-        interfaces);
+        });
 }
 
 } // namespace collection_util