Deprecation warning
Please note that this is outdated documentation for an older release of the Scandit Barcode Scanner SDK.
We are deprecating the 5.x API on all platforms (except Linux). Release 5.19 in April 2021 will be our final. Applications running 5.x will continue to work, and we will continue to release critical bug fixes and security patches only, for one year. We encourage you to migrate to 6.x and take advantage of our latest / advanced features and improved performance.
You'll find the updated documentation at: Data Capture SDK Documentation for Android
Inherits NativeHandle.
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 |
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
BarcodeScannerSettings clone | ( | ) |
Creates and returns a deep copy of the barcode scanner settings object.
- Returns
- The cloned barcode scanner settings object.
- Since
- 4.7.0
JSONObject toJSON | ( | ) | throws JSONException |
- Returns
- The settings as a JSON object.
- Since
- 5.6.0
void setCodeDirectionHint | ( | int | hint | ) |
Set the code direction hint.
- Parameters
-
hint The new code direction hint.
- See also
- getCodeDirectionHint()
- Since
- 4.7.0
int getCodeDirectionHint | ( | ) |
Get the code direction hint.
The code direction hint tells the barcode scanner in what direction 1-dimensional codes are most likely oriented. This hint is only useful for 1d (barcodes), and ignored for 2d codes.
- Returns
- The current code direction hint. The default is BarcodeScanner.CODE_DIRECTION_LEFT_TO_RIGHT.
- Since
- 4.7.0
int getProperty | ( | String | property | ) |
Get custom properties.
Custom properties are used for features of the barcode scanner that are not yet part of the public API. As such they can disappear in one of the next releases or change meaning. Use with caution.
Only properties of previous calls to BarcodeScannerSettings.setProperty() are returned here. When a property is not set, a default value is assumed.
- Parameters
-
property the name of the property
- Returns
- The value of the property, or -1 if the property does not exist.
- Since
- 4.7.0
void setProperty | ( | String | property, |
int | value | ||
) |
Set custom properties.
- Parameters
-
property the name of the property value the value to be set
- See also
- getProperty()
- Since
- 4.7.0
void setCodeDuplicateFilter | ( | int | filter | ) |
Specifies the duplicate filter to use for the session.
- Parameters
-
filter the new code duplicate filter
- See also
- getCodeDuplicateFilter()
- Since
- 4.7.0
int getCodeDuplicateFilter | ( | ) |
Get the code duplicate filter of the scan session.
- See also
- setCodeDuplicateFilter()
Duplicate filtering affects the handling of codes with the same data and symbology. When the filter is set to -1, each unique code is only added once to the session, when set to 0, duplicate filtering is disabled. Otherwise the duplicate filter specifies an interval in milliseconds. When the same code (data/symbology) is scanned withing the specified interval is it filtered out as a duplicate.
- Returns
- The current code duplicate filter.
- Since
- 4.7.0
int getCodeCachingDuration | ( | ) |
Get the code caching duration of the scan session.
When set to -1, codes are kept until the next call to BarcodeScannerSession.clear(). When set to 0, codes are kept until the next frame processing call finishes. For all other values, code_caching_duration specifies a duration in milliseconds for how long the codes are kept.
The default value is -1
- Returns
- The code caching duration.
- Since
- 4.7.0
void setCodeCachingDuration | ( | int | duration | ) |
Determines how long codes are kept in the session.
- Parameters
-
duration the code caching duration
- See also
- getCodeCachingDuration()
- Since
- 4.7.0
void setMaxNumberOfCodesPerFrame | ( | int | max | ) |
Set the maximum number of barcode to be decoded every frame.
- Parameters
-
max the new maximum number of codes to be decoded every frame. max is ensured to be at least 1.
Setting the maximum number of codes per frame to a high number may have negative impact on performance. Use with caution.
- Since
- 4.7.0
int getMaxNumberOfCodesPerFrame | ( | ) |
Get the maximum number of barcode to be decoded every frame.
- Returns
- the maximum number of codes per frame
- Since
- 4.7.0
RectF getSearchArea | ( | ) |
Get the area of the image in which barcodes are searched.
By default, barcodes are searched in the whole image. By restricting the search area to smaller areas the barcode scanner performance can be optimized.
- Returns
- the barcode scan area in relative coordinates. The top-left corner of the image is (0,0), the bottom right corner is (1, 1).
- Since
- 4.7.0
void setSearchArea | ( | RectF | scanArea | ) |
Set the area of the image in which barcodes are searched.
- Parameters
-
scanArea The new search area in relative coordinates.
- See also
- getSearchArea()
- Since
- 4.7.0
RectF getCodeLocationArea1d | ( | ) |
Get 1d code location area.
- Returns
- the code location hint in relative coordinates
- Since
- 4.7.0
void setCodeLocationArea1d | ( | RectF | area | ) |
Set code location area for 1d codes.
- Parameters
-
area the code location hint in relative coordinates
- Since
- 4.7.0
RectF getCodeLocationArea2d | ( | ) |
Get 2d code location area.
- Returns
- the code location hint in relative coordinates
- Since
- 4.7.0
void setCodeLocationArea2d | ( | RectF | area | ) |
Set code location area for 2d codes.
- Parameters
-
area the code location hint in relative coordinates
- Since
- 4.7.0
void setFocusMode | ( | int | focusMode | ) |
Set the camera's focus type.
- Parameters
-
focusMode the focus type of the camera.
- Since
- 4.7.0
int getFocusMode | ( | ) |
Get the camera's focus type.
- Returns
- the current focus type of the camera
- Since
- 4.7.0
void setCodeLocationConstraint1d | ( | int | constraint | ) |
Set the 1d code location constraint.
- Parameters
-
constraint The code location constraint.
- Since
- 4.7.0
void setCodeLocationConstraint2d | ( | int | constraint | ) |
Set the 2d code location constraint.
- Parameters
-
constraint The code location constraint.
- Since
- 4.7.0
int getCodeLocationConstraint1d | ( | ) |
Get 1d code location constraint.
- Returns
- The code location constraint
- Since
- 4.7.0
int getCodeLocationConstraint2d | ( | ) |
Get 2d code location constraint.
- Returns
- the code location hint in relative coordinates
- 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 |
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