Table of contents
Swift
Objective-C

BarcodeScannerConfig

BarcodeScannerConfig is the class that defines the configurations for barcode scanning. Once the BarcodeScannerConfig object is made, it is set via the BarcodeScannerActivity.ResultContract.

Definition

Assembly: DynamsoftBarcodeReaderBundle.aar

Namespace: com.dynamsoft.dbrbundle.ui

final class BarcodeScannerConfig

Methods

Method Description
setLicense Sets the license key for the Barcode Reader.
setScanningMode Sets the scanning mode.
setTemplateFile Sets the template with a file path or a JSON string.
setBarcodeFormats Sets the barcode format(s) to read.
setScanRegion Sets a scan region where only the barcodes located in the scan region can be decoded.
setTorchButtonVisible Sets whether to display the torch button when scanning or not.
setBeepEnabled Sets whether to trigger a beep sound when a barcode is detected.
setScanLaserVisible Sets whether to display a scan laser when scanning.
setAutoZoomEnabled Sets whether to enable the auto-zoom feature when scanning.
setCloseButtonVisible Sets whether to display a button that can close the scanner page.
setMaxConsecutiveStableFramesToExit Sets how long the library will keep scanning when there is no more barcodes to decode.
setExpectedBarcodesCount Sets the expected number of barcodes. The multiple barcodes scanning will be stopped when the expectedBarcodesCount is reached.
setCameraToggleButtonVisible Sets whether to display the camera toggle button.
getLicense Returns the license key string.
getScanningMode Returns the scanning mode.
getTemplateFile Returns the template with a file path or a JSON string.
isTorchButtonVisible Returns whether the button is visible.
getBarcodeFormats Returns the barcode format(s) that the library will accept.
getScanRegion Returns the scan region.
isBeepEnabled Returns whether the beep sound is enabled.
isScanLaserVisible Returns whether the scan laser is visible.
isAutoZoomEnabled Returns whether the auto-zoom feature is enabled.
isCloseButtonVisible Returns whether the close button is visible.
getMaxConsecutiveStableFramesToExit Returns the maximum number of consecutive stable frames to exit.
getExpectedBarcodesCount Returns the expected number of barcodes.
isCameraToggleButtonVisible Returns whether the camera toggle button is visible.

The following methods are deprecated:

Method Description
setTemplateFilePath Use setTemplateFile instead. Sets the parameters template for the Barcode Reader via a local JSON file path.
getTemplateFilePath Use getTemplateFile instead. Returns the file path of the template file if one is being used.

setLicense

Sets the license key for the Barcode Reader.

void setLicense(String license);

Parameter(s)

license: The license key to be used for initialization.

setScanningMode

Sets the scanning mode.

void setScanningMode(EnumScanningMode scanningMode);

Parameter(s)

scanningMode: The scanning mode to be set, of type EnumScanningMode.

setTemplateFile

Sets the template with a file path or a JSON string.

void setTemplateFile(String templateFile);

Parameter(s)

templateFile: The file path or a JSON string.

setBarcodeFormats

Sets the barcode format(s) to read.

void setBarcodeFormats(long format);

Parameter(s)

format: A combined value of EnumBarcodeFormat to specify which barcode format(s) the library should target.

setScanRegion

Sets a scan region. Only the barcodes located in the scan region can be decoded.

void setScanRegion(DSRect scanRegion);

Parameter(s)

scanRegion: A DSRect object that specifies the scan region.

setTorchButtonVisible

Sets whether to display the torch button when scanning. User can click the torch button to turn on/off the torch.

void setTorchButtonVisible(boolean torchButtonVisible);

Parameter(s)

torchButtonVisible: A boolean value that determines whether to display the torch button.

setBeepEnabled

Sets whether to trigger a beep sound when a barcode is detected.

void setBeepEnabled(boolean beepEnabled);

Parameter(s)

beepEnabled: A boolean value that determines whether to enable the beep sound.

setScanLaserVisible

Sets whether to display a scan laser when scanning.

void setScanLaserVisible(boolean scanLaserVisible);

Parameter(s)

scanLaserVisible: A boolean value that determines whether to display the scan laser.

setAutoZoomEnabled

Sets whether to enable the auto-zoom feature when scanning.

void setAutoZoomEnabled(boolean autoZoomEnabled);

Parameter(s)

autoZoomEnabled: A boolean value that determines whether to enable the auto-zoom feature.

setCloseButtonVisible

Sets whether to display a button that can close the scanner page.

void setCloseButtonVisible(boolean closeButtonVisible);

Parameter(s)

closeButtonVisible: A boolean value that determines whether to display the close button.

setMaxConsecutiveStableFramesToExit

Sets how long the library will keep scanning when there is no more barcodes to decode. The Default value is 10, which means the library will keep scanning for 10 consecutive stable frames.

void setMaxConsecutiveStableFramesToExit(int maxConsecutiveStableFramesToExit);

Parameter(s)

maxConsecutiveStableFramesToExit: The maximum number of consecutive stable frames to exit.

setExpectedBarcodesCount

Sets the expected number of barcodes. The multiple barcodes scanning will be stopped when the expectedBarcodesCount is reached.

void setExpectedBarcodesCount(int expectedBarcodesCount);

Parameter(s)

expectedBarcodesCount: The expected number of barcodes.

setCameraToggleButtonVisible

Sets whether to display the camera toggle button.

void setCameraToggleButtonVisible(boolean cameraToggleButtonVisible);

Parameter(s)

cameraToggleButtonVisible: A boolean value that determines whether to display the camera toggle button.

getLicense

Returns the license key string.

String getLicense();

Return Value

The license key to be used for initialization.

getScanningMode

Returns the scanning mode.

EnumScanningMode getScanningMode();

Return Value

The scanning mode.

getTemplateFile

Returns the template with a file path or a JSON string.

String getTemplateFile();

Return Value

A file path or a JSON string.

getBarcodeFormats

Returns the barcode format settings.

long getBarcodeFormats();

Return Value

A combined value of EnumBarcodeFormat to specify which barcode format(s) the library should target.

getScanRegion

Returns the scan region.

DSRect getScanRegion();

Return Value

A DSRect object that specifies the scan region.

isTorchButtonVisible

Returns a boolean indicating whether or not the torch button is visible.

boolean isTorchButtonVisible();

Return Value

A boolean value that determines whether the torch button is displayed.

isBeepEnabled

Returns a boolean indicating whether or not the beep sound is enabled.

boolean isBeepEnabled();

Return Value

A boolean value that determines whether the beep sound is enabled.

isScanLaserVisible

Returns a boolean indicating whether or not the scan laser is visible.

boolean isScanLaserVisible();

Return Value

A boolean value that determines whether the scan laser is displayed.

isAutoZoomEnabled

Returns a boolean indicating whether or not the auto-zoom feature is enabled.

boolean isAutoZoomEnabled();

Return Value

A boolean value that determines whether the auto-zoom feature is enabled.

isCloseButtonVisible

Returns a boolean indicating whether or not the close button is visible.

boolean isCloseButtonVisible();

Return Value

A boolean value that determines whether the close button is displayed.

getMaxConsecutiveStableFramesToExit

Returns the maximum number of consecutive stable frames to exit.

int getMaxConsecutiveStableFramesToExit();

Return Value

The maximum number of consecutive stable frames to exit.

getExpectedBarcodesCount

Returns the expected number of barcodes.

int getExpectedBarcodesCount();

Return Value

The expected number of barcodes.

isCameraToggleButtonVisible

Returns a boolean indicating whether or not the camera toggle button is visible.

boolean isCameraToggleButtonVisible();

Return Value

A boolean value that determines whether the camera toggle button is displayed.

setTemplateFilePath

Note: Method setTemplateFilePath is deprecated. Please use setTemplateFile instead.

Sets the local JSON file path that will configure the parameters template for the Barcode Reader.

void setTemplateFilePath(String templateFilePath);

Parameter(s)

templateFilePath: The path of the JSON template file.

getTemplateFilePath

Note: Method getTemplateFilePath is deprecated. Please use getTemplateFile instead.

Get the file path of the template file.

String getTemplateFilePath();

Return Value

The path of the JSON template file.

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article: