diff options
author | William A. Kennington III <wak@google.com> | 2018-04-23 10:28:28 -0700 |
---|---|---|
committer | William A. Kennington III <wak@google.com> | 2018-04-27 10:42:17 -0700 |
commit | 1726df6a09e1970f6d2b3eaab40fcfb6cb256e27 (patch) | |
tree | 7cc16d45df51f9cda5cc4238cfb94da35dd66b78 | |
parent | 7512a126c3215c0baf2dc77b01dc240cd200dba4 (diff) | |
download | phosphor-watchdog-1726df6a09e1970f6d2b3eaab40fcfb6cb256e27.tar.gz phosphor-watchdog-1726df6a09e1970f6d2b3eaab40fcfb6cb256e27.zip |
Implement ResetTimeRemaining Method
A dbus method was recently added that supports performing the watchdog
reset and enable in a single action to reduce the amount of the dbus
congestion and improve reliability of watchdog resets. Support this
method as the build would be broken otherwise.
Change-Id: Iac00fc2cf15d4ba06fb67a98e2c29fc3c31b3272
Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r-- | watchdog.cpp | 9 | ||||
-rw-r--r-- | watchdog.hpp | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/watchdog.cpp b/watchdog.cpp index 2bfd9b7..5ba0836 100644 --- a/watchdog.cpp +++ b/watchdog.cpp @@ -14,6 +14,15 @@ constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1"; constexpr auto SYSTEMD_ROOT = "/org/freedesktop/systemd1"; constexpr auto SYSTEMD_INTERFACE = "org.freedesktop.systemd1.Manager"; +void Watchdog::resetTimeRemaining(bool enableWatchdog) +{ + timeRemaining(interval()); + if (enableWatchdog) + { + enabled(true); + } +} + // Enable or disable watchdog bool Watchdog::enabled(bool value) { diff --git a/watchdog.hpp b/watchdog.hpp index 7603689..e28a751 100644 --- a/watchdog.hpp +++ b/watchdog.hpp @@ -66,6 +66,13 @@ class Watchdog : public WatchdogInherits tryFallbackOrDisable(); } + /** @brief Resets the TimeRemaining to the configured Interval + * Optionally enables the watchdog. + * + * @param[in] enableWatchdog - Should the call enable the watchdog + */ + void resetTimeRemaining(bool enableWatchdog) override; + /** @brief Since we are overriding the setter-enabled but not the * getter-enabled, we need to have this using in order to * allow passthrough usage of the getter-enabled. |