app: update the method name
update watchdog names to use `Lower Camel Case`.
Change-Id: I654ddb1a37330f946f258c471fc4209e71cf4d82
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
index b67b5c7..da06041 100644
--- a/app/watchdog_service.cpp
+++ b/app/watchdog_service.cpp
@@ -21,18 +21,18 @@
using sdbusplus::error::xyz::openbmc_project::common::InternalFailure;
using sdbusplus::server::xyz::openbmc_project::state::Watchdog;
-static constexpr char wd_path[] = "/xyz/openbmc_project/watchdog/host0";
-static constexpr char wd_intf[] = "xyz.openbmc_project.State.Watchdog";
-static constexpr char prop_intf[] = "org.freedesktop.DBus.Properties";
+static constexpr auto wdPath = "/xyz/openbmc_project/watchdog/host0";
+static constexpr auto wdIntf = "xyz.openbmc_project.State.Watchdog";
+static constexpr auto propIntf = "org.freedesktop.DBus.Properties";
-ipmi::ServiceCache WatchdogService::wd_service(wd_intf, wd_path);
+ipmi::ServiceCache WatchdogService::wdService(wdIntf, wdPath);
WatchdogService::WatchdogService() : bus(ipmid_get_sd_bus_connection()) {}
void WatchdogService::resetTimeRemaining(bool enableWatchdog)
{
- bool wasValid = wd_service.isValid(bus);
- auto request = wd_service.newMethodCall(bus, wd_intf, "ResetTimeRemaining");
+ bool wasValid = wdService.isValid(bus);
+ auto request = wdService.newMethodCall(bus, wdIntf, "ResetTimeRemaining");
request.append(enableWatchdog);
try
{
@@ -40,7 +40,7 @@
}
catch (const std::exception& e)
{
- wd_service.invalidate();
+ wdService.invalidate();
if (wasValid)
{
// Retry the request once in case the cached service was stale
@@ -55,9 +55,9 @@
WatchdogService::Properties WatchdogService::getProperties()
{
- bool wasValid = wd_service.isValid(bus);
- auto request = wd_service.newMethodCall(bus, prop_intf, "GetAll");
- request.append(wd_intf);
+ bool wasValid = wdService.isValid(bus);
+ auto request = wdService.newMethodCall(bus, propIntf, "GetAll");
+ request.append(wdIntf);
std::map<std::string, std::variant<bool, uint64_t, std::string>> properties;
try
@@ -67,7 +67,7 @@
}
catch (const std::exception& e)
{
- wd_service.invalidate();
+ wdService.invalidate();
if (wasValid)
{
// Retry the request once in case the cached service was stale
@@ -80,20 +80,20 @@
try
{
- Properties wd_prop;
- wd_prop.initialized = std::get<bool>(properties.at("Initialized"));
- wd_prop.enabled = std::get<bool>(properties.at("Enabled"));
- wd_prop.expireAction = Watchdog::convertActionFromString(
+ Properties wdProp;
+ wdProp.initialized = std::get<bool>(properties.at("Initialized"));
+ wdProp.enabled = std::get<bool>(properties.at("Enabled"));
+ wdProp.expireAction = Watchdog::convertActionFromString(
std::get<std::string>(properties.at("ExpireAction")));
- wd_prop.timerUse = Watchdog::convertTimerUseFromString(
+ wdProp.timerUse = Watchdog::convertTimerUseFromString(
std::get<std::string>(properties.at("CurrentTimerUse")));
- wd_prop.expiredTimerUse = Watchdog::convertTimerUseFromString(
+ wdProp.expiredTimerUse = Watchdog::convertTimerUseFromString(
std::get<std::string>(properties.at("ExpiredTimerUse")));
- wd_prop.interval = std::get<uint64_t>(properties.at("Interval"));
- wd_prop.timeRemaining =
+ wdProp.interval = std::get<uint64_t>(properties.at("Interval"));
+ wdProp.timeRemaining =
std::get<uint64_t>(properties.at("TimeRemaining"));
- return wd_prop;
+ return wdProp;
}
catch (const std::exception& e)
{
@@ -111,9 +111,9 @@
template <typename T>
T WatchdogService::getProperty(const std::string& key)
{
- bool wasValid = wd_service.isValid(bus);
- auto request = wd_service.newMethodCall(bus, prop_intf, "Get");
- request.append(wd_intf, key);
+ bool wasValid = wdService.isValid(bus);
+ auto request = wdService.newMethodCall(bus, propIntf, "Get");
+ request.append(wdIntf, key);
try
{
auto response = bus.call(request);
@@ -123,7 +123,7 @@
}
catch (const std::exception& e)
{
- wd_service.invalidate();
+ wdService.invalidate();
if (wasValid)
{
// Retry the request once in case the cached service was stale
@@ -143,16 +143,16 @@
template <typename T>
void WatchdogService::setProperty(const std::string& key, const T& val)
{
- bool wasValid = wd_service.isValid(bus);
- auto request = wd_service.newMethodCall(bus, prop_intf, "Set");
- request.append(wd_intf, key, std::variant<T>(val));
+ bool wasValid = wdService.isValid(bus);
+ auto request = wdService.newMethodCall(bus, propIntf, "Set");
+ request.append(wdIntf, key, std::variant<T>(val));
try
{
auto response = bus.call(request);
}
catch (const std::exception& e)
{
- wd_service.invalidate();
+ wdService.invalidate();
if (wasValid)
{
// Retry the request once in case the cached service was stale