diff options
-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. |