public abstract class Keypad extends Keyboard
The key mapping is defined in Table 33 and in Table 63 of ETSI ES 202 130 (v1.1.1). In addition the next three keys
have extended mapping defined as:
key10: '*'
: this key is only used to switch from one mode to another
key11: ' '
, '+'
, '0'
in order
key12: '\n'
, '#'
in order
Keypad sends low-level Keyboard events with basic code of the key (from '0' to '9', '#' or '*') and high level
Keyboard.TEXT_INPUT
events with next key code mapping until key is validated (Key codes are scrolled in order,
circularly). A key is validated when no new key has been pressed before validation delay or if an other physical key
of the keypad is pressed. The delay starts when the key is pressed, so a key may be validated even if it is not yet
released. When a key is validated Keypad sends KEY_VALIDATED
event.
The delay for key validation can be modified at any time using setDelay(int)
Keypad uses 4 different modes
to filter the letters that are scrolled.
NUM
: only digits are selectedALPHA
: digits and letters are selectedCAP
: only capital letters and digits are selectedCAP1
: same as CAP
, but must switch to ALPHA
mode after the first character is
validatedKeyboard
) pressing the '2' key twice rapidly and
then waiting a little amount of time after activation delay will generate:
Keyboard.KEY_DOWN
'2'Keyboard.TEXT_INPUT
'a'Keyboard.KEY_UP
'2'Keyboard.KEY_DOWN
'2'Keyboard.TEXT_INPUT
'b'Keyboard.KEY_UP
'2'KEY_VALIDATED
(after a delay, see setDelay(int)
)Keyboard
Modifier and Type | Field and Description |
---|---|
static int |
ALPHA
The ALPHA mode.
In ALPHA mode the keypad may return several letters and digits according to the number of consequent key press. |
static int |
CAP
The CAP mode.
In CAP mode only capital letters and digits are returned |
static int |
CAP1
The CAP1 mode.
In CAP1 mode is the same has CAP mode, but automatically switch to ALPHA mode after the Keyboard.KEY_UP event
|
static int |
KEY_VALIDATED
The KEY_VALIDATED event action.
This event action is sent when last key is validated, meaning that no new key has been pressed during delay. |
static int |
NUM
The NUM mode.
In NUM mode the keypad may return several digits according to the number of consequent key press. |
KEY_DOWN, KEY_UP, TEXT_INPUT
Constructor and Description |
---|
Keypad(int size)
Keypads hold a buffer (potentially of size one) that stores the keys before they are used by the application (key
associated to
Keyboard.KEY_UP , Keyboard.KEY_DOWN and Keyboard.TEXT_INPUT event). |
Modifier and Type | Method and Description |
---|---|
abstract char[] |
getAssignment(char key)
Gets the complete array of chars associated with the specified key.
|
int |
getDelay()
Gets the delay.
|
int |
getEventType()
Gets the event type associated with the event generator
|
abstract java.lang.String |
getLanguage()
Gets the currently selected language.
|
int |
getMode()
Gets the mode.
|
abstract java.lang.String[] |
getSupportedLanguages()
Gets the supported languages for this keypad.
|
void |
setDelay(int delay)
Sets the delay The delay is the value between two press that allows to select a letter out of several.
|
abstract void |
setLanguage(java.lang.String language)
Sets the language.
|
void |
setMode(int mode)
Sets the mode.
|
dropOnFull, getAction, getNextChar, onlyTextInput, reset, send
addToSystemPool, get, get, get, getEventHandler, getID, getList, removeFromSystemPool, sendEvent, setEventHandler
public static final int KEY_VALIDATED
Keyboard.getAction(int)
,
Constant Field Valuespublic static final int ALPHA
setMode(int)
,
Constant Field Valuespublic static final int NUM
setMode(int)
,
Constant Field Valuespublic static final int CAP
setMode(int)
,
Constant Field Valuespublic static final int CAP1
Keyboard.KEY_UP
event
CAP
,
setMode(int)
,
Constant Field Valuespublic Keypad(int size)
Keyboard.KEY_UP
, Keyboard.KEY_DOWN
and Keyboard.TEXT_INPUT
event).size
- of the buffer.Keyboard.dropOnFull()
public int getEventType()
EventGenerator
getEventType
in class Keyboard
public void setDelay(int delay)
delay
- the delay to setjava.lang.IllegalArgumentException
- if delay is negative or zeropublic int getDelay()
public void setMode(int mode)
public abstract void setLanguage(java.lang.String language)
language
- the ISO language codepublic abstract java.lang.String getLanguage()
setLanguage(String)
public abstract java.lang.String[] getSupportedLanguages()
public abstract char[] getAssignment(char key)
key
must be one of
'0'
, '1'
, '2'
, '3'
, '4'
, '5'
,
'6'
, '7'
, '8'
, '9'
, '*'
, '0'
,
'#'
.key
- the keykey