diff options
author | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-08-18 18:29:41 +0530 |
---|---|---|
committer | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-08-23 18:56:37 +0530 |
commit | 2dc9b1a24f753270eae01be8b71c0c89a3c669cc (patch) | |
tree | 8a9186650d1402515637a8ee4e1bc6b797dd1a0b /occ_status.hpp | |
parent | 715595b64ead477ceae235208a290808234cdcf0 (diff) | |
download | openpower-occ-control-2dc9b1a24f753270eae01be8b71c0c89a3c669cc.tar.gz openpower-occ-control-2dc9b1a24f753270eae01be8b71c0c89a3c669cc.zip |
Enable OCC error monitoring
Fixes openbmc/openbmc#2165
Change-Id: I93f317a32c910f279003fa0fce6ae2d597f90312
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Diffstat (limited to 'occ_status.hpp')
-rw-r--r-- | occ_status.hpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/occ_status.hpp b/occ_status.hpp index 74839d0..2e12806 100644 --- a/occ_status.hpp +++ b/occ_status.hpp @@ -1,5 +1,6 @@ #pragma once +#include <functional> #include <sdbusplus/bus.hpp> #include <sdbusplus/server/object.hpp> #include <org/open_power/OCC/Status/server.hpp> @@ -42,13 +43,20 @@ class Status : public Interface /** @brief Constructs the Status object and * the underlying device object * - * @param[in] bus - DBus bus to attach to - * @param[in] path - DBus object path + * @param[in] bus - DBus bus to attach to + * @param[in] event - sd_event unique pointer reference + * @param[in] path - DBus object path + * @param[in] callBack - Callback handler to invoke during + * property change */ - Status(sdbusplus::bus::bus& bus, EventPtr& event, const char* path) + Status(sdbusplus::bus::bus& bus, + EventPtr& event, + const char* path, + std::function<void(bool)> callBack = nullptr) : Interface(bus, path), bus(bus), path(path), + callBack(callBack), instance(((this->path.back() - '0'))), device(event, name + std::to_string(instance + 1), @@ -81,6 +89,18 @@ class Status : public Interface */ bool occActive(bool value) override; + /** @brief Starts OCC error detection */ + inline void addErrorWatch() + { + return device.addErrorWatch(); + } + + /** @brief Stops OCC error detection */ + inline void removeErrorWatch() + { + return device.removeErrorWatch(); + } + private: /** @brief sdbus handle */ @@ -89,6 +109,11 @@ class Status : public Interface /** @brief OCC dbus object path */ std::string path; + /** @brief Callback handler to be invoked during property change. + * This is a handler in Manager class + */ + std::function<void(bool)> callBack; + /** @brief occ name prefix */ std::string name = OCC_NAME; |