A DTMF sequence editor and player for HAM radio equipment command & control.

Dependencies:   mbed ExtTextLCD

Committer:
osmeest
Date:
Mon Mar 07 22:51:19 2011 +0000
Revision:
0:1324e7d9d471

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
osmeest 0:1324e7d9d471 1 #include "kbd_mgr/SingleKeyPressMonitor.h"
osmeest 0:1324e7d9d471 2
osmeest 0:1324e7d9d471 3 namespace kbd_mgr {
osmeest 0:1324e7d9d471 4
osmeest 0:1324e7d9d471 5 void SingleKeyPressMonitor::handleState(const KeyboardState &newState)
osmeest 0:1324e7d9d471 6 {
osmeest 0:1324e7d9d471 7 int key;
osmeest 0:1324e7d9d471 8 if (newState.getKeyPressType(key) == KeyboardState::SingleKeyPress && this->lastReportedState.empty())
osmeest 0:1324e7d9d471 9 {
osmeest 0:1324e7d9d471 10 KeyEvent keyDown(key, KeyEvent::KeyDown);
osmeest 0:1324e7d9d471 11 invokeHandler(keyDown);
osmeest 0:1324e7d9d471 12
osmeest 0:1324e7d9d471 13 this->lastReportedState = newState;
osmeest 0:1324e7d9d471 14 this->lastReportedKey = key;
osmeest 0:1324e7d9d471 15 }
osmeest 0:1324e7d9d471 16 else if (!this->lastReportedState.empty() &&
osmeest 0:1324e7d9d471 17 (newState & this->lastReportedState).empty())
osmeest 0:1324e7d9d471 18 {
osmeest 0:1324e7d9d471 19 KeyEvent keyUp(this->lastReportedKey, KeyEvent::KeyUp);
osmeest 0:1324e7d9d471 20 invokeHandler(keyUp);
osmeest 0:1324e7d9d471 21
osmeest 0:1324e7d9d471 22 this->lastReportedState.clear();
osmeest 0:1324e7d9d471 23 this->lastReportedKey = KeyEvent::NoKey;
osmeest 0:1324e7d9d471 24 }
osmeest 0:1324e7d9d471 25
osmeest 0:1324e7d9d471 26 }
osmeest 0:1324e7d9d471 27
osmeest 0:1324e7d9d471 28 } // kbd_mgr