java.lang.Object | |
↳ | com.datalogic.device.input.KeyboardManager |
This class provides access to keyboard related methods of the device.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
KeyboardManager.VScanCode | Virtual key scan codes. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ARG_LONG_PRESS_TIMEOUT | An argument for changing the behavior of LONG_PRESS_TIMED_OUT ,
configure the duration in milliseconds before a press turns into a long press. |
|||||||||
String | ARG_MULTIPLE_PRESS_COUNT | An argument for changing the behavior of MULTIPLE_PRESS_UP ,
configure the number of presses for multiple press detection. |
|||||||||
String | ARG_MULTIPLE_PRESS_MAX_BREAK | An argument for changing the behavior of MULTIPLE_PRESS_UP ,
configure the maximum break time between consecutive presses of a multiple press (in milliseconds). |
|||||||||
String | ARG_MULTIPLE_PRESS_MAX_INTERVAL | An argument for changing the behavior of MULTIPLE_PRESS_UP ,
configure the maximum interval between DOWN and UP of a multiple press (in milliseconds). |
|||||||||
String | ARG_VERY_LONG_PRESS_TIMEOUT | An argument for changing the behavior of VERY_LONG_PRESS_TIMED_OUT ,
configure the duration in milliseconds before a press turns into a very long press. |
|||||||||
int | TRIGGER_ID_AUTOSCAN | ID for AutoScan trigger. | |||||||||
int | TRIGGER_ID_FRONT | ID for Front trigger. | |||||||||
int | TRIGGER_ID_LEFT | ID for Left trigger. | |||||||||
int | TRIGGER_ID_MOTION | ID for Motion trigger. | |||||||||
int | TRIGGER_ID_PISTOL | ID for Pistol trigger. | |||||||||
int | TRIGGER_ID_PTT | ID for PTT trigger. | |||||||||
int | TRIGGER_ID_RIGHT | ID for Right trigger. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This is the constructor of KeyboardManager.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Removes all the configured mappings.
| |||||||||||
Removes a single active mapping.
| |||||||||||
Disables completely a single physical key, through the
VScanEntry data structure. | |||||||||||
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. | |||||||||||
Retrieve all mapped scan codes.
| |||||||||||
Returns the available triggers in the device.
| |||||||||||
Returns current mapping between a physical key and an Intent.
| |||||||||||
Returns current mapping between a physical scan code key and an Android key code.
| |||||||||||
Returns the key code used to command an unattended battery swap.
| |||||||||||
Returns the physical keyboard layout.
| |||||||||||
Provides a
Map <
VScanEntry ,
android.content.Intent
> containing all the stored and active Android Intent mappings. | |||||||||||
Provides a
Map <
VScanEntry , KeyCodeEntry >
containing all the stored and active Android key codes mappings. | |||||||||||
Gets the arguments of a key mapping.
| |||||||||||
Query the mapping information of a key.
| |||||||||||
Returns current mapping between a physical key and a unicode character.
| |||||||||||
Tells if the input from keyboard is locked.
| |||||||||||
Checks if a physical key is disabled.
| |||||||||||
Locks or unlocks the input from keyboard and physical buttons.
| |||||||||||
Assigns an Intent to a physical key.
| |||||||||||
Maps key events to customized actions.
| |||||||||||
Maps key events to customized actions.
| |||||||||||
Assigns a virtual key code to a physical key.
| |||||||||||
Assigns a unicode character to a physical key.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
An argument for changing the behavior of LONG_PRESS_TIMED_OUT
,
configure the duration in milliseconds before a press turns into a long press.
Used as a map entry key to configure arguments in mapKey(VScanEntry, Map, Map)
Default value: 500 (ms)
An argument for changing the behavior of MULTIPLE_PRESS_UP
,
configure the number of presses for multiple press detection.
Used as a map entry key to configure arguments in mapKey(VScanEntry, Map, Map)
Default value: 2
An argument for changing the behavior of MULTIPLE_PRESS_UP
,
configure the maximum break time between consecutive presses of a multiple press (in milliseconds).
Used as map entry key to configure arguments in mapKey(VScanEntry, Map, Map)
Default value: 200 (ms)
An argument for changing the behavior of MULTIPLE_PRESS_UP
,
configure the maximum interval between DOWN and UP of a multiple press (in milliseconds).
Used as a map entry key to configure arguments in mapKey(VScanEntry, Map, Map)
Default value: 200 (ms)
An argument for changing the behavior of VERY_LONG_PRESS_TIMED_OUT
,
configure the duration in milliseconds before a press turns into a very long press.
Used as a map entry key to configure arguments in mapKey(VScanEntry, Map, Map)
Default value: 5000 (ms)
ID for AutoScan trigger.
ID for Front trigger.
ID for Left trigger.
ID for Motion trigger.
ID for Pistol trigger.
ID for PTT trigger.
ID for Right trigger.
This is the constructor of KeyboardManager.
DeviceException | in case of error. |
---|
Removes all the configured mappings. Whenever this method is called, all the current active mappings are cleared and removed.
int
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.
|
---|
Removes a single active mapping. The current active mapping for the
selected VScanEntry
, if
existing, is removed.
scanCode | a VScanEntry representing the virtual scan code, mapped that must be removed. |
---|
int
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.
|
---|
Disables completely a single physical key, through the 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
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.
|
---|
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.
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.
|
---|
Retrieve all mapped scan codes.
This method returns a list of all mapped scan codes.
You may query the mapping information of each scan codes in the returned list by using
getMappingObjects(VScanEntry)
Returns the available triggers in the device.
Trigger
objects, each representing one of the supported triggers.DeviceException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Returns current mapping between a physical key and an Intent.
scanCode | a VScanEntry representing the virtual scan code. |
---|
DeviceException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Returns current mapping between a physical scan code key and an Android key code.
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.
|
---|
Returns the key code used to command an unattended battery swap.
Returns the physical keyboard layout. It can be used by application for keyboard remapping.
Provides a 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.
|
---|
Provides a 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.
|
---|
Provides a Map
<
VScanEntry
,
Character
> containing all the stored and active
Character mappings.
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.
|
---|
Gets the arguments of a key mapping.
Using this method to retrieve the arguments that you have passed to mapKey(VScanEntry, Map, Map)
as the third parameter.
scanCode | scan code to look for key mapping |
---|
Query the mapping information of a key.
Using this method to retrieve the mapping information that you have passed to mapKey(VScanEntry, Map, Map)
as the second parameter.
scanCode | scan code to look for key mapping |
---|
Returns current mapping between a physical key and a unicode character.
scanCode | a VScanEntry representing the virtual scan code. |
---|
DeviceException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Tells if the input from keyboard is locked.
boolean
it returns whether or not the keyboard is locked.
Checks if a physical key is disabled.
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.
|
---|
Locks or unlocks the input from keyboard and physical buttons.
lock | boolean it specifies whether or not the keyboard will be locked. |
---|
int
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.
|
---|
Assigns an Intent to a physical key. If a mapping for the desired physical key is already assigned and saved, it will be overridden.
scanCode | a VScanEntry representing the virtual scan code. |
---|---|
intent | Intent used to launch an Android activity through the
Context.startActivity(Intent intent) method. Example code to make Camera Activity capture an image on the front scan trigger pressure: (new KeyboardManager()).mapIntent(new VScanEntry(VScanCode.VSCAN_FRONT_TRIGGER), new Intent(MediaStore.ACTION_IMAGE_CAPTURE));
Example code to make BarcodeManager capture a barcode on the front scan trigger pressure and to stop capturing on the front scan trigger release: (new KeyboardManager()).mapIntent(new VScanEntry(VScanCode.VSCAN_FRONT_TRIGGER), new Intent(BarcodeManager.ACTION_START_DECODE));
|
int
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.
|
---|
Maps key events to customized actions.
This is a generic way to map a key to customized actions.
The actions are defined by providing a map of MappingTriggerPolicy
to MappingObject
.
For each entry in this map, the key defines a key events for detection and the value defines customized actions to be executed.
Optionally, you can also provide several arguments to change the way MappingTriggerPolicy
is detected.
For example, you may customize the long press timeout of LONG_PRESS_TIMED_OUT
by providing
ARG_LONG_PRESS_TIMEOUT
argument.
For more information about possible arguments, see:
ARG_LONG_PRESS_TIMEOUT
,
ARG_MULTIPLE_PRESS_COUNT
,
ARG_MULTIPLE_PRESS_MAX_BREAK
,
ARG_MULTIPLE_PRESS_MAX_INTERVAL
scanCode | a scan code to track events |
---|---|
mappingInfo | a map defines the key events and the corresponding actions to be executed |
arguments | optional arguments to change the behavior of trigger policies |
ErrorManager
singleton.
Maps key events to customized actions.
This is a generic way to map a key to customized actions.
The actions are defined by providing a map of MappingTriggerPolicy
to MappingObject
.
For each entry in this map, the key defines a key events for detection and the value defines customized actions to be executed.
scanCode | a scan code to track events |
---|---|
mappingInfo | a map defines the key events and the corresponding actions to be executed |
ErrorManager
singleton.
Assigns a virtual key code to a physical key. If a mapping for the desired physical key is already assigned and saved, it will be overridden.
scanCode | a VScanEntry representing the virtual scan code. |
---|---|
keyCode | a KeyCodeEntry representing the Android key code and meta state. Example code to avoid any keyboard event on the left scan trigger pressure: (new KeyboardManager()).mapKeyCode(new VScanEntry(VScanCode.VSCAN_LEFT_TRIGGER), new KeyCodeEntry(KeyEvent.KEYCODE_UNKNOWN));
Example code to map the left scan trigger to the Android left trigger button key code: (new KeyboardManager()).mapKeyCode(new VScanEntry(VScanCode.VSCAN_LEFT_TRIGGER), new KeyCodeEntry(KeyEvent.KEYCODE_BUTTON_L1));
Example code to map the enter key to the Android home key code: (new KeyboardManager()).mapKeyCode(new VScanEntry(VScanCode.VSCAN_RIGHT_ENTER), new KeyCodeEntry(KeyEvent.KEYCODE_HOME));
|
int
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.
|
---|
Assigns a unicode character to a physical key. If a mapping for the desired physical key is already assigned and saved, it will be overridden.
scanCode | a VScanEntry representing the virtual scan code. |
---|---|
c | unicode character Example code to assign a Thai unicode character to the physical key '1': (new KeyboardManager()).mapUnicode(new VScanEntry(VScanCode.VSCAN_1), '\\u0e01');
|
int
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.
|
---|