Scandit

Detailed description of how the Scandit plugin works and its configuration.

Overview

Scandit is mobile computer vision software enables barcode scanning.

Configuration

The following settings needs to be set:

Check SDK documentation for more information.

License key

Before starting with adding a capture mode, make sure that you have a valid Scandit Data Capture SDK license key and that you added the necessary dependencies. If you have not done that yet, check out this guide. The web license is required.

Scan settings

KeyTypeDefault valueInfo
codeDuplicateFilternumber0The duplicate filter specifying how often a code can be scanned. When the filter is set to -1, each unique code is only scanned once. 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 within the specified interval it is filtered out as a duplicate.
enabledSymbologiesarray[“ean13”, “upca”, “upce”, “code128”, “code39”, “data-matrix”, “qr”]The single symbology or list/set of symbologies that should be initialized as enabled for recognition.
maxNumberOfCodesPerFramenumber1The maximum number of barcodes to be recognized every frame.
searchAreaobject-The area of the image in which barcodes are searched.
colorInvertedEnabledbooleanfalseWhether color-inverted decoding for all symbologies is enabled.
  • modalSettings
NameKeyTypePossible valuesDefault value
Close after scancloseAfterScanboolean-false
Sizesizenumber-80
Positionpositionstringtop | bottomtop
Margin topmarginTopnumber-50
Margin bottommarginBottomnumber-50
Alignmentalignmentstringleft | center | rightcenter
Margin leftmarginLeftnumber-50
Margin rightmarginRightnumber-50
Play sound on scanplaySoundOnScanboolean-true
Vibrate on scanvibrateOnScanboolean-true

Inbound events

Send Messages from Custom views

sys.ui.sendPluginMessage({
  plugin: 'scandit',
  name: 'openScan',
  data: {
    field: 'firstName',
    scanSettings: {
      codeDuplicateFilter: 0,
      enabledSymbologies: ["ean13", "upca", "upce", "code128", "code39", "data-matrix", "qr"],
      maxNumberOfCodesPerFrame: 1,
      searchArea: {height: 1, width: 1, x: 0, y: 0}
    },
    modalSettings: {
      size: 50,
      marginTop: 30,
      position: 'top',
      alignment: 'right',
      marginRight: 30,
      closeAfterScan: true,
      playSoundOnScan: true,
      vibrateOnScan: true
    }
  },
  callbacks: {
    onScan: function(originalMessage, callbackData) {
      console.info(">> code: ", callbackData.code);
      console.info(">> callbackData: ", callbackData);
    },
    onFail: function(originalMessage, callbackData) {
      console.info(">>", callbackData);
    }
  }
});

Send UI messages

sys.ui.sendMessage({
  scope: 'plugin:scandit',
  name: 'openScan',
  data: {
    field: 'firstName',
    scanSettings: {
      codeDuplicateFilter: 0,
      enabledSymbologies: ["ean13", "upca", "upce", "code128", "code39", "data-matrix", "qr"],
      maxNumberOfCodesPerFrame: 1,
      searchArea: {height: 1, width: 1, x: 0, y: 0}
    },
    modalSettings: {
      size: 50,
      marginTop: 30,
      position: 'top',
      alignment: 'right',
      marginRight: 30,
      closeAfterScan: true,
      playSoundOnScan: true,
      vibrateOnScan: true
    }
  },
  callbacks: {
    onScan: function(originalMessage, callbackData) {
      sys.logs.info(">> code: ", callbackData.code);
      sys.logs.info(">> callbackData: ", callbackData);
    },
    onFail: function(originalMessage, callbackData) {
      sys.logs.info(">>", callbackData);
    }
  }
});

This script opens the modal scan.

In data you can override dynamically settings defined at creation time of the plugin.

The following callbacks can be defined:

  • callback: A function that is called scan successfully.

Outbound events

Outbound events send context as ui if it’s called from UI messages otherwise is plugin.

  • onScanSuccess: Event when scan success.

  • onScanFail: Event when scan fails.