diff options
author | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-04-04 14:08:26 +0530 |
---|---|---|
committer | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-04-27 14:42:10 +0530 |
commit | ba7301300ef8f3950fa02b4675422cba6a98ee4b (patch) | |
tree | 489d5d55afeaf6399f700f88d1b0fe11670f8bff /monitor.hpp | |
parent | 0b95603eb48a72234b8fc618dcc4db13b6f4d079 (diff) | |
download | phosphor-gpio-monitor-ba7301300ef8f3950fa02b4675422cba6a98ee4b.tar.gz phosphor-gpio-monitor-ba7301300ef8f3950fa02b4675422cba6a98ee4b.zip |
Call defined target when GPIO line is asserted
Change-Id: Ia5445a8d6585acfec69783ba158c8d866d526e97
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Diffstat (limited to 'monitor.hpp')
-rw-r--r-- | monitor.hpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/monitor.hpp b/monitor.hpp index 1027714..34803c1 100644 --- a/monitor.hpp +++ b/monitor.hpp @@ -4,6 +4,7 @@ #include <string> #include <linux/input.h> #include <systemd/sd-event.h> +#include <sdbusplus/bus.hpp> #include "file.hpp" namespace phosphor { @@ -86,6 +87,12 @@ class Monitor static int processEvents(sd_event_source* es, int fd, uint32_t revents, void* userData); + /** @brief Returns the completion state of this handler */ + inline auto completed() const + { + return complete; + } + private: /** @brief Absolute path of GPIO input device */ const std::string& path; @@ -111,11 +118,20 @@ class Monitor /** @brief File descriptor manager */ FileDescriptor fd; + /** @brief Completion indicator */ + bool complete = false; + /** @brief Opens the device and populates the descriptor */ int openDevice(); /** @brief attaches FD to events and sets up callback handler */ void registerCallback(); + + /** @brief Analyzes the GPIO event and starts configured target + * + * @return - For now, returns zero + */ + int analyzeEvent(); }; } // namespace gpio |