Inherits NativeHandle.
Public Member Functions | |
Symbology Settings | |
void | enableSymbology (int symbology, boolean enable) |
SymbologySettings | getSymbologySettings (int symbology) |
Static Public Member Functions | |
static BarcodeScannerSettings | createWithPreset (int preset) |
static BarcodeScannerSettings | createWithJson (String json) throws JSONParseException |
Static Public Attributes | |
static final int | PRESET_NONE |
static final int | PRESET_ENABLE_RETAIL_SYMBOLOGIES |
static final int | PRESET_ENABLE_VIN_DECODING |
static final int | PRESET_ENABLE_SSCC_DECODING |
static final int | PRESET_ENABLE_SINGLE_FRAME_MODE |
Code location constraint. | |
static final int | CODE_LOCATION_RESTRICT |
static final int | CODE_LOCATION_HINT |
static final int | CODE_LOCATION_IGNORE |
Detailed Description
Holds configuration options for the barcode scanner.
The barcode scanner settings influence how 1d and 2d codes are decoded by an BarcodeScanner instance.
For the settings to take effect they must be applied to the barcode scanner. This can be done when the barcode scanner is created, or at a later stage with BarcodeScanner.applySettings()
Steps to Configure the Barcode Scanner
- Create a new settings object starting from one of the presets (BarcodeScannerSettings.createWithPreset()
- Enable decoding of the required 1d and 2d symbologies using BarcodeScannerSettings.enableSymbology()
- Optional: Set any additional symbology-specific settings on the symbology settings objects obtained by calling BarcodeScannerSettings.getSymbologySettings().
- Optional: If desired, configure the scan location (see below).
Scan Location
By default, 1d and 2d codes are searched in the full image. If it is known that codes only appear in certain areas, or part of the camera feed is hidden below a UI element, the localization can be restricted to certain parts of the image by setting the scan area with BarcodeScannerSettings.setSearchArea(). This setting affects both 1d and 2d codes.
To control scanning areas of 1d and 2d codes separately, set the 1d/2d code location areas (BarcodeScannerSettings.setCodeLocationArea1d(), BarcodeScannerSettings.setCodeLocationArea2d()). By default, these areas serve as hints to the barcode scanner as to where codes are expected in the image (the code location constraints are set to BarcodeScannerSettings.CODE_LOCATION_HINT). The scanner uses these areas to give more weight to codes found in the code location areas. It is also possible to completely turn off barcode localization and only use the 1d/2d code location areas. This is done by setting the code location constraint to BarcodeScannerSettings.CODE_LOCATION_RESTRICT.
Use Cases
To illustrate how the scan area, 1d/2d code location areas and constraints work together, we show configurations for common scanning scenarios.
Full Image Localization with preference to horizontal 1d codes: This is the default setting and not further configuration is required. The 1d code location area is set to a centered strip 1/5 of of the image height running from the left to the right. The code location constraint is set to BarcodeScannerSettings.CODE_LOCATION_HINT, and the code direction hint is BarcodeScanner.CODE_DIRECTION_LEFT_TO_RIGHT.
Laser UI Scanning: To scan barcodes in a narrow band, set the 1d code location area and use a 1d code location constraint of BarcodeScannerSettings.CODE_LOCATION_RESTRICT. You also need to set the code direction hint to match the main direction of the narrow band. If at the same time 2d codes are to be scanned, set the 2d code location area to a larger rectangle.
- Since
- 4.7.0
Member Function Documentation
|
static |
Create a new barcode scanner settings object.
- Parameters
-
preset an ORed combination of ScBarcodeScannerSettingsPreset
- Returns
- the newly created barcode scanner settings object.
- Since
- 4.7.0
|
static |
Create a new barcode scanner settings object from a json representation.
- Parameters
-
json A json object in its string representation.
- Returns
- the newly created barcode scanner settings object.
- Exceptions
-
JSONParseException Thrown if the json content contains wrong data types for certain settings.
- Since
- 4.7.0
void enableSymbology | ( | int | symbology, |
boolean | enable | ||
) |
Enable/disable decoding of a certain symbology.
This function provides a convenient shortcut to enabling/disabling decoding of a particular symbology without having to go through SymbologySettings.
- Parameters
-
symbology the symbology to be enabled. Must be a valid symbology and equal to Barcode.SYMBOLOGY_UNKNOWN. enable true when decoding of the symbology should be enabled, false if not.
- Since
- 4.7.0
SymbologySettings getSymbologySettings | ( | int | symbology | ) |
Retrieve symbology-specific settings.
- Parameters
-
symbology the symbology for which to retrieve the settings. Must be one of the valid symbology enums and not Barcode.SYMBOLOGY_UNKNOWN.
- Returns
- the symbology-specific settings object.
- Since
- 4.7.0
Member Data Documentation
|
static |
Preset with all symbologies disabled.
|
static |
Preset to enable decoding of all retail symbologies.
By using this preset, the decoding of the following symbologies is enabled: Barcode.SYMBOLOGY_EAN13, Barcode.SYMBOLOGY_UPCA, Barcode.SYMBOLOGY_EAN8, Barcode.SYMBOLOGY_UPCE.
|
static |
Preset to enable decoding VIN codes.
This preset will enable scanning of the Barcode.SYMBOLOGY_CODE39 symbology.
|
static |
Preset to enable decoding SSCC18 codes.
This preset will enable scanning of Barcode.SYMBOLOGY_CODE128 symbology.
|
static |
Preset for decoding barcodes in a single frame.
|
static |
Restrict decoding to the specified area.
Decoding of codes is restricted to this area.
- Since
- 4.7.0
|
static |
The area indicates the most likely code position.
The area is a hint to the barcode scanner as to where codes can be found.
- Since
- 4.7.0
|
static |
The barcode scanner should ignore the most likely code position.
The area data is ignored.
- Since
- 5.5.0
The documentation for this class was generated from the following file:
- BarcodeScannerSettings.java