summaryrefslogtreecommitdiff
path: root/redfish-core/include/utils/chassis_utils.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'redfish-core/include/utils/chassis_utils.hpp')
-rw-r--r--redfish-core/include/utils/chassis_utils.hpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/redfish-core/include/utils/chassis_utils.hpp b/redfish-core/include/utils/chassis_utils.hpp
index b7f16d83d0..33e8bb7070 100644
--- a/redfish-core/include/utils/chassis_utils.hpp
+++ b/redfish-core/include/utils/chassis_utils.hpp
@@ -1,6 +1,12 @@
#pragma once
+
+#include "dbus_utility.hpp"
+
#include <async_resp.hpp>
+#include <array>
+#include <string_view>
+
namespace redfish
{
@@ -16,13 +22,15 @@ void getValidChassisPath(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& chassisId, Callback&& callback)
{
BMCWEB_LOG_DEBUG << "checkChassisId enter";
- const std::array<const char*, 2> interfaces = {
+ constexpr std::array<std::string_view, 2> interfaces = {
"xyz.openbmc_project.Inventory.Item.Board",
"xyz.openbmc_project.Inventory.Item.Chassis"};
- auto respHandler =
+ // Get the Chassis Collection
+ dbus::utility::getSubTreePaths(
+ "/xyz/openbmc_project/inventory", 0, interfaces,
[callback{std::forward<Callback>(callback)}, asyncResp,
- chassisId](const boost::system::error_code ec,
+ chassisId](const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreePathsResponse&
chassisPaths) mutable {
BMCWEB_LOG_DEBUG << "getValidChassisPath respHandler enter";
@@ -51,14 +59,7 @@ void getValidChassisPath(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
}
}
callback(chassisPath);
- };
-
- // Get the Chassis Collection
- crow::connections::systemBus->async_method_call(
- respHandler, "xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
- "/xyz/openbmc_project/inventory", 0, interfaces);
+ });
BMCWEB_LOG_DEBUG << "checkChassisId exit";
}