Adding a yielding option callDbusMethod

Currently there are a lot of yielding options that takes in utils.hpp
the ipmi::Context::ptr, but without callDbusMethod,
Now add this method to meet the needs.

Tested:
The callDbusMethod method is called in a library, the compilation is
passed, and the functional test is successful.

Signed-off-by: Albert Zhang <zhanghaodi@inspur.com>
Change-Id: Id46f93708728b4449804ceedfa6d269071e52278
diff --git a/include/ipmid/utils.hpp b/include/ipmid/utils.hpp
index 26a2bab..ebd97e0 100644
--- a/include/ipmid/utils.hpp
+++ b/include/ipmid/utils.hpp
@@ -372,6 +372,22 @@
                                           const InterfaceList& interfaces,
                                           ObjectTree& objectTree);
 
+/** @brief Gets the value associated with the given object
+ *         and the interface.
+ *  @param[in] ctx - ipmi::Context::ptr
+ *  @param[in] service - D-Bus service name.
+ *  @param[in] objPath - D-Bus object path.
+ *  @param[in] interface - D-Bus interface.
+ *  @param[in] method - name of the method.
+ *  @return - boost error code object
+ */
+
+boost::system::error_code callDbusMethod(Context::ptr ctx,
+                                         const std::string& service,
+                                         const std::string& objPath,
+                                         const std::string& interface,
+                                         const std::string& method);
+
 /********* End co-routine yielding alternatives ***************/
 
 /** @brief Retrieve the value from map of variants,
diff --git a/libipmid/utils.cpp b/libipmid/utils.cpp
index 11ae156..a2e4dd2 100644
--- a/libipmid/utils.cpp
+++ b/libipmid/utils.cpp
@@ -616,6 +616,18 @@
     return ec;
 }
 
+boost::system::error_code callDbusMethod(Context::ptr ctx,
+                                         const std::string& service,
+                                         const std::string& objPath,
+                                         const std::string& interface,
+                                         const std::string& method)
+{
+    boost::system::error_code ec;
+    ctx->bus->yield_method_call(ctx->yield, ec, service, objPath, interface,
+                                method);
+    return ec;
+}
+
 /********* End co-routine yielding alternatives ***************/
 
 ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t slaveAddr,