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

Barcode Scanner Settings JSON format

This document describes the JSON format understood by the sc_barcode_scanner_settings_new_from_json() function.

Format Overview

The top-level must always be a dictionary (object) containing one or more key-value pairs. In the simplest form, an empty dictionary can be passed to the function. This will return a default barcode scanner settings instance with all symbologies disabled. All other properties have their default value. In general, missing properties are left at their default value, so only the properties that need to be changed away from their default need to be specified. Key-value pairs not understood the by JSON parser are ignored as if they were not specified.

Symbology Settings

By default, all symbologies are disabled. To enable a symbology, it must be listed under the "symbologies" key. Symbologies can either be a dictionary, or an array of symbology names:

{
"symbologies" : [ "ean13", "upca", "code128" ]
}

When using a dictionary, further symbology options can be specified, such as extensions to enable, used checksums etc.:

{
"symbologies" : {
"ean13" : true,
"upca" : {
"extensions" : ["remove_leading_zero"]
},
"itf" : {
"checksums" : [ "mod10" ]
}
}
}

The following options are currently supported:

  • enabled: boolean indicating whether the symbology should be enabled. When using the dictionary form, enabled is automatically set to true.
  • colorInvertedEnabled: boolean indicating whether color-inverted codes of that symbology should be decoded. Default is false.
  • activeSymbolCounts: array of integers specifying the active symbol counts for the symbology. See sc_symbology_settings_set_active_symbol_counts for details.
  • extensions: Extensions to be enabled for the symbology.
  • checksums: List of optional checksums to use for the symbology.

Depending on the symbology, some of these properties are ignored. See Symbology Properties for details.

The following table shows the symbology names understood by the JSON parser. Some of the symbologies support multiple alternative spellings.

Symbology JSON Names (case is ignored)
EAN13 ean13, ean-13
UPCA upca, upc-a, upc12
EAN8 ean8, ean-8
UPCE upce, upc-e
Two-Digit-Add-On ean2, two-digit-add-on, ean-upc2, upc2
Five-Digit-Add-On ean5, five-digit-add-on, ean-upc5, upc5
MSI-Plessey msi, msi-plessey
DataBar 14 databar, databar14, databar-14
DataBar Expanded databar-expanded
DataBar Limited databar-limited
Codabar codabar
Code 11 code11, code-11
Code 93 code93, code-93
Code 39 code39, code-39
Code 128 code128, gs1-code128, code-128
Interleaved 2 of 5 itf, interleaved-two-of-five, interleaved-2-of-5
DataMatrix dm, datamatrix, data_matrix, data-matrix
Aztec aztec
PDF417 pdf417
MicroPDF417 micropdf417
MaxiCode maxicode, maxi-code
QR qr
KIX kix
RM4SCC rm4scc
DotCode dotcode
Micro QR microqr

Code Location and Search Area

To customize the search area and code location hints, you can use the codeLocation1d, codeLocation2d, searchArea and codeDirectionHint properties.

  • To customize the search area, set the searchArea property by defining the rectangle with x, y, width, and height. Example:
    {
    "searchArea" : {
    "x" : 0.0, "y" : 0.0, "width" : 1.0, "height" : 0.5
    }
    }
  • To customize code location 1d and code location 2d, use the codeLocation1d and codeLocation2d properties. They consist of a rectangle, the area, and a constraint. Example:
    {
    "codeLocation1d" : {
    "area" : {"x" : 0.0, "y" : 0.0, "width" : 1.0, "height" : 0.5 },
    "constraint" : "restrict" // or "hint"
    }
    }
    Constraint must either be "restrict", or "hint".
  • To customize the code direction hint, use the codeDirectionHint property. Example:
    {
    "codeDirectionHint" : "left-to-right"
    }
    The code direction hint must either be "left-to-right", "right-to-left", "bottom-to-top", "top-to-bottom", "none", "vertical", or "horizontal"

Other Properties