Move getProperty calls to utility
Having all dbus calls run through the same utility reduces the amount of
generated code, and more importantly, gives us a place where we can log
the requests and responses to help with debugging.
Tested: Redfish service validator passes.
Change-Id: Ic1bf45130b5069cd57f7af26e12c8d3159c87c67
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/redfish-core/lib/power_supply.hpp b/redfish-core/lib/power_supply.hpp
index f085272..3af8def 100644
--- a/redfish-core/lib/power_supply.hpp
+++ b/redfish-core/lib/power_supply.hpp
@@ -198,9 +198,8 @@
getPowerSupplyState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& service, const std::string& path)
{
- sdbusplus::asio::getProperty<bool>(
- *crow::connections::systemBus, service, path,
- "xyz.openbmc_project.Inventory.Item", "Present",
+ dbus::utility::getProperty<bool>(
+ service, path, "xyz.openbmc_project.Inventory.Item", "Present",
[asyncResp](const boost::system::error_code& ec, const bool value) {
if (ec)
{
@@ -225,9 +224,9 @@
getPowerSupplyHealth(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& service, const std::string& path)
{
- sdbusplus::asio::getProperty<bool>(
- *crow::connections::systemBus, service, path,
- "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional",
+ dbus::utility::getProperty<bool>(
+ service, path, "xyz.openbmc_project.State.Decorator.OperationalStatus",
+ "Functional",
[asyncResp](const boost::system::error_code& ec, const bool value) {
if (ec)
{
@@ -252,9 +251,8 @@
getPowerSupplyAsset(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& service, const std::string& path)
{
- sdbusplus::asio::getAllProperties(
- *crow::connections::systemBus, service, path,
- "xyz.openbmc_project.Inventory.Decorator.Asset",
+ dbus::utility::getAllProperties(
+ service, path, "xyz.openbmc_project.Inventory.Decorator.Asset",
[asyncResp](const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& propertiesList) {
if (ec)
@@ -324,9 +322,8 @@
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& service, const std::string& path)
{
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, service, path,
- "xyz.openbmc_project.Software.Version", "Version",
+ dbus::utility::getProperty<std::string>(
+ service, path, "xyz.openbmc_project.Software.Version", "Version",
[asyncResp](const boost::system::error_code& ec,
const std::string& value) {
if (ec)
@@ -348,9 +345,9 @@
getPowerSupplyLocation(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& service, const std::string& path)
{
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, service, path,
- "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
+ dbus::utility::getProperty<std::string>(
+ service, path, "xyz.openbmc_project.Inventory.Decorator.LocationCode",
+ "LocationCode",
[asyncResp](const boost::system::error_code& ec,
const std::string& value) {
if (ec)
@@ -429,9 +426,9 @@
const auto& [path, serviceMap] = *subtree.begin();
const auto& [service, interfaces] = *serviceMap.begin();
- sdbusplus::asio::getProperty<uint32_t>(
- *crow::connections::systemBus, service, path,
- "xyz.openbmc_project.Control.PowerSupplyAttributes", "DeratingFactor",
+ dbus::utility::getProperty<uint32_t>(
+ service, path, "xyz.openbmc_project.Control.PowerSupplyAttributes",
+ "DeratingFactor",
[asyncResp](const boost::system::error_code& ec1, uint32_t value) {
handleGetEfficiencyResponse(asyncResp, ec1, value);
});