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

Dependents:   KeyboardTest

Revision:
3:1310c57aca77
Parent:
2:eb4cc53ff33d
--- a/kbd_mgr/SingleKeyPressMonitor.h	Sun Jan 23 23:15:36 2011 +0000
+++ b/kbd_mgr/SingleKeyPressMonitor.h	Thu Feb 03 22:01:57 2011 +0000
@@ -1,29 +1,28 @@
-#ifndef SINGLE_KEY_PRESS_MONITOR_H_
-#define SINGLE_KEY_PRESS_MONITOR_H_
-
-#include "kbd_mgr/KeyboardStateChangeMonitor.h"
-#include "kbd_mgr/KeyPressEventHandler.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 KeyboardStateChangeHandler {
-public:
-    SingleKeyPressMonitor(KeyPressEventHandler *handler) : 
-        handler(handler), lastReportedState(), lastReportedKey(KeyPressEventHandler::NoKey) 
-    { }
-    
-    virtual void operator()(const KeyboardState &newState);
-    
-private:
-    KeyPressEventHandler *handler;
-    KeyboardState lastReportedState;
-    int lastReportedKey;
-};
-
-} // kbd_mgr
-
-#endif // SINGLE_KEY_PRESS_MONITOR_H_
+#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_