java.lang.Object | |
↳ | com.datalogic.decode.BarcodeManager |
BarcodeManager
gives developers access to decoder related
methods of the device.
To decode bar codes with this class, use the following steps:
BarcodeManager()
;
startDecode()
. Your registered
StartListener/ReadListener/TimeoutListener will be called when a successful
decode occurs or if the configured timeout expires, etc;
stopDecode()
to end the decode session;
release()
to release all registered StartListener/ReadListener/TimeoutListener/StopListener.
Configuration persistance: All the configuration changes done using the BarcodeManager
are natively not persistent to the device reboot, they are kept only in the current device session.
If you want to persist your changes in flash and keep them across a system reboot the only existing way is to call explicitally commitProperties()
. Beware that the decoding system configuration is
restored from flash every time the decoding service restart and so any configuration not stored persistently could be lost if the service is killed (and consequently restarted) by the Android OS. It is a rare
event that could happens for many reasons (low resources, execution exception, not responding service, etc...), the decoding system is usually restored but any configuration not stored persistently could be lost.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ACTION_START_DECODE | Barcode start decode intent action. | |||||||||
String | ACTION_STOP_DECODE | Barcode stop decode intent action. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
KEYCODE_BARCODE | Android keycode representing the scanning functionality, in accordance with android.view.KeyEvent. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This is the constructor of BarcodeManager.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Registers a
DeinitListener to be notified when a event of Scanner
de-initiliazion is triggered. | |||||||||||
Registers a
FrameCaptureListener to be notified when a frame capture event is
triggered. | |||||||||||
Registers a
FrameSaveListener to be notified when a frame save event is
triggered. | |||||||||||
Registers a
InitListener to be notified when a event of completed
Scanner initialization is triggered. | |||||||||||
Registers a
PresentationStateListener to be notified when a presentation mode state change event is
triggered. | |||||||||||
Registers a
ReadListener to be notified when a read event is
triggered. | |||||||||||
Registers a
StartListener to be notified when a scan started
event is triggered. | |||||||||||
Registers a
StopListener to be notified when a scan stopped
event is triggered. | |||||||||||
Registers a
TimeoutListener to be notified when a scan
timeout event is triggered. | |||||||||||
Saves the configuration.
| |||||||||||
Enables or disables all supported symbologies.
| |||||||||||
Enables or disables a barcode symbology type.
| |||||||||||
Gets the input device in use.
| |||||||||||
Returns the list of custom OCR configurations found in the device.
| |||||||||||
Retrieves the availability, the support, for the passed programming parameters.
| |||||||||||
Gets one or more label programming parameters of type Integer.
| |||||||||||
Gets one or more property ranges for the passed programming parameters.
| |||||||||||
Gets one or more label programming parameters of type String.
| |||||||||||
Gets the list of supported input devices.
| |||||||||||
Checks if the Scanner Service is correctly initialized.
| |||||||||||
Returns current enable setting for a particular barcode symbology.
| |||||||||||
Return true if the device's decoder is able to read a particular barcode
symbology.
| |||||||||||
Call this method to simulate a trigger button pressure.
| |||||||||||
Removes and clears all the registered listeners, in case some application
did not call removal methods.
| |||||||||||
Call this method to simulate a release of a the trigger button.
| |||||||||||
Unregisters a
DeinitListener associated with the decoder. | |||||||||||
Unregisters a
FrameCaptureListener associated with the decoder. | |||||||||||
Unregisters a
FrameSaveListener associated with the decoder. | |||||||||||
Unregisters a
InitListener associated with the decoder. | |||||||||||
Unregisters a
PresentationStateListener associated with the decoder. | |||||||||||
Unregisters a
ReadListener associated with the decoder. | |||||||||||
Unregisters a
StartListener associated with the decoder. | |||||||||||
Unregisters a
StopListener associated with the decoder. | |||||||||||
Unregisters a
TimeoutListener associated with the decoder. | |||||||||||
Sets the input device in use.
| |||||||||||
Set factory defaults for all barcode symbology types.
| |||||||||||
Sets one or more label programming parameters of type Integer.
| |||||||||||
Sets one or more label programming parameters of type String.
| |||||||||||
Call this method to start decoding.
| |||||||||||
Call this method to start decoding.
| |||||||||||
This stops any data acquisition currently in progress.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.datalogic.device.configuration.PropertyEditor
| |||||||||||
From interface
com.datalogic.device.configuration.PropertyGetter
|
Barcode start decode intent action. It is possible to start a capture
session in order to scan a barcode from an application, sending a
specific broadcast intent.
Example:
public int startDecodingIntent() {
Intent myintent = new Intent();
myintent.setAction(ACTION_START_DECODE);
}
Otherwise application can associate this intent to a physical key code
through the KeyboardManager mapIntent method.
Barcode stop decode intent action. When an application sends this
broadcast intent, the system stops scanning.
Example:
public int stopDecodingIntent() {
Intent myintent = new Intent();
myintent.setAction(ACTION_STOP_DECODE);
}
Android keycode representing the scanning functionality, in accordance
with android.view.KeyEvent.
It is possible to associate a device generic button to the scanning
functionality through the mapping mechanism and the
VScanEntry
, this means a
specific scan code can be mapped to the desired Android keycode.
This is the constructor of BarcodeManager.
DecodeException | in case of error. |
---|
Registers a DeinitListener
to be notified when a event of Scanner
de-initiliazion is triggered. Call removeDeinitListener(DeinitListener)
before
the application closes to properly shut down the listener.
listener | The DeinitListener that will be called when a
decoder's de-init event is fired. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Registers a FrameCaptureListener
to be notified when a frame capture event is
triggered. Call removeFrameCaptureListener(FrameCaptureListener)
before the application
closes to properly shut down the listener.
listener | The FrameCaptureListener that will be called when a
decoder's read event is fired. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Registers a FrameSaveListener
to be notified when a frame save event is
triggered. Call removeFrameSaveListener(FrameSaveListener)
before the application
closes to properly shut down the listener.
listener | The FrameSaveListener that will be called when a
decoder's read event is fired. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Registers a InitListener
to be notified when a event of completed
Scanner initialization is triggered. Call removeInitListener(InitListener)
before
the application closes to properly shut down the listener.
listener | The InitListener that will be called when a
decoder's init event is fired. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Registers a PresentationStateListener
to be notified when a presentation mode state change event is
triggered. Call removePresentationStateListener(PresentationStateListener)
before the application
closes to properly shut down the listener.
listener | The PresentationStateListener that will be called when a
presentation mode state change event is fired. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Registers a ReadListener
to be notified when a read event is
triggered. Call removeReadListener(ReadListener)
before the application
closes to properly shut down the listener.
listener | The ReadListener that will be called when a
decoder's read event is fired. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Registers a StartListener
to be notified when a scan started
event is triggered. Call removeStartListener(StartListener)
before the
application closes to properly shut down the listener.
listener | The StartListener that will be called when a
decoder's started scan event is fired. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Registers a StopListener
to be notified when a scan stopped
event is triggered. Call removeStopListener(StopListener)
before the
application closes to properly shut down the listener.
listener | The StopListener that will be called when a
decoder's stopped scan event is fired. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Registers a TimeoutListener
to be notified when a scan
timeout event is triggered. Call removeTimeoutListener(TimeoutListener)
before the application closes to properly shut down the listener.
listener | The TimeoutListener that will be called when a
decoder's scan timeout event is fired. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Saves the configuration. The configuration is saved in a persistent way across system reboot. See persistance note.
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the ConfigException
error constants.ConfigException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Enables or disables all supported symbologies.
Note:
when the decoding configuration changes due a call to this
method, it is not saved in a persistent way across system
reboot. See persistance note.
Example:
public int enableAll() {
decoder.enableAllSymbologies(true);
}
enable | boolean specifies whether or not the symbologies will be enabled. If
false, the symbologies are disabled, otherwise they are
enabled. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
or ConfigException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton. |
---|---|
ConfigException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
Enables or disables a barcode symbology type.
Note:
when the decoding configuration changes due a call to this
method, it is not saved in a persistent way across system
reboot. See persistance note.
Example:
public int enableCode39(BarcodeManager decoder) {
decoder.enableSymbology(Symbology.CODE39, true);
}
barcodeType | Indicates the type of data whose enable setting is to be
altered. (one of the barcode type in the
Symbology class). |
---|---|
enable | boolean specifies whether or not the data type will be enabled. If
false, the data type is disabled, otherwise it is enabled. |
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
or ConfigException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton. |
---|---|
ConfigException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
Gets the input device in use.
Returns the list of custom OCR configurations found in the device.
Retrieves the availability, the support, for the passed programming parameters.
id_buffer | The int[] of identifiers for parameters to look for. |
---|---|
availability_buffer | The boolean[] of the passed IDs' availability, that will be filled in. |
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the ConfigException
error constants.ConfigException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Gets one or more label programming parameters of type Integer.
id_buffer | The int[] of identifiers for parameters to get. |
---|---|
value_buffer | The int[] of values associated to the passed IDs to get. |
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the ConfigException
error constants.ConfigException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Gets one or more property ranges for the passed programming parameters.
id_buffer | The int[] of identifiers for parameters to look for. |
---|---|
property_ranges | The int[][2] array of ranges associated to the passed IDs, that will be filled in.
Each element will be filled with the range of the admissible values described by min and max value. |
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the ConfigException
error constants.ConfigException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Gets one or more label programming parameters of type String.
id_buffer | The int[] of identifiers for parameters to get. |
---|---|
value_buffer | The String[] of values associated to the passed IDs to get. |
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the ConfigException
error constants.ConfigException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Gets the list of supported input devices.
Checks if the Scanner Service is correctly initialized.
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Returns current enable setting for a particular barcode symbology.
Example:
public boolean isCode39Enabled(BarcodeManager decoder) {
return decoder.isSymbologyEnabled(Symbology.CODE39);
}
barcodeType | This gets the current enable setting for a particular data
type. (one of the barcode typein the Symbology
class). |
---|
boolean
False is returned if the particular data type is disabled, and
true is returned otherwise.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton. |
---|---|
ConfigException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
Return true if the device's decoder is able to read a particular barcode
symbology.
Example:
public boolean isQRSupported(BarcodeManager decoder) {
return decoder.isSymbologySupported(Symbology.QRCODE);
}
barcodeType | Barcode type is one of the Symbology . |
---|
boolean
False is returned if the decoder is not able to read the
particular barcode type, and true is returned otherwise.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton. |
---|---|
ConfigException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
Call this method to simulate a trigger button pressure.
The method does not always start immediately a capture, instead it behaves like pressing scan button.
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Removes and clears all the registered listeners, in case some application did not call removal methods.
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Call this method to simulate a release of a the trigger button.
The method does not always stop immediately a capture, instead it behaves like releasing scan button.
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Unregisters a DeinitListener
associated with the decoder.
listener | The DeinitListener that will be no more notified. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Unregisters a FrameCaptureListener
associated with the decoder.
listener | The FrameCaptureListener that will be no more notified. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Unregisters a FrameSaveListener
associated with the decoder.
listener | The FrameSaveListener that will be no more notified. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Unregisters a InitListener
associated with the decoder.
listener | The InitListener that will be no more notified. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Unregisters a PresentationStateListener
associated with the decoder.
listener | The PresentationStateListener that will be no more notified. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Unregisters a ReadListener
associated with the decoder.
listener | The ReadListener that will be no more notified. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Unregisters a StartListener
associated with the decoder.
listener | The StartListener that will be no more notified. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Unregisters a StopListener
associated with the decoder.
listener | The StopListener that will be no more notified. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Unregisters a TimeoutListener
associated with the decoder.
listener | The TimeoutListener that will be no more
notified. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Sets the input device in use.
currentInputDevice | The input device to set. |
---|
Set factory defaults for all barcode symbology types.
Note:
when the decoding configuration changes due a call to this
method, it is not saved in a persistent way across system
reboot. See persistance note.
Example:
public int setAllDefaults(BarcodeManager decoder) {
decoder.setDefaults();
}
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Sets one or more label programming parameters of type Integer. The change is not persistent across system reboot. See persistance note.
id_buffer | The int[] of identifiers for parameters to set. |
---|---|
value_buffer | The int[] of values associated to the passed IDs to set. |
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the ConfigException
error constants.ConfigException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Sets one or more label programming parameters of type String. The change is not persistent across system reboot. See persistance note.
id_buffer | The int[] identifiers for parameters to set. |
---|---|
value_buffer | The String[] of values associated to the passed IDs to set. |
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the ConfigException
error constants.ConfigException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Call this method to start decoding.
If the trigger is already active, the present timeout is reset to the new
value and the count starts again.
Example:
public int startDecodingForFiveSeconds(BarcodeManager decoder) {
decoder.startDecode(5000);
}
timeout | int representing the amount of time, in milliseconds,
to continue the attempt to acquire data. If data has not been
obtained after this time period, then the decoder is deactivated. |
---|
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
Call this method to start decoding.
Default timeout or the one set through the SDK will be applied.
Example:
public int startDecoding(BarcodeManager decoder) {
decoder.startDecode();
}
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|
This stops any data acquisition currently in progress.
Example:
public int abortDecoding(BarcodeManager decoder) {
decoder.stopDecode();
}
int
SUCCESS
in case of success,
otherwise a possible error code, matching one of the DecodeException
error constants.DecodeException | in case of error, when exceptions are enabled through the ErrorManager singleton.
|
---|