KeyboardManager: a class to manage the polling of a switch-matrix keyboard
Diff: kbd_mgr/KeyboardStateChangeMonitor.h
- Revision:
- 3:1310c57aca77
- Parent:
- 2:eb4cc53ff33d
--- a/kbd_mgr/KeyboardStateChangeMonitor.h Sun Jan 23 23:15:36 2011 +0000 +++ b/kbd_mgr/KeyboardStateChangeMonitor.h Thu Feb 03 22:01:57 2011 +0000 @@ -1,30 +1,22 @@ -#ifndef KEYBOARD_STATE_CHANGE_MONITOR_H_ -#define KEYBOARD_STATE_CHANGE_MONITOR_H_ - -#include "kbd_mgr/KeyboardState.h" -#include "kbd_mgr/KeyboardStateHandler.h" - -namespace kbd_mgr { - -/** - * @brief Interface used by the KeyboardStateChangeMonitor to report state changes. - */ -class KeyboardStateChangeHandler : public KeyboardStateHandler { }; - -/** - * @brief A keyboard state handler that reports only state changes. - */ -class KeyboardStateChangeMonitor : public KeyboardStateHandler { -public: - KeyboardStateChangeMonitor(KeyboardStateChangeHandler *handler) : handler(handler), lastState() { } - - virtual void operator()(const KeyboardState &newState); - -private: - KeyboardStateChangeHandler *handler; - KeyboardState lastState; -}; - -} // kbd_mgr - -#endif // KEYBOARD_STATE_CHANGE_MONITOR_H_ +#ifndef KEYBOARD_STATE_CHANGE_MONITOR_H_ +#define KEYBOARD_STATE_CHANGE_MONITOR_H_ + +#include "kbd_mgr/KeyboardStateEventServer.h" +#include "kbd_mgr/KeyboardState.h" + +namespace kbd_mgr { + +/** + * @brief A keyboard state handler that reports only state changes. + */ +class KeyboardStateChangeMonitor : public KeyboardStateEventServer, public KeyboardStateHandler { +public: + virtual void handleState(const KeyboardState &newState); + +private: + KeyboardState lastState; +}; + +} // kbd_mgr + +#endif // KEYBOARD_STATE_CHANGE_MONITOR_H_