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
Static Public Member Functions | |
static ScanSettings | create () |
Static Public Attributes | |
Recognition Mode | |
static final int | RECOGNITION_MODE_TEXT |
static final int | RECOGNITION_MODE_CODE |
static final int | RECOGNITION_MODE_CODE_AND_TEXT |
Focus Working Range | |
static final int | WORKING_RANGE_STANDARD |
static final int | WORKING_RANGE_LONG |
Camera Facing Direction | |
static final int | CAMERA_FACING_BACK |
static final int | CAMERA_FACING_FRONT |
Display Orientation | |
static final int | ORIENTATION_LANDSCAPE |
static final int | ORIENTATION_PORTRAIT |
Detailed Description
Holds settings that affect the recognition of barcodes, such as enabled barcode symbologies, scanning hot spot etc.
- Since
- 4.9.0
Member Function Documentation
void setMicroDataMatrixEnabled | ( | boolean | enabled | ) |
Enable the detection/decoding of tiny Data Matrix codes.
When this mode is enabled, a dedicated localization algorithm is activated that searches for small Datamatrix codes in the central part of the camera image. This algorithm requires additional resources and slows down the recognition of other barcode symbologies. We recommend using the method only when your application requires the decoding of tiny Datamatrix codes.
By default this mode is disabled.
- Parameters
-
enabled Whether this mode should be enabled.
This feature has been deprecated in 5.2 and no longer has any effect.
boolean isMicroDataMatrixEnabled | ( | ) |
- Returns
- whether micro data matrix mode is enabled
This feature has been deprecated in 5.2 and no longer has any effect.
void setWorkingRange | ( | int | range | ) |
Sets the focus working range for the barcode picker.
The working range tells the engine at which distance barcodes are to be expected. When set to WORKING_RANGE_STANDARD (the default), the focus is optimized for barcodes close to the camera. When set to WORKING_RANGE_LONG, the focus is optimized for far-away codes.
When using non-standard working range, it is better to directly pass the working range when constructing the barcode picker, because the camera can already start to adjust the focus at an earlier point in time.
The working range hint is ignored on cameras with fixed-focus.
- Parameters
-
range the working range
int getWorkingRange | ( | ) |
- Returns
- the preferred working range
void setCodeCachingDuration | ( | int | duration | ) |
Sets the duration (in milliseconds) for which barcodes are kept in the session.
By default, codes are kept for the duration of the session.
- Parameters
-
duration When set to values larger than zero, the value is interpreted as milliseconds for which the barcodes should be kept in the session. If set to zero, barcodes are discarded before processing the next frame. Passing -1 will keep the codes for the duration of the scan session.
The default value is -1
int getCodeCachingDuration | ( | ) |
- Returns
- the code caching duration in milliseconds
void setCodeDuplicateFilter | ( | int | duration | ) |
Set the code duplicate filter to the given duration in milliseconds.
- Parameters
-
duration The duration of the duplicate filter in milliseconds. When set to values larger than zero, barcodes with the same symbology and data are filtered out if they are decoded less than duration
milliseconds apart. Set this value to zero, if you do not want to filter duplicates. When set to -1, barcodes are filtered as duplicates if they match an already decoded barcode in the session.
By default, the duplicate filter is set to 500ms
- See also
- setCodeCachingDuration(int)
int getCodeDuplicateFilter | ( | ) |
- Returns
- the code duplicate filter in milliseconds
boolean isForce2dRecognitionEnabled | ( | ) |
- Returns
- true when 2d recognition is forced, false if not
void setForce2dRecognitionEnabled | ( | boolean | enable | ) |
Forces the barcode scanner to always run the 2D decoders (QR, Datamatrix, etc.), even when the 2D detector did not detect the presence of a 2D code.
This slows down the overall scanning speed, but can be useful when your application only tries to read 2D codes. Force 2d recognition is set to on when micro data matrix mode is enabled.
By default, forced 2d recognition is disabled.
- Parameters
-
enable
- See also
- setMicroDataMatrixEnabled(boolean)
void setHighDensityModeEnabled | ( | boolean | enable | ) |
Turn on/off high density mode.
High density mode enables phones to work at higher camera resolution, provided they support it. When enabled, phones that are able to run the video preview at 1080p (1920x1080) will use 1080p and not just 720p (1280x720). High density mode gives better decode ranges at the expense of processing speed and allows to decode smaller code in the near range, or codes that further away.
By default, high density mode is disabled.
- Parameters
-
enable whether high density mode should be enabled
boolean isHighDensityModeEnabled | ( | ) |
- Returns
- true when high density mode is enabled, false if not
void setRestrictedAreaScanningEnabled | ( | boolean | enable | ) |
Reduces the area in which barcodes are detected and decoded.
When activated, the active scanning area is defined by setScanningHotSpotHeight(float), setScanningHotSpot(float, float) and setActiveScanningArea(int, RectF)
- Parameters
-
enable when true enables active area scanning, when false, disables active area scanning.
boolean isRestrictedAreaScanningEnabled | ( | ) |
setRestrictedAreaScanningEnabled
- Returns
- whether restricted active area scanning is enabled
void setScanningHotSpotHeight | ( | float | height | ) |
Changes the height of the area where barcodes are decoded in the camera image when restrictActiveScanningArea is activated.
The height of the active scanning area is relative to the height of the screen and has to be between 0.0 and 0.5.
This only applies if the active scanning area is restricted.
The default is 0.25
As of Scandit BarcodeScanner SDK 4.4, the use of this method is discouraged. Use setActiveScanningArea instead.
- See also
- setRestrictedAreaScanningEnabled(boolean)
- setScanningHotSpot(float, float)
- Parameters
-
height The relative height of the active scanning area.
float getScanningHotSpotHeight | ( | ) |
- Returns
- the relative height of the active area.
void setActiveScanningArea | ( | int | orientation, |
RectF | rect | ||
) |
Sets the active scan area for either portrait or landscape mode scanning.
By default, the barcode recognition engine searches the whole image for barcodes. Use this method to define the area in which barcodes are to be searched. Rectangle coordinates run from 0 to 1. The coordinates are relative to the camera preview's width and height.
Calling this method will automatically enable restricted active area scanning (setRestrictedAreaScanningEnabled(boolean)).
- Since
- 4.9.0
- Parameters
-
orientation the device orientation for which to set the scan area. Must be either ScanSettings.ORIENTATION_LANDSCAPE for landscape orientations (landscape-right and landscape-left), or ScanSettings.ORIENTATION_PORTRAIT for portrait orientations.
Calling this method with other orientation parameters is a no-op.
- Parameters
-
rect the new active scan area. The coordinates (left, top, right, bottom) are defined as seen by the user.
Invoking this method with invalid rectangles, e.g. rectangles whose top, left, right, or bottom attributes are outside the allowed range of 0.0-1.0, or rectangles with negative width/height will have no effect.
RectF getActiveScanningArea | ( | int | orientation | ) |
Returns the scan area that is going to be used for the given orientation.
- Since
- 4.9.0
- Parameters
-
orientation the device orientation. Must either be ScanSettings.ORIENTATION_LANDSCAPE, or ScanSettings.ORIENTATION_PORTRAIT
- Returns
- The rectangle, or null when orientation is not one of the allowed values. When restricted area scanning is disabled a full-screen area (top=0, left=0, right=1, bottom=1) is returned, otherwise the area from either specifying the scanning hotspot/height or calls to setActiveScanningArea is returned.
- See also
- setActiveScanningArea
void setDeviceName | ( | String | deviceName | ) |
Sets the device name to identify the current device when looking at analytics tools.
Sends a request to the server to set this as soon as a connection is available.
- Parameters
-
deviceName A device name.
String getDeviceName | ( | ) |
Returns the device name identifying the current device.
- Returns
- The device name.
JSONObject toJSON | ( | ) | throws JSONException |
- Returns
- the settings as a json dictionary
There is no guarantee that the JSON dictionary is stable, keys might disappear, be added or renamed without notice.
- Since
- 4.9.0
|
static |
- Returns
- the default scan settings
SymbologySettings getSymbologySettings | ( | int | symbology | ) |
Retrieve symbology specific-settings.
- Parameters
-
symbology the symbology settings to retrieve
- Returns
- the symbology settings object, or null, if symbology is an invalid symbology.
- Since
- 4.9.0
int getProperty | ( | String | key | ) |
Get custom property value.
- Parameters
-
key the name of the property
- Returns
- the value of the property. For properties have not previously been set on the settings object -1 is returned.
void setProperty | ( | String | key, |
Object | value | ||
) |
Sets a property.
This function is for internal use only and any functionality that can be accessed through it can and will vanish without public notice from one version to the next. Do not call this function unless you specifically have to.
- Parameters
-
key The property's name. value The property's value.
void setSymbologyEnabled | ( | int | symbology, |
boolean | enabled | ||
) |
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.
Some 1d barcode symbologies allow you to encode variable-length data. By default, the Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your application requires scanning of one of these symbologies, and the length is falling outside the default range, you may need to adjust the "active symbol counts" for the symbology in addition to enabling it. For details on defaults and how to calculate the symbol counts for each symbology, take a look at the barcode length page.
- Parameters
-
symbology The symbology to be enabled. enabled true when decoding of the symbology should be enabled, false if not.
- Since
- 4.9.0
boolean isSymbologyEnabled | ( | int | symbology | ) |
Determine whether decoding of a particular symbology is enabled or not.
- Parameters
-
symbology The symbology
- Returns
- true when decoding of the symbology is enabled, false if not.
int getCameraFacingPreference | ( | ) |
- Returns
- ScanSettings.CAMERA_FACING_BACK when the back-facing camera should be preferred, ScanSettings.CAMERA_FACING_FRONT when the front-facing camera should be preferred.
void setCameraFacingPreference | ( | int | preference | ) |
Set the preferred camera direction.
The picker first gives preference to cameras of the given direction. When the device has no such camera, cameras of the opposite face are tried as well.
By default, the back-facing camera is preferred.
- Parameters
-
preference ScanSettings.CAMERA_FACING_BACK when the back-facing camera should be preferred, ScanSettings.CAMERA_FACING_FRONT when the front-facing camera should be preferred.
- Since
- 4.9.0
void setScanningHotSpot | ( | float | x, |
float | y | ||
) |
Sets the location in the image where barcodes are decoded with the highest priority.
This method shows a slightly different behavior depending on whether the full screen scanning is active or not. In Full screen scanning mode:
Sets the location in the image which is decoded with the highest priority when multiple barcodes are present in the image.
In restrictActiveScanningArea mode (activated with setRestrictedAreaScanningEnabled(boolean)):
Changes the location of the spot where the barcode decoder actively scans for barcodes.
X and Y can be between 0 and 1, where 0/0 corresponds to the top left corner and 1/1 to the bottom right corner.
The default hotspot is centered on the image (0.5,0.5)
- Parameters
-
x The hotspot's relative x coordinate. y The hotspot's relative y coordinate.
PointF getScanningHotSpot | ( | ) |
- Returns
- the scanning hot spot
void setRelativeZoom | ( | float | zoomPercentage | ) |
Sets the zoom to the given percentage of the max zoom possible.
- Parameters
-
zoomPercentage The percentage of the max zoom (between 0 and 1).
float getRelativeZoom | ( | ) |
- Returns
- the relative zoom
void setMaxNumberOfCodesPerFrame | ( | int | maxNumberOfCodesPerFrame | ) |
set maximum number of codes to be decoded every frame.
- Parameters
-
maxNumberOfCodesPerFrame the new maximum number of codes.
Setting the maximum number of codes per frame to a high number may have negative impact on performance. Use with caution.
int getMaxNumberOfCodesPerFrame | ( | ) |
Get the current maximum number of codes per frame.
- Returns
- the maximum number of codes per frame. The default is 1.
boolean isCodeRejectionEnabled | ( | ) |
Whether code rejection is enabled.
Code rejection allows you to implement custom validation logic for codes in the didScan callback. By default, code rejection is disabled.
- Returns
- True if code rejection is enabled, false if not.
- Since
- 4.15
void setCodeRejectionEnabled | ( | boolean | enabled | ) |
Set code rejection enabled/disabled.
- Parameters
-
enabled Whether to enable code rejection
- See also
- isCodeRejectionEnabled()
- Since
- 4.15
ScanAreaSettings getAreaSettingsPortrait | ( | ) |
Obtain the area settings when scanning in portrait orientation.
- Returns
- The area settings. By default, this getter returns null and the scan areas are controlled by the scanning hotspot, as well as the portrait active scanning area. When this property is set, they override the scanning hot spot, and active scanning area properties.
- Since
- 5.0
ScanAreaSettings getAreaSettingsLandscape | ( | ) |
Obtain the area settings when scanning in landscape orientation.
- Returns
- The area settings. By default, this getter returns null and the scan areas are controlled by the scanning hotspot, as well as the landscape active scanning area. When this property is set, they override the scanning hot spot, and active scanning area properties.
- Since
- 5.0
void setAreaSettingsLandscape | ( | ScanAreaSettings | settings | ) |
void setAreaSettingsPortrait | ( | ScanAreaSettings | settings | ) |
TextRecognitionSettings getTextRecognitionSettings | ( | ) |
Get the text recognition settings.
- Returns
- The text recognition settings. Note that text recognition is not available in the default builds.
void setTextRecognitionSettings | ( | TextRecognitionSettings | settings | ) |
- Parameters
-
settings The new settings
int getRecognitionMode | ( | ) |
Get the recognition mode.
- Returns
- The recognition mode used for the barcode picker.
- Since
- 5.2.0
void setRecognitionMode | ( | int | recognitionMode | ) |
Sets the recognition mode to use for the barcode picker.
Use this function to programmatically switch between text and barcode recognition. By default, barcode recognition is on (RECOGNITION_MODE_CODE).
- Parameters
-
recognitionMode A recognition mode.
- Since
- 5.2.0
void setMatrixScanEnabled | ( | boolean | enabled | ) |
Whether MatrixScan should be enabled.
MatrixScan allows you to know the location of all localized codes. In order to get MatrixScan, it is recommended to implement the ProcessFrameDelegate interface and to use ScanSession::getTrackedCodes(). To use the default MatrixScan UI, it is necessary to set ScanOverlay::setGuiStyle(int) to ScanOverlay::GUI_STYLE_MATRIX_SCAN. When implementing a custom MatrixScan UI, it is recommended to set ScanOverlay::setGuiStyle(int) to ScanOverlay::GUI_STYLE_NONE.
- Parameters
-
enabled Whether MatrixScan should be enabled.
- Since
- 5.2.0
boolean isMatrixScanEnabled | ( | ) |
- Returns
- Whether code MatrixScan is enabled.
- Since
- 5.2.0
Member Data Documentation
|
static |
Text recognition.
|
static |
Barcode/2d code recognition.
|
static |
Recognized both text and barcodes/2d codes at the same time.
|
static |
Standard working range.
|
static |
Long-distance working range.
|
static |
Default camera orientation - facing away from user.
|
static |
Camera facing towards user.
|
static |
Orientation is either landscape or landscapeReverse.
|
static |
Orientation is either portrait or portraitUpsideDown.
The documentation for this class was generated from the following file:
- ScanSettings.java