summaryrefslogtreecommitdiffstats
path: root/app/watchdog_service.hpp
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-02-09 15:54:56 -0800
committerWilliam A. Kennington III <wak@google.com>2018-02-21 23:54:59 +0000
commit5257525db7dd97ffb8b5464df1b5b83df0297e7a (patch)
tree3757c1daa038c38100fee2599c0ba8df81a6cf44 /app/watchdog_service.hpp
parente66c3b042c0cd2d94059fa93298e0ba52c92b248 (diff)
downloadphosphor-host-ipmid-5257525db7dd97ffb8b5464df1b5b83df0297e7a.tar.gz
phosphor-host-ipmid-5257525db7dd97ffb8b5464df1b5b83df0297e7a.zip
watchdog: Rewrite using sdbusplus
Change-Id: I730317954819859d23fdaca7336f19f5c5b0c107 Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'app/watchdog_service.hpp')
-rw-r--r--app/watchdog_service.hpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/app/watchdog_service.hpp b/app/watchdog_service.hpp
new file mode 100644
index 0000000..4590e31
--- /dev/null
+++ b/app/watchdog_service.hpp
@@ -0,0 +1,61 @@
+#pragma once
+#include <sdbusplus/bus.hpp>
+
+/** @class WatchdogService
+ * @brief Access to the running OpenBMC watchdog implementation.
+ * @details Easy accessor for servers that implement the
+ * xyz.openbmc_project.State.Watchdog DBus API.
+ */
+class WatchdogService {
+ public:
+ WatchdogService();
+
+ /** @brief Contains a copy of the properties enumerated by the
+ * watchdog service.
+ */
+ struct Properties {
+ bool enabled;
+ uint64_t interval;
+ uint64_t timeRemaining;
+ };
+
+ /** @brief Retrieves a copy of the currently set properties on the
+ * host watchdog
+ *
+ * @return A populated WatchdogProperties struct
+ */
+ Properties getProperties();
+
+ /** @brief Sets the value of the enabled property on the host watchdog
+ *
+ * @param[in] enabled - The new enabled value
+ */
+ void setEnabled(bool enabled);
+
+ /** @brief Sets the value of the interval property on the host watchdog
+ *
+ * @param[in] interval - The new interval value
+ */
+ void setInterval(uint64_t interval);
+
+ /** @brief Sets the value of the timeRemaining property on the host
+ * watchdog
+ *
+ * @param[in] timeRemaining - The new timeRemaining value
+ */
+ void setTimeRemaining(uint64_t timeRemaining);
+
+ private:
+ /** @brief sdbusplus handle */
+ sdbusplus::bus::bus bus;
+ /** @brief The name of the mapped host watchdog service */
+ const std::string wd_service;
+
+ /** @brief Sets the value of the property on the host watchdog
+ *
+ * @param[in] key - The name of the property
+ * @param[in] val - The new value
+ */
+ template <typename T>
+ void setProperty(const std::string& key, const T& val);
+};
OpenPOWER on IntegriCloud