From 1726df6a09e1970f6d2b3eaab40fcfb6cb256e27 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Mon, 23 Apr 2018 10:28:28 -0700 Subject: 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 --- watchdog.cpp | 9 +++++++++ watchdog.hpp | 7 +++++++ 2 files changed, 16 insertions(+) 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. -- cgit v1.2.1