summaryrefslogtreecommitdiffstats
path: root/app/watchdog_service.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/watchdog_service.cpp')
-rw-r--r--app/watchdog_service.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
index 284964d..3534e89 100644
--- a/app/watchdog_service.cpp
+++ b/app/watchdog_service.cpp
@@ -16,8 +16,6 @@ using phosphor::logging::elog;
using phosphor::logging::entry;
using phosphor::logging::level;
using phosphor::logging::log;
-using sdbusplus::message::variant_ns::get;
-using sdbusplus::message::variant_ns::variant;
using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
using sdbusplus::xyz::openbmc_project::State::server::convertForMessage;
using sdbusplus::xyz::openbmc_project::State::server::Watchdog;
@@ -72,18 +70,22 @@ WatchdogService::Properties WatchdogService::getProperties()
}
try
{
- std::map<std::string, variant<bool, uint64_t, std::string>> properties;
+ std::map<std::string, std::variant<bool, uint64_t, std::string>>
+ properties;
response.read(properties);
Properties wd_prop;
- wd_prop.initialized = get<bool>(properties.at("Initialized"));
- wd_prop.enabled = get<bool>(properties.at("Enabled"));
+ wd_prop.initialized = std::get<bool>(properties.at("Initialized"));
+ wd_prop.enabled = std::get<bool>(properties.at("Enabled"));
wd_prop.expireAction = Watchdog::convertActionFromString(
- get<std::string>(properties.at("ExpireAction")));
+ std::get<std::string>(properties.at("ExpireAction")));
wd_prop.timerUse = Watchdog::convertTimerUseFromString(
- get<std::string>(properties.at("CurrentTimerUse")));
+ std::get<std::string>(properties.at("CurrentTimerUse")));
+ wd_prop.expiredTimerUse = Watchdog::convertTimerUseFromString(
+ std::get<std::string>(properties.at("ExpiredTimerUse")));
- wd_prop.interval = get<uint64_t>(properties.at("Interval"));
- wd_prop.timeRemaining = get<uint64_t>(properties.at("TimeRemaining"));
+ wd_prop.interval = std::get<uint64_t>(properties.at("Interval"));
+ wd_prop.timeRemaining =
+ std::get<uint64_t>(properties.at("TimeRemaining"));
return wd_prop;
}
catch (const std::exception& e)
@@ -121,9 +123,9 @@ T WatchdogService::getProperty(const std::string& key)
}
try
{
- variant<T> value;
+ std::variant<T> value;
response.read(value);
- return get<T>(value);
+ return std::get<T>(value);
}
catch (const std::exception& e)
{
@@ -145,7 +147,7 @@ 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, variant<T>(val));
+ request.append(wd_intf, key, std::variant<T>(val));
auto response = bus.call(request);
if (response.is_method_error())
{
@@ -153,7 +155,8 @@ void WatchdogService::setProperty(const std::string& key, const T& val)
if (wasValid)
{
// Retry the request once in case the cached service was stale
- return setProperty(key, val);
+ setProperty(key, val);
+ return;
}
log<level::ERR>("WatchdogService: Method error setting property",
entry("PROPERTY=%s", key.c_str()));
@@ -186,12 +189,12 @@ void WatchdogService::setTimerUse(TimerUse timerUse)
setProperty("CurrentTimerUse", convertForMessage(timerUse));
}
-void WatchdogService::setInterval(uint64_t interval)
+void WatchdogService::setExpiredTimerUse(TimerUse timerUse)
{
- setProperty("Interval", interval);
+ setProperty("ExpiredTimerUse", convertForMessage(timerUse));
}
-void WatchdogService::setTimeRemaining(uint64_t timeRemaining)
+void WatchdogService::setInterval(uint64_t interval)
{
- setProperty("TimeRemaining", timeRemaining);
+ setProperty("Interval", interval);
}
OpenPOWER on IntegriCloud