summaryrefslogtreecommitdiffstats
path: root/app/watchdog_service.cpp
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-02-09 16:12:53 -0800
committerWilliam A. Kennington III <wak@google.com>2018-02-21 23:54:59 +0000
commitb638de22154aa4cae788d9117d2507394388f839 (patch)
tree6445adf4a1e1914dcf05d35d467961f14de940c0 /app/watchdog_service.cpp
parentde14a027c06d93dadf05322529bec9d83f4cd181 (diff)
downloadphosphor-host-ipmid-b638de22154aa4cae788d9117d2507394388f839.tar.gz
phosphor-host-ipmid-b638de22154aa4cae788d9117d2507394388f839.zip
watchdog: Implement watchdog action setting
We now respect the action set during the SetTimeout command. This maps to one of the actions defined by the dbus Watchdog interface Change-Id: I4d13d2539a2d955a4340bf5f915ca6f3b694550a Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'app/watchdog_service.cpp')
-rw-r--r--app/watchdog_service.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
index 36a967c..f11c4bf 100644
--- a/app/watchdog_service.cpp
+++ b/app/watchdog_service.cpp
@@ -3,12 +3,15 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/message.hpp>
#include <string>
+#include <xyz/openbmc_project/State/Watchdog/server.hpp>
#include "host-ipmid/ipmid-api.h"
#include "utils.hpp"
using sdbusplus::message::variant_ns::get;
using sdbusplus::message::variant_ns::variant;
+using sdbusplus::xyz::openbmc_project::State::server::convertForMessage;
+using sdbusplus::xyz::openbmc_project::State::server::Watchdog;
static constexpr char wd_path[] = "/xyz/openbmc_project/watchdog/host0";
static constexpr char wd_intf[] = "xyz.openbmc_project.State.Watchdog";
@@ -36,6 +39,8 @@ WatchdogService::Properties WatchdogService::getProperties()
Properties wd_prop;
wd_prop.initialized = get<bool>(properties.at("Initialized"));
wd_prop.enabled = get<bool>(properties.at("Enabled"));
+ wd_prop.expireAction = Watchdog::convertActionFromString(
+ get<std::string>(properties.at("ExpireAction")));
wd_prop.interval = get<uint64_t>(properties.at("Interval"));
wd_prop.timeRemaining = get<uint64_t>(properties.at("TimeRemaining"));
return wd_prop;
@@ -64,6 +69,11 @@ void WatchdogService::setEnabled(bool enabled)
setProperty("Enabled", enabled);
}
+void WatchdogService::setExpireAction(Action expireAction)
+{
+ setProperty("ExpireAction", convertForMessage(expireAction));
+}
+
void WatchdogService::setInterval(uint64_t interval)
{
setProperty("Interval", interval);
OpenPOWER on IntegriCloud