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/sensors.hpp b/redfish-core/lib/sensors.hpp
index 3fbbd2d..011e670 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -2694,7 +2694,10 @@
messages::internalError(sensorAsyncResp->asyncResp->res);
return;
}
- crow::connections::systemBus->async_method_call(
+ sdbusplus::asio::setProperty(
+ *crow::connections::systemBus, item.second, item.first,
+ "xyz.openbmc_project.Sensor.Value", "Value",
+ iterator->second.first,
[sensorAsyncResp](const boost::system::error_code& ec) {
if (ec)
{
@@ -2714,10 +2717,7 @@
messages::internalError(
sensorAsyncResp->asyncResp->res);
}
- },
- item.second, item.first, "org.freedesktop.DBus.Properties",
- "Set", "xyz.openbmc_project.Sensor.Value", "Value",
- dbus::utility::DbusVariantType(iterator->second.first));
+ });
}
};
// Get object with connection for the given sensor name