public class KeyboardManager
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
KeyboardManager.VScanCode
Virtual key scan codes.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
TRIGGER_ID_AUTOSCAN
ID for AutoScan trigger.
|
static int |
TRIGGER_ID_FRONT
ID for Front trigger.
|
static int |
TRIGGER_ID_LEFT
ID for Left trigger.
|
static int |
TRIGGER_ID_MOTION
ID for Motion trigger.
|
static int |
TRIGGER_ID_PISTOL
ID for Pistol trigger.
|
static int |
TRIGGER_ID_RIGHT
ID for Right trigger.
|
| Constructor and Description |
|---|
KeyboardManager()
This is the constructor of KeyboardManager.
|
| Modifier and Type | Method and Description |
|---|---|
int |
clearAllMappings()
Removes all the configured mappings.
|
int |
clearMapping(VScanEntry scanCode)
Removes a single active mapping.
|
int |
disableKey(VScanEntry scanCode,
boolean disable)
Disables completely a single physical key, through the
VScanEntry data structure. |
AdvancedKeyboard |
getAdvancedKeyboard()
Returns the
AdvancedKeyboard object, which can be used to
customize the keyboard configuration, read info about the currently
installed keyboard and listen to some keyboard events. |
java.util.List<Trigger> |
getAvailableTriggers()
Returns the available triggers in the device.
|
android.content.Intent |
getIntent(VScanEntry scanCode)
Returns current mapping between a physical key and an Intent.
|
static int[][] |
getKeyboardLayout()
Returns the physical keyboard layout.
|
KeyCodeEntry |
getKeyCode(VScanEntry scanCode)
Returns current mapping between a physical scan code key and an Android key code.
|
java.util.Map<VScanEntry,android.content.Intent> |
getMappedIntents()
Provides a
Map<
VScanEntry,
android.content.Intent
> containing all the stored and active Android Intent mappings. |
java.util.Map<VScanEntry,KeyCodeEntry> |
getMappedKeyCodes()
Provides a
Map<
VScanEntry, KeyCodeEntry>
containing all the stored and active Android key codes mappings. |
java.util.Map<VScanEntry,java.lang.Character> |
getMappedUnicodes()
|
java.lang.Character |
getUnicode(VScanEntry scanCode)
Returns current mapping between a physical key and a unicode character.
|
boolean |
isInputLocked()
Tells if the input from keyboard is locked.
|
boolean |
isKeyDisabled(VScanEntry scanCode)
Checks if a physical key is disabled.
|
int |
lockInput(boolean lock)
Locks or unlocks the input from keyboard and physical buttons.
|
int |
mapIntent(VScanEntry scanCode,
android.content.Intent intent)
Assigns an Intent to a physical key.
|
int |
mapKeyCode(VScanEntry scanCode,
KeyCodeEntry keyCode)
Assigns a virtual key code to a physical key.
|
int |
mapUnicode(VScanEntry scanCode,
java.lang.Character c)
Assigns a unicode character to a physical key.
|
public static final int TRIGGER_ID_LEFT
public static final int TRIGGER_ID_RIGHT
public static final int TRIGGER_ID_PISTOL
public static final int TRIGGER_ID_FRONT
public static final int TRIGGER_ID_AUTOSCAN
public static final int TRIGGER_ID_MOTION
public KeyboardManager()
DeviceException - in case of error.public int lockInput(boolean lock)
lock - boolean it specifies whether or not the keyboard will be locked.int DeviceException.SUCCESS in case of success,
otherwise a possible error code, matching one of the DeviceException error constants.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean isInputLocked()
boolean it returns whether or not the keyboard is locked.public int mapKeyCode(VScanEntry scanCode, KeyCodeEntry keyCode)
scanCode - a VScanEntry representing the virtual scan code.keyCode - a KeyCodeEntry representing the Android key code and meta state. (new KeyboardManager()).mapKeyCode(new VScanEntry(VScanCode.VSCAN_LEFT_TRIGGER), new KeyCodeEntry(KeyEvent.KEYCODE_UNKNOWN));
(new KeyboardManager()).mapKeyCode(new VScanEntry(VScanCode.VSCAN_LEFT_TRIGGER), new KeyCodeEntry(KeyEvent.KEYCODE_BUTTON_L1));
(new KeyboardManager()).mapKeyCode(new VScanEntry(VScanCode.VSCAN_RIGHT_ENTER), new KeyCodeEntry(KeyEvent.KEYCODE_HOME));
int DeviceException.SUCCESS in case of success,
otherwise a possible error code, matching one of the DeviceException error constants.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.VScanEntry,
KeyCodeEntrypublic KeyCodeEntry getKeyCode(VScanEntry scanCode)
scanCode - a VScanEntry representing the virtual scan code.KeyCodeEntry representing an Android key code and meta state. Returns null in case there
is no association.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.VScanEntry,
KeyCodeEntrypublic int mapUnicode(VScanEntry scanCode, java.lang.Character c)
scanCode - a VScanEntry representing the virtual scan code.c - unicode character (new KeyboardManager()).mapUnicode(new VScanEntry(VScanCode.VSCAN_1), '\\u0e01');
int DeviceException.SUCCESS in case of success,
otherwise a possible error code, matching one of the DeviceException error constants.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.VScanEntrypublic java.lang.Character getUnicode(VScanEntry scanCode)
scanCode - a VScanEntry representing the virtual scan code.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.VScanEntrypublic int mapIntent(VScanEntry scanCode, android.content.Intent intent)
scanCode - a VScanEntry representing the virtual scan code.intent - Intent used to launch an Android activity through the
Context.startActivity(Intent intent) method. (new KeyboardManager()).mapIntent(new VScanEntry(VScanCode.VSCAN_FRONT_TRIGGER), new Intent(MediaStore.ACTION_IMAGE_CAPTURE));
(new KeyboardManager()).mapIntent(new VScanEntry(VScanCode.VSCAN_FRONT_TRIGGER), new Intent(BarcodeManager.ACTION_START_DECODE));
int DeviceException.SUCCESS in case of success,
otherwise a possible error code, matching one of the DeviceException error constants.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.VScanEntrypublic android.content.Intent getIntent(VScanEntry scanCode)
scanCode - a VScanEntry representing the virtual scan code.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.VScanEntrypublic int clearAllMappings()
int DeviceException.SUCCESS in case of success,
otherwise a possible error code, matching one of the DeviceException error constants.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public int clearMapping(VScanEntry scanCode)
VScanEntry, if
existing, is removed.scanCode - a VScanEntry representing the virtual scan code, mapped that must be removed.int DeviceException.SUCCESS in case of success,
otherwise a possible error code, matching one of the DeviceException error constants.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public java.util.Map<VScanEntry,KeyCodeEntry> getMappedKeyCodes()
Map<
VScanEntry, KeyCodeEntry>
containing all the stored and active Android key codes mappings.Map<
VScanEntry,
KeyCodeEntry> the corresponding saved mappings. Null is
returned if there aren't any mappings saved.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public java.util.Map<VScanEntry,android.content.Intent> getMappedIntents()
Map<
VScanEntry,
android.content.Intent
> containing all the stored and active Android Intent mappings.Map<
VScanEntry,
android.content.Intent
> the corresponding saved mappings. Null is returned if there
aren't any mappings saved.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public java.util.Map<VScanEntry,java.lang.Character> getMappedUnicodes()
Map<
VScanEntry,
Character> the corresponding saved mappings.
Null is returned if there aren't any mappings saved.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public int disableKey(VScanEntry scanCode, boolean disable)
VScanEntry data structure.
When a key is disabled, no input will be produced whenever key presses are detected. When a key is again re-enabled,
is reset to its original value, so any previous mapping is automatically lost.scanCode - a VScanEntry representing the virtual scan code, associated to the physical key.disable - a boolean that specifies whether or not the key will be disabled.int DeviceException.SUCCESS in case of success,
otherwise a possible error code, matching one of the DeviceException error constants.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean isKeyDisabled(VScanEntry scanCode)
scanCode - a VScanEntry representing the virtual scan code, associated to the physical key.boolean True in case the key is disabled, false otherwise or in case of error.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public static int[][] getKeyboardLayout()
public java.util.List<Trigger> getAvailableTriggers()
Trigger objects, each representing one of the supported triggers.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public AdvancedKeyboard getAdvancedKeyboard()
AdvancedKeyboard object, which can be used to
customize the keyboard configuration, read info about the currently
installed keyboard and listen to some keyboard events.AdvancedKeyboard object if the device supports it,
otherwise it throws an exception if exceptions are enabled
through the ErrorManager singleton or null if exceptions
are disabled.DeviceException - in case of unsupported device, when exceptions
are enabled through the ErrorManager singleton.