Add the GetObject method to dbus_utility
There are currently many files that use the GetObject method.
Since they are a general method, they are defined in the
dbus_utility.hpp file and refactors them.
Tested: Built bmcweb successfully and Validator passes.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: If2af77294389b023b611987252ee6149906fcd25
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index a9174a1..a8f0a6c 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -28,6 +28,9 @@
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/unpack_properties.hpp>
+#include <array>
+#include <string_view>
+
namespace redfish
{
@@ -87,9 +90,12 @@
if (interface.first == "xyz.openbmc_project.Software.Activation")
{
// Retrieve service and activate
- crow::connections::systemBus->async_method_call(
+ constexpr std::array<std::string_view, 1> interfaces = {
+ "xyz.openbmc_project.Software.Activation"};
+ dbus::utility::getDbusObject(
+ objPath.str, interfaces,
[objPath, asyncResp, payload(std::move(payload))](
- const boost::system::error_code errorCode,
+ const boost::system::error_code& errorCode,
const std::vector<
std::pair<std::string, std::vector<std::string>>>&
objInfo) mutable {
@@ -246,12 +252,7 @@
task->payload.emplace(std::move(payload));
}
fwUpdateInProgress = false;
- },
- "xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str,
- std::array<const char*, 1>{
- "xyz.openbmc_project.Software.Activation"});
+ });
break;
}