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 Xamarin.Android and Data Capture SDK Documentation for Xamarin.iOS

Public Member Functions

void SetActiveScanningArea (int orientation, RectF rect)
 
RectF GetActiveScanningArea (int orientation)
 
JSONObject ToJSON () throws JSONException
 
SymbologySettings GetSymbologySettings (int symbology)
 
int GetProperty (String key)
 
void SetProperty (String key, Object value)
 
void SetSymbologyEnabled (int symbology, bool enabled)
 
bool IsSymbologyEnabled (int symbology)
 
int CameraFacingPreference ()
 
void SetScanningHotSpot (float x, float y)
 

Static Public Member Functions

static ScanSettings Create ()
 

Public Attributes

bool MicroDataMatrixEnabled
 
bool Force2dRecognitionEnabled
 
bool HighDensityModeEnabled
 
bool RestrictedAreaScanningEnabled
 
float ScanningHotSpotHeight
 
String DeviceName
 
int CameraFacingPreference
 
readonly PointF ScanningHotSpot
 
float RelativeZoom
 
int MaxNumberOfCodesPerFrame
 
Working Range/Focus Control
int WorkingRange
 
Scan Session Configuration
int CodeCachingDuration
 
int CodeDuplicateFilter
 

Static Public Attributes

Recognition Mode
static final int RecognitionModeText
 
static final int RecognitionModeCode
 
Focus Working Range
static final int WorkingRangeStandard
 
static final int WorkingRangeLong
 
Camera Facing Direction
static final int CameraFacingBack
 
static final int CameraFacingFront
 
Display Orientation
static final int OrientationLandscape
 
static final int OrientationPortrait
 

Properties

bool CodeRejectionEnabled [get, set]
 
TextRecognitionSettings TextRecognitionSettings [get, set]
 
int RecognitionMode [get, set]
 
bool MatrixScanEnabled [get, set]
 

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 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 camera preview for barcodes. Use this method to define the area in which barcodes are to be searched. Rectangle coordinates run from 0 to 1.

Calling this method will automatically enable restricted active area scanning (RestrictedAreaScanningEnabled).

Since
4.9.0
Parameters
orientationthe device orientation for which to set the scan area. Must be either OrientationLandscape for landscape orientations (landscape-right and landscape-left), or OrientationPortrait for portrait orientations.

Calling this method with other orientation parameters is a no-op.

Parameters
rectthe new active scan area. The coordinates (top, left, 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
orientationthe device orientation. Must either be OrientationLandscape, or OrientationPortrait
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
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 ScanSettings Create ( )
static
Returns
the default scan settings
SymbologySettings GetSymbologySettings ( int  symbology)

Retrieve symbology specific-settings.

Parameters
symbologythe 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 propery value.

Parameters
keythe 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
keyThe property's name.
valueThe property's value.
void SetSymbologyEnabled ( int  symbology,
bool  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.

Parameters
symbologyThe symbology to be enabled.
enabledtrue when decoding of the symbology should be enabled, false if not.
Since
4.9.0
bool IsSymbologyEnabled ( int  symbology)

Determine whether decoding of a particular symbology is enabled or not.

Parameters
symbologyThe symbology
Returns
true when decoding of the symbology is enabled, false if not.
int CameraFacingPreference ( )

CameraFacingPreference

Returns
CameraFacingBack when the back-facing camera should be preferred, CameraFacingFront when the front-facing camera should be preferred.
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 RestrictedAreaScanningEnabled):

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
xThe hotspot's relative x coordinate.
yThe hotspot's relative y coordinate.

Member Data Documentation

final int RecognitionModeText
static

Text recognition.

final int RecognitionModeCode
static

Barcode/2d code recognition.

final int WorkingRangeStandard
static

Standard working range.

final int WorkingRangeLong
static

Long-distance working range.

final int CameraFacingBack
static

Default camera orientation - facing away from user.

final int CameraFacingFront
static

Camera facing towards user.

final int OrientationLandscape
static

Orientation is either landscape or landscapeReverse.

final int OrientationPortrait
static

Orientation is either portrait or portraitUpsideDown.

bool MicroDataMatrixEnabled

Whether the detection/decoding of tiny Data Matrix codes is enabled.

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.

int WorkingRange

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 WorkingRangeStandard (the default), the focus is optimized for barcodes close to the camera. When set to WorkingRangeLong, 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.

int CodeCachingDuration

The duration (in milliseconds) for which barcodes are kept in the session.

By default, codes are kept for the duration of the session.

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 CodeDuplicateFilter

Set the code duplicate filter to the given duration 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
CodeCachingDuration
bool Force2dRecognitionEnabled

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.

See also
MicroDataMatrixEnabled
bool HighDensityModeEnabled

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.

bool RestrictedAreaScanningEnabled

Reduces the area in which barcodes are detected and decoded.

When activated, the active scanning area is defined by ScanningHotSpotHeight, SetScanningHotSpot(float, float) and SetActiveScanningArea(int, RectF)

float ScanningHotSpotHeight

Changes the height of the area where barcodes are decoded in the camera preview when restrictActiveScanningArea is activated.

The height of the active scanning area is relative to the height of the camera preview 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
RestrictedAreaScanningEnabled
SetScanningHotSpot(float, float)
String DeviceName

A 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.

int CameraFacingPreference

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.

Since
4.9.0
readonly PointF ScanningHotSpot

SetScanningHotSpot

Returns
the scanning hot spot
float RelativeZoom

Sets the zoom to the given percentage of the max zoom possible (between 0 and 1).

int MaxNumberOfCodesPerFrame

The maximum number of codes to be decoded every frame.

If set to values smaller than 1, a minimum of 1 code per frame is enforced.

Property Documentation

bool CodeRejectionEnabled
getset

Whether code rejection is enabled.

Code rejection allows you to implement custom validation logic for codes in the DidScan event. By default, code rejection is disabled.

Since
4.15

Text recognition settings.

Note that text recognition is not available in the default builds.

Since
5.2
int RecognitionMode
getset

The recognition mode to use for the barcode picker.

Use this to switch between text and barcode recognition. By default, barcode recognition is on (RecognitionModeCode).

Since
5.2
bool MatrixScanEnabled
getset

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
enabledWhether MatrixScan should be enabled.
Since
5.2.0