Refactor setProperty method
SetProperty is a method we should use more, and use consistently in the
codebase, this commit makes it consistently used from the utility
namespace.
Tested: Refactor. Code compiles.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I5939317d23483e16bd98a8298f53e75604ef374d
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index 3072b89..4aaac67 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -97,7 +97,10 @@
return;
}
- crow::connections::systemBus->async_method_call(
+ sdbusplus::asio::setProperty(
+ *crow::connections::systemBus, "xyz.openbmc_project.Settings",
+ "/xyz/openbmc_project/control/host0/power_cap",
+ "xyz.openbmc_project.Control.Power.Cap", "PowerCap", *value,
[sensorsAsyncResp](const boost::system::error_code& ec2) {
if (ec2)
{
@@ -107,12 +110,7 @@
}
sensorsAsyncResp->asyncResp->res.result(
boost::beast::http::status::no_content);
- },
- "xyz.openbmc_project.Settings",
- "/xyz/openbmc_project/control/host0/power_cap",
- "org.freedesktop.DBus.Properties", "Set",
- "xyz.openbmc_project.Control.Power.Cap", "PowerCap",
- std::variant<uint32_t>(*value));
+ });
});
};
redfish::chassis_utils::getValidChassisPath(sensorsAsyncResp->asyncResp,