PLDM:Use new alias of DBUS_TIMEOUT for bus.call
This commit uses a new global variable for DBUS_TIMEOUT which is included as an input parameter for bus.call dbus calls. The new alias makes the bus.call function shorter and readable.
Change-Id: I336c97bc0631d5370ff3648e41f50e3e283d771b
Signed-off-by: vkaverap@in.ibm.com <vkaverap@in.ibm.com>
diff --git a/libpldmresponder/bios_config.cpp b/libpldmresponder/bios_config.cpp
index dec7b3f..e4b10c8 100644
--- a/libpldmresponder/bios_config.cpp
+++ b/libpldmresponder/bios_config.cpp
@@ -514,9 +514,7 @@
"org.freedesktop.DBus.Properties",
"Get");
method.append(biosInterface, "BaseBIOSTable");
- auto reply = bus.call(
- method,
- std::chrono::duration_cast<microsec>(sec(DBUS_TIMEOUT)).count());
+ auto reply = bus.call(method, dbusTimeout);
std::variant<BaseBIOSTable> varBiosTable{};
reply.read(varBiosTable);
biosTable = std::get<BaseBIOSTable>(varBiosTable);
diff --git a/libpldmresponder/fru.cpp b/libpldmresponder/fru.cpp
index 98f696c..0821cd2 100644
--- a/libpldmresponder/fru.cpp
+++ b/libpldmresponder/fru.cpp
@@ -157,9 +157,7 @@
auto method = bus.new_method_call(
std::get<0>(dbusInfo).c_str(), std::get<1>(dbusInfo).c_str(),
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
- auto reply = bus.call(
- method,
- std::chrono::duration_cast<microsec>(sec(DBUS_TIMEOUT)).count());
+ auto reply = bus.call(method, dbusTimeout);
reply.read(objects);
}
catch (const std::exception& e)
@@ -253,9 +251,7 @@
pldm::utils::dbusProperties, "Get");
method.append("xyz.openbmc_project.Association", "endpoints");
std::variant<std::vector<std::string>> paths;
- auto reply = bus.call(
- method,
- std::chrono::duration_cast<microsec>(sec(DBUS_TIMEOUT)).count());
+ auto reply = bus.call(method, dbusTimeout);
reply.read(paths);
auto fwRunningVersion = std::get<std::vector<std::string>>(paths)[0];
constexpr auto versionIntf = "xyz.openbmc_project.Software.Version";