Add async_method_call to utility
Adding async_method_call in dbus utility gives us a place where we can
intercept method call requests from dbus to potentially add
logging/caching.
An example of logging is in the later commit:
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/78265/
We already do this for setProperty, this moves the method calls to
follow a similar pattern.
Tested: Redfish service validator passes.
Change-Id: I6d2c96e2b6b6a023ed2138106a55faebca161592
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 967c934..f651c38 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -103,7 +103,7 @@
transaction->res.jsonValue["objects"] = nlohmann::json::array();
}
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[transaction, processName{std::string(processName)},
objectPath{std::string(objectPath)}](
const boost::system::error_code& ec,
@@ -335,7 +335,7 @@
{
BMCWEB_LOG_DEBUG("Finding objectmanager for path {} on connection:{}",
objectName, connectionName);
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[transaction, objectName, connectionName](
const boost::system::error_code& ec,
const dbus::utility::MapperGetAncestorsResponse& objects) {
@@ -1362,7 +1362,7 @@
const std::string& connectionName)
{
BMCWEB_LOG_DEBUG("findActionOnInterface for connection {}", connectionName);
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[transaction, connectionName{std::string(connectionName)}](
const boost::system::error_code& ec,
const std::string& introspectXml) {
@@ -1896,7 +1896,7 @@
{
const std::string& connectionName = connection.first;
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[connectionName{std::string(connectionName)},
transaction](const boost::system::error_code& ec3,
const std::string& introspectXml) {
@@ -2183,7 +2183,7 @@
}
if (interfaceName.empty())
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[asyncResp, processName,
objectPath](const boost::system::error_code& ec,
const std::string& introspectXml) {
@@ -2237,7 +2237,7 @@
}
else if (methodName.empty())
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[asyncResp, processName, objectPath,
interfaceName](const boost::system::error_code& ec,
const std::string& introspectXml) {
@@ -2504,7 +2504,7 @@
}
}
};
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
std::move(myCallback), "org.freedesktop.DBus", "/",
"org.freedesktop.DBus", "ListNames");
});