summaryrefslogtreecommitdiffstats
path: root/app/watchdog_service.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/watchdog_service.cpp')
-rw-r--r--app/watchdog_service.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
index 26962dc..898cf77 100644
--- a/app/watchdog_service.cpp
+++ b/app/watchdog_service.cpp
@@ -85,6 +85,30 @@ WatchdogService::Properties WatchdogService::getProperties()
}
template <typename T>
+T WatchdogService::getProperty(const std::string& key)
+{
+ bool wasValid = wd_service.isValid(bus);
+ auto request = wd_service.newMethodCall(bus, prop_intf, "Get");
+ request.append(wd_intf, key);
+ auto response = bus.call(request);
+ if (response.is_method_error())
+ {
+ wd_service.invalidate();
+ if (wasValid)
+ {
+ // Retry the request once in case the cached service was stale
+ return getProperty<T>(key);
+ }
+ log<level::ERR>("WatchdogService: Method error getting property",
+ entry("PROPERTY=%s", key.c_str()));
+ elog<InternalFailure>();
+ }
+ variant<T> value;
+ response.read(value);
+ return get<T>(value);
+}
+
+template <typename T>
void WatchdogService::setProperty(const std::string& key, const T& val)
{
bool wasValid = wd_service.isValid(bus);
@@ -105,6 +129,11 @@ void WatchdogService::setProperty(const std::string& key, const T& val)
}
}
+bool WatchdogService::getInitialized()
+{
+ return getProperty<bool>("Initialized");
+}
+
void WatchdogService::setInitialized(bool initialized)
{
setProperty("Initialized", initialized);
OpenPOWER on IntegriCloud