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

Dependents:   KeyboardTest

Embed: (wiki syntax)

« Back to documentation index

LongKeyPressMonitor Class Reference

LongKeyPressMonitor Class Reference

A key press event handler that detects long key presses and report them as specified. More...

#include <LongKeyPressMonitor.h>

Inherits kbd_mgr::KeyPressEventServer, and kbd_mgr::KeyPressEventHandler.

Public Member Functions

AutoRepeatSetupProxy autoRepeat (float initTime, float delay)
 Sets up auto-repeat keys.
LongPressSetupProxy longKeyPress (float longPressTime)
 Sets up long key press keys.
virtual void handleKeyPress (const KeyEvent &keypress)
 KeyPressEventHandler interface.
void attach (FunctionKeyPressEventHandler::HandlerFunction fn)
 Attaches the monitor to a function.
template<class T >
void attach (T *obj, typename MemberKeyPressEventHandler< T >::MemberFunction fn)
 Attaches the monitor to a method of an object.

Detailed Description

A key press event handler that detects long key presses and report them as specified.

This class offers two specific reactions for long key presses. Either a specific long key press is reported or the key press event is auto repeated. The timing for both kind of reactions can be specified independently. The monitor reacts on key code, not on mapped key char. If a mapped key char is present in the event, it is retained in the generated key press events.

Definition at line 18 of file LongKeyPressMonitor.h.


Member Function Documentation

void attach ( FunctionKeyPressEventHandler::HandlerFunction  fn ) [inherited]

Attaches the monitor to a function.

Parameters:
fnEvent handler called to report keyboard state change.

Definition at line 18 of file KeyPressEventServer.h.

void attach ( T *  obj,
typename MemberKeyPressEventHandler< T >::MemberFunction  fn 
) [inherited]

Attaches the monitor to a method of an object.

Parameters:
objEvent handler object
fnEvent handler method called to report keyboard state after each complete scan.

Definition at line 28 of file KeyPressEventServer.h.

LongKeyPressMonitor::AutoRepeatSetupProxy autoRepeat ( float  initTime,
float  delay 
)

Sets up auto-repeat keys.

This method takes the timing parameters. It returns a special class that allows specifying the keys between brackets. Eg:

  • monitor.autoRepeat(0.3, 0.1)(1)(2)(4,8) Sets up auto repeat after 300ms, every 100ms for keys 1, 2 and 4 to 8.

Definition at line 5 of file LongKeyPressMonitor.cpp.

void handleKeyPress ( const KeyEvent &  keypress ) [virtual]

KeyPressEventHandler interface.

Implements KeyPressEventHandler.

Definition at line 35 of file LongKeyPressMonitor.cpp.

LongKeyPressMonitor::LongPressSetupProxy longKeyPress ( float  longPressTime )

Sets up long key press keys.

This method takes the timing parameters. It returns a special class that allows specifying the keys between brackets. Eg:

  • monitor.longKeyPress(0.5)(3)(12,14) Sets up report of long key press after 500ms for keys 3 and 12 to 14.

Definition at line 21 of file LongKeyPressMonitor.cpp.