public class BarcodeManager extends java.lang.Object implements PropertyEditor
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.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ACTION_START_DECODE
Barcode start decode intent action.
|
static java.lang.String |
ACTION_STOP_DECODE
Barcode stop decode intent action.
|
static int |
KEYCODE_BARCODE
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. |
| Constructor and Description |
|---|
BarcodeManager()
This is the constructor of BarcodeManager.
|
| Modifier and Type | Method and Description |
|---|---|
int |
addDeinitListener(DeinitListener listener)
Registers a
DeinitListener to be notified when a event of Scanner
de-initiliazion is triggered. |
int |
addFrameCaptureListener(FrameCaptureListener listener)
Registers a
FrameCaptureListener to be notified when a frame capture event is
triggered. |
int |
addFrameSaveListener(FrameSaveListener listener)
Registers a
FrameSaveListener to be notified when a frame save event is
triggered. |
int |
addInitListener(InitListener listener)
Registers a
InitListener to be notified when a event of completed
Scanner initialization is triggered. |
int |
addPresentationStateListener(PresentationStateListener listener)
Registers a
PresentationStateListener to be notified when a frame save event is
triggered. |
int |
addReadListener(ReadListener listener)
Registers a
ReadListener to be notified when a read event is
triggered. |
int |
addStartListener(StartListener listener)
Registers a
StartListener to be notified when a scan started
event is triggered. |
int |
addStopListener(StopListener listener)
Registers a
StopListener to be notified when a scan stopped
event is triggered. |
int |
addTimeoutListener(TimeoutListener listener)
Registers a
TimeoutListener to be notified when a scan
timeout event is triggered. |
int |
commitProperties()
Saves the configuration.
|
int |
enableAllSymbologies(boolean enable)
Enables or disables all supported symbologies.
|
int |
enableSymbology(Symbology barcodeType,
boolean enable)
Enables or disables a barcode symbology type.
|
int |
getPropertyAvailability(int[] id_buffer,
boolean[] availability_buffer)
Retrieves the availability, the support, for the passed programming parameters.
|
int |
getPropertyInts(int[] id_buffer,
int[] value_buffer)
Gets one or more label programming parameters of type Integer.
|
int |
getPropertyRanges(int[] id_buffer,
int[][] property_ranges)
Gets one or more property ranges for the passed programming parameters.
|
int |
getPropertyStrings(int[] id_buffer,
java.lang.String[] value_buffer)
Gets one or more label programming parameters of type String.
|
boolean |
isInitialized()
Checks if the Scanner Service is correctly initialized.
|
boolean |
isSymbologyEnabled(Symbology barcodeType)
Returns current enable setting for a particular barcode symbology.
|
boolean |
isSymbologySupported(Symbology barcodeType)
Return true if the device's decoder is able to read a particular barcode
symbology.
|
int |
pressTrigger()
Call this method to simulate a trigger button pressure.
|
int |
release()
Removes and clears all the registered listeners, in case some application
did not call removal methods.
|
int |
releaseTrigger()
Call this method to simulate a release of a the trigger button.
|
int |
removeDeinitListener(DeinitListener listener)
Unregisters a
DeinitListener associated with the decoder. |
int |
removeFrameCaptureListener(FrameCaptureListener listener)
Unregisters a
FrameCaptureListener associated with the decoder. |
int |
removeFrameSaveListener(FrameSaveListener listener)
Unregisters a
FrameSaveListener associated with the decoder. |
int |
removeInitListener(InitListener listener)
Unregisters a
InitListener associated with the decoder. |
int |
removePresentationStateListener(PresentationStateListener listener)
Unregisters a
PresentationStateListener associated with the decoder. |
int |
removeReadListener(ReadListener listener)
Unregisters a
ReadListener associated with the decoder. |
int |
removeStartListener(StartListener listener)
Unregisters a
StartListener associated with the decoder. |
int |
removeStopListener(StopListener listener)
Unregisters a
StopListener associated with the decoder. |
int |
removeTimeoutListener(TimeoutListener listener)
Unregisters a
TimeoutListener associated with the decoder. |
int |
setDefaults()
Set factory defaults for all barcode symbology types.
|
int |
setPropertyInts(int[] id_buffer,
int[] value_buffer)
Sets one or more label programming parameters of type Integer.
|
int |
setPropertyStrings(int[] id_buffer,
java.lang.String[] value_buffer)
Sets one or more label programming parameters of type String.
|
int |
startDecode()
Call this method to start decoding.
|
int |
startDecode(int timeout)
Call this method to start decoding.
|
int |
stopDecode()
This stops any data acquisition currently in progress.
|
public static final java.lang.String ACTION_START_DECODE
public int startDecodingIntent() {   Intent myintent = new Intent();   myintent.setAction(ACTION_START_DECODE);}public static final java.lang.String ACTION_STOP_DECODE
public int stopDecodingIntent() {   Intent myintent = new Intent();   myintent.setAction(ACTION_STOP_DECODE);}public static final int KEYCODE_BARCODE
VScanEntry, this means a
specific scan code can be mapped to the desired Android keycode.public BarcodeManager()
DecodeException - in case of error.public boolean isInitialized()
int DecodeException.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.public int addReadListener(ReadListener listener)
ReadListener to be notified when a read event is
triggered. Call removeReadListener(com.datalogic.decode.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 DecodeException.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.public int removeReadListener(ReadListener listener)
ReadListener associated with the decoder.listener - The ReadListener that will be no more notified.int DecodeException.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.public int addStartListener(StartListener listener)
StartListener to be notified when a scan started
event is triggered. Call removeStartListener(com.datalogic.decode.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 DecodeException.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.public int removeStartListener(StartListener listener)
StartListener associated with the decoder.listener - The StartListener that will be no more notified.int DecodeException.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.public int addStopListener(StopListener listener)
StopListener to be notified when a scan stopped
event is triggered. Call removeStopListener(com.datalogic.decode.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 DecodeException.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.public int removeStopListener(StopListener listener)
StopListener associated with the decoder.listener - The StopListener that will be no more notified.int DecodeException.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.public int addTimeoutListener(TimeoutListener listener)
TimeoutListener to be notified when a scan
timeout event is triggered. Call removeTimeoutListener(com.datalogic.decode.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 DecodeException.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.public int removeTimeoutListener(TimeoutListener listener)
TimeoutListener associated with the decoder.listener - The TimeoutListener that will be no more
notified.int DecodeException.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.public int addInitListener(InitListener listener)
InitListener to be notified when a event of completed
Scanner initialization is triggered. Call removeInitListener(com.datalogic.decode.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 DecodeException.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.public int removeInitListener(InitListener listener)
InitListener associated with the decoder.listener - The InitListener that will be no more notified.int DecodeException.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.public int addDeinitListener(DeinitListener listener)
DeinitListener to be notified when a event of Scanner
de-initiliazion is triggered. Call removeDeinitListener(com.datalogic.decode.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 DecodeException.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.public int removeDeinitListener(DeinitListener listener)
DeinitListener associated with the decoder.listener - The DeinitListener that will be no more notified.int DecodeException.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.public int addFrameCaptureListener(FrameCaptureListener listener)
FrameCaptureListener to be notified when a frame capture event is
triggered. Call removeFrameCaptureListener(com.datalogic.decode.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 DecodeException.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.public int removeFrameCaptureListener(FrameCaptureListener listener)
FrameCaptureListener associated with the decoder.listener - The FrameCaptureListener that will be no more notified.int DecodeException.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.public int addFrameSaveListener(FrameSaveListener listener)
FrameSaveListener to be notified when a frame save event is
triggered. Call removeFrameSaveListener(com.datalogic.decode.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 DecodeException.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.public int removeFrameSaveListener(FrameSaveListener listener)
FrameSaveListener associated with the decoder.listener - The FrameSaveListener that will be no more notified.int DecodeException.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.public int addPresentationStateListener(PresentationStateListener listener)
PresentationStateListener to be notified when a frame save event is
triggered. Call removeFrameSaveListener(com.datalogic.decode.FrameSaveListener) before the application
closes to properly shut down the listener.listener - The PresentationStateListener that will be called when a
decoder's read event is fired.int DecodeException.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.public int removePresentationStateListener(PresentationStateListener listener)
PresentationStateListener associated with the decoder.listener - The PresentationStateListener that will be no more notified.int DecodeException.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.public int release()
int DecodeException.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.public int startDecode(int timeout)
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 DecodeException.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.public int startDecode()
public int startDecoding(BarcodeManager decoder) {
  decoder.startDecode();}int DecodeException.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.public int stopDecode()
public int abortDecoding(BarcodeManager decoder) {
  decoder.stopDecode();}int DecodeException.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.public int pressTrigger()
int DecodeException.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.public int releaseTrigger()
int DecodeException.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.public int enableSymbology(Symbology barcodeType, boolean enable)
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 DecodeException.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.public int enableAllSymbologies(boolean enable)
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 DecodeException.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.public int setDefaults()
public int setAllDefaults(BarcodeManager decoder) {
  decoder.setDefaults();}int DecodeException.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.public boolean isSymbologyEnabled(Symbology barcodeType)
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.public boolean isSymbologySupported(Symbology barcodeType)
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.public int getPropertyStrings(int[] id_buffer,
java.lang.String[] value_buffer)
getPropertyStrings in interface PropertyGetterid_buffer - The int[] of identifiers for parameters to get.value_buffer - The String[] of values associated to the passed IDs to get.int ConfigException.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.public int getPropertyInts(int[] id_buffer,
int[] value_buffer)
getPropertyInts in interface PropertyGetterid_buffer - The int[] of identifiers for parameters to get.value_buffer - The int[] of values associated to the passed IDs to get.int ConfigException.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.public int setPropertyInts(int[] id_buffer,
int[] value_buffer)
setPropertyInts in interface PropertyEditorid_buffer - The int[] of identifiers for parameters to set.value_buffer - The int[] of values associated to the passed IDs to set.int ConfigException.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.public int setPropertyStrings(int[] id_buffer,
java.lang.String[] value_buffer)
setPropertyStrings in interface PropertyEditorid_buffer - The int[] identifiers for parameters to set.value_buffer - The String[] of values associated to the passed IDs to set.int ConfigException.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.public int commitProperties()
commitProperties in interface PropertyEditorint ConfigException.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.public int getPropertyRanges(int[] id_buffer,
int[][] property_ranges)
getPropertyRanges in interface PropertyGetterid_buffer - The int[] of identifiers for parameters to look for.property_ranges - The int[][] array of ranges associated to the passed IDs, that will be filled in.int ConfigException.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.public int getPropertyAvailability(int[] id_buffer,
boolean[] availability_buffer)
getPropertyAvailability in interface PropertyGetterid_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 ConfigException.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.