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/src/dbus_utility.cpp b/src/dbus_utility.cpp
index cdfd13c..54eb0aa 100644
--- a/src/dbus_utility.cpp
+++ b/src/dbus_utility.cpp
@@ -91,7 +91,7 @@
void checkDbusPathExists(const std::string& path,
std::function<void(bool)>&& callback)
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[callback = std::move(callback)](const boost::system::error_code& ec,
const MapperGetObject& objectNames) {
callback(!ec && !objectNames.empty());
@@ -107,7 +107,7 @@
std::function<void(const boost::system::error_code&,
const MapperGetSubTreeResponse&)>&& callback)
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[callback{std::move(callback)}](
const boost::system::error_code& ec,
const MapperGetSubTreeResponse& subtree) { callback(ec, subtree); },
@@ -123,7 +123,7 @@
std::function<void(const boost::system::error_code&,
const MapperGetSubTreePathsResponse&)>&& callback)
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[callback{std::move(callback)}](
const boost::system::error_code& ec,
const MapperGetSubTreePathsResponse& subtreePaths) {
@@ -142,7 +142,7 @@
std::function<void(const boost::system::error_code&,
const MapperGetSubTreeResponse&)>&& callback)
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[callback{std::move(callback)}](
const boost::system::error_code& ec,
const MapperGetSubTreeResponse& subtree) { callback(ec, subtree); },
@@ -159,7 +159,7 @@
std::function<void(const boost::system::error_code&,
const MapperGetSubTreePathsResponse&)>&& callback)
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[callback{std::move(callback)}](
const boost::system::error_code& ec,
const MapperGetSubTreePathsResponse& subtreePaths) {
@@ -179,7 +179,7 @@
std::function<void(const boost::system::error_code&,
const MapperGetSubTreeResponse&)>&& callback)
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[callback{std::move(callback)}](
const boost::system::error_code& ec,
const MapperGetSubTreeResponse& subtree) { callback(ec, subtree); },
@@ -197,7 +197,7 @@
std::function<void(const boost::system::error_code&,
const MapperGetSubTreePathsResponse&)>&& callback)
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[callback{std::move(callback)}](
const boost::system::error_code& ec,
const MapperGetSubTreePathsResponse& subtreePaths) {
@@ -214,7 +214,7 @@
std::function<void(const boost::system::error_code&,
const MapperGetObject&)>&& callback)
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[callback{std::move(callback)}](const boost::system::error_code& ec,
const MapperGetObject& object) {
callback(ec, object);
@@ -239,7 +239,7 @@
std::function<void(const boost::system::error_code&,
const ManagedObjectType&)>&& callback)
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
[callback{std::move(callback)}](const boost::system::error_code& ec,
const ManagedObjectType& objects) {
callback(ec, objects);