KeyboardManager: a class to manage the polling of a switch-matrix keyboard
Embed:
(wiki syntax)
Show/hide line numbers
SingleKeyPressMonitor.h
00001 #ifndef SINGLE_KEY_PRESS_MONITOR_H_ 00002 #define SINGLE_KEY_PRESS_MONITOR_H_ 00003 00004 #include "kbd_mgr/KeyPressEventServer.h" 00005 #include "kbd_mgr/KeyboardStateHandler.h" 00006 00007 namespace kbd_mgr { 00008 00009 /** 00010 * @brief A keyboard state change handler that reports on single keypresses. 00011 * It voluntarily ignores key combinations (only the first key pressed in a combo is reported). 00012 */ 00013 class SingleKeyPressMonitor : public KeyPressEventServer, public KeyboardStateHandler { 00014 public: 00015 SingleKeyPressMonitor() : 00016 lastReportedState(), lastReportedKey(KeyEvent::NoKey) 00017 { } 00018 00019 virtual void handleState(const KeyboardState &newState); 00020 00021 private: 00022 KeyboardState lastReportedState; 00023 int lastReportedKey; 00024 }; 00025 00026 } // kbd_mgr 00027 00028 #endif // SINGLE_KEY_PRESS_MONITOR_H_
Generated on Thu Jul 14 2022 19:25:04 by 1.7.2