KeyboardManager: a class to manage the polling of a switch-matrix keyboard
kbd_mgr/SingleKeyPressMonitor.h
- Committer:
- osmeest
- Date:
- 2011-02-03
- Revision:
- 3:1310c57aca77
- Parent:
- 2:eb4cc53ff33d
File content as of revision 3:1310c57aca77:
#ifndef SINGLE_KEY_PRESS_MONITOR_H_ #define SINGLE_KEY_PRESS_MONITOR_H_ #include "kbd_mgr/KeyPressEventServer.h" #include "kbd_mgr/KeyboardStateHandler.h" namespace kbd_mgr { /** * @brief A keyboard state change handler that reports on single keypresses. * It voluntarily ignores key combinations (only the first key pressed in a combo is reported). */ class SingleKeyPressMonitor : public KeyPressEventServer, public KeyboardStateHandler { public: SingleKeyPressMonitor() : lastReportedState(), lastReportedKey(KeyEvent::NoKey) { } virtual void handleState(const KeyboardState &newState); private: KeyboardState lastReportedState; int lastReportedKey; }; } // kbd_mgr #endif // SINGLE_KEY_PRESS_MONITOR_H_