KeyboardManager: a class to manage the polling of a switch-matrix keyboard

Dependents:   KeyboardTest

Committer:
osmeest
Date:
Thu Feb 03 22:01:57 2011 +0000
Revision:
3:1310c57aca77
Parent:
2:eb4cc53ff33d
improve code structure, add key mapping and long key press handling

Who changed what in which revision?

UserRevisionLine numberNew contents of line
osmeest 3:1310c57aca77 1 #ifndef SINGLE_KEY_PRESS_MONITOR_H_
osmeest 3:1310c57aca77 2 #define SINGLE_KEY_PRESS_MONITOR_H_
osmeest 3:1310c57aca77 3
osmeest 3:1310c57aca77 4 #include "kbd_mgr/KeyPressEventServer.h"
osmeest 3:1310c57aca77 5 #include "kbd_mgr/KeyboardStateHandler.h"
osmeest 3:1310c57aca77 6
osmeest 3:1310c57aca77 7 namespace kbd_mgr {
osmeest 3:1310c57aca77 8
osmeest 3:1310c57aca77 9 /**
osmeest 3:1310c57aca77 10 * @brief A keyboard state change handler that reports on single keypresses.
osmeest 3:1310c57aca77 11 * It voluntarily ignores key combinations (only the first key pressed in a combo is reported).
osmeest 3:1310c57aca77 12 */
osmeest 3:1310c57aca77 13 class SingleKeyPressMonitor : public KeyPressEventServer, public KeyboardStateHandler {
osmeest 3:1310c57aca77 14 public:
osmeest 3:1310c57aca77 15 SingleKeyPressMonitor() :
osmeest 3:1310c57aca77 16 lastReportedState(), lastReportedKey(KeyEvent::NoKey)
osmeest 3:1310c57aca77 17 { }
osmeest 3:1310c57aca77 18
osmeest 3:1310c57aca77 19 virtual void handleState(const KeyboardState &newState);
osmeest 3:1310c57aca77 20
osmeest 3:1310c57aca77 21 private:
osmeest 3:1310c57aca77 22 KeyboardState lastReportedState;
osmeest 3:1310c57aca77 23 int lastReportedKey;
osmeest 3:1310c57aca77 24 };
osmeest 3:1310c57aca77 25
osmeest 3:1310c57aca77 26 } // kbd_mgr
osmeest 3:1310c57aca77 27
osmeest 3:1310c57aca77 28 #endif // SINGLE_KEY_PRESS_MONITOR_H_