![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
A DTMF sequence editor and player for HAM radio equipment command & control.
KeyboardManager/kbd_mgr/SingleKeyPressMonitor.h@0:1324e7d9d471, 2011-03-07 (annotated)
- Committer:
- osmeest
- Date:
- Mon Mar 07 22:51:19 2011 +0000
- Revision:
- 0:1324e7d9d471
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
osmeest | 0:1324e7d9d471 | 1 | #ifndef SINGLE_KEY_PRESS_MONITOR_H_ |
osmeest | 0:1324e7d9d471 | 2 | #define SINGLE_KEY_PRESS_MONITOR_H_ |
osmeest | 0:1324e7d9d471 | 3 | |
osmeest | 0:1324e7d9d471 | 4 | #include "kbd_mgr/KeyPressEventServer.h" |
osmeest | 0:1324e7d9d471 | 5 | #include "kbd_mgr/KeyboardStateHandler.h" |
osmeest | 0:1324e7d9d471 | 6 | |
osmeest | 0:1324e7d9d471 | 7 | namespace kbd_mgr { |
osmeest | 0:1324e7d9d471 | 8 | |
osmeest | 0:1324e7d9d471 | 9 | /** |
osmeest | 0:1324e7d9d471 | 10 | * @brief A keyboard state change handler that reports on single keypresses. |
osmeest | 0:1324e7d9d471 | 11 | * It voluntarily ignores key combinations (only the first key pressed in a combo is reported). |
osmeest | 0:1324e7d9d471 | 12 | */ |
osmeest | 0:1324e7d9d471 | 13 | class SingleKeyPressMonitor : public KeyPressEventServer, public KeyboardStateHandler { |
osmeest | 0:1324e7d9d471 | 14 | public: |
osmeest | 0:1324e7d9d471 | 15 | SingleKeyPressMonitor() : |
osmeest | 0:1324e7d9d471 | 16 | lastReportedState(), lastReportedKey(KeyEvent::NoKey) |
osmeest | 0:1324e7d9d471 | 17 | { } |
osmeest | 0:1324e7d9d471 | 18 | |
osmeest | 0:1324e7d9d471 | 19 | virtual void handleState(const KeyboardState &newState); |
osmeest | 0:1324e7d9d471 | 20 | |
osmeest | 0:1324e7d9d471 | 21 | private: |
osmeest | 0:1324e7d9d471 | 22 | KeyboardState lastReportedState; |
osmeest | 0:1324e7d9d471 | 23 | int lastReportedKey; |
osmeest | 0:1324e7d9d471 | 24 | }; |
osmeest | 0:1324e7d9d471 | 25 | |
osmeest | 0:1324e7d9d471 | 26 | } // kbd_mgr |
osmeest | 0:1324e7d9d471 | 27 | |
osmeest | 0:1324e7d9d471 | 28 | #endif // SINGLE_KEY_PRESS_MONITOR_H_ |