Deprecation warning
Please note that this is outdated documentation for an older release of the Scandit Barcode Scanner SDK.
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 Cordova
Classes | |
enum | Orientation |
enum | State |
Public Member Functions | |
void | show (function didScan, function didManualSearch=null, function didCancel=null) |
void | show (object callbacks) |
void | cancel () |
void | applyScanSettings (ScanSettings settings) |
void | setConstraints (Constraints portraitConstraints, Constraints, landscapeConstraints, number animationDuration) |
void | setMargins (Margins portraitMargins, Margins landscapeMargins, number animationDuration) |
void | pauseScanning () |
void | resumeScanning () |
void | stopScanning () |
void | startScanning () |
void | startScanning (boolean startInPausedState) |
void | switchTorchOn (boolean on) |
ScanOverlay | getOverlayView () |
Point | convertPointToPickerCoordinates (Point point) |
Public Attributes | |
boolean | continuousMode |
Orientation[] | orientations |
Detailed Description
The main class for scanning barcodes with the Scandit Barcode Scanner.
This class sets up the recognition process, the preview view, controls the camera and provides a callback interface when barcodes are recognized.
The picker class is a able to run in full-screen or as a subview in an existing activity.
- Since
- 4.11.0
Class Documentation
enum Scandit::BarcodePicker::Orientation |
Orientation of the device.
enum Scandit::BarcodePicker::State |
List of states the picker can be in.
Used as arguments for the didChangeState callback.
- Since
- 4.15
Member Function Documentation
void show | ( | function | didScan, |
function | didManualSearch = null , |
||
function | didCancel = null |
||
) |
Visibly shows the picker to the user.
This should be called after the picker has been fully configured. Once it is shown make sure to call startScanning() if you want to start the video feed and scan for barcodes.
- Parameters
-
didScan callback to be invoked whenever codes have been successfully scanned. The callback receives the scan session as the first and only argument which contains a list of recognized codes. didManualSearch callback to be invoked when the user enters a text in the search bar. The entered text is passed as the first argument to the callback. If you do not use the search bar, you may pass null. didCancel callback to be invoked upon failure, or when cancel is called on the picker. The callback is passed a reason for failure as the only argument.
void show | ( | object | callbacks | ) |
Visibly shows the picker to the user.
This should be called after the picker has been fully configured. Once it is shown make sure to call startScanning() if you want to start the video feed and scan for barcodes.
- Parameters
-
callbacks A dictionary containing one or more callbacks that are invoked when a certain events happens. Supported names for the callbacks are didScan, didChangeState, didCancel and didManualSearch. The behavior of didScan, didCancel, didManualSearch is as defined in the documentation for show(function,function,function). didChangeState is a callback that gets invoked whenever the picker changes state, e.g. when the picker changes from stopped to active, or from active to paused. The argument to the callback is the new state (see BarcodePicker.State for possible values).
void cancel | ( | ) |
Cancels the picker by stopping it and removing it from the screen.
If the picker is not in continuous mode this will happen automatically when a code is recognized.
void applyScanSettings | ( | ScanSettings | settings | ) |
Reconfigure the barcode picker with new settings.
The settings are applied asynchronously. Once they have been applied, all new frames will be processed with the new settings.
- Parameters
-
settings the settings to apply.
- Since
- 4.11.0
void setConstraints | ( | Constraints | portraitConstraints, |
Constraints | , | ||
landscapeConstraints | , | ||
number | animationDuration | ||
) |
Sets the view constraints of the barcode picker.
A call to this function causes the barcode picker to be added as a subview on top of the webview instead of as full screen in a new view controller or activity.
Margins, width and height may either be specified using device-independent pixels/points or in percent of the screen size. See Constraints for details.
- Parameters
-
portraitConstraints Constraints for when the device is in portrait or upside-down portrait orientation. Can be null to indicate no margins and full width and height. landscapeConstraints Constraints for when the device is in landscape left or right orientation. Can be null to indicate no margins and full width and height animationDuration The duration the layout change takes to animate. At 0 it will instantly change.
- Since
- 4.11.0
Sets the margins of the barcode picker.
A call to this function causes the barcode picker to be added as a subview on top of the webview instead of as full screen in a new view controller or activity.
Margins may either be specified using absolute, device-independent pixel units, or in percent of the screen size. See Margins(String,String,String,String) for details.
- Parameters
-
portraitMargins Margins for when the device is in portrait or upside-down portrait orientation. Can be null to indicate no margins. landscapeMargins Margins for when the device is in landscape left or right orientation. Can be null to indicate no margins. animationDuration The duration the margin change takes to animate. At 0 it will instantly change.
- Since
- 4.11.0
void pauseScanning | ( | ) |
Asynchronously pause the scanning process while keeping the camera preview running.
Use this method when you plan to briefly pause the scanning process and intend to resume it later. It is not recommended to use this method when you are interrupting the scanning process for longer periods of time as the camera preview will use considerable power. For such scenarios use stopScanning instead.
- Since
- 4.11.0
void resumeScanning | ( | ) |
Asynchronously resume a previously paused scanning process.
Use this method to resume scanning after ScanSession.pauseScanning or pauseScanning was called. Calling resume on a picker that was not previously started with with startScanning() is undefined.
- Since
- 4.11.0
void stopScanning | ( | ) |
Asynchronously stop the scanning process and camera preview.
- Since
- 4.11.0
void startScanning | ( | ) |
Asynchronously start the camera preview and scanning process.
- Since
- 4.11.0
void startScanning | ( | boolean | startInPausedState | ) |
Asynchronously start the camera preview and scanning process.
Allows to start the camera preview without immediately also starting the scanning process.
- Parameters
-
startInPausedState Whether the scanning process should be paused.
- Since
- 4.11.0
void switchTorchOn | ( | boolean | on | ) |
Switches the torch on or off.
- Parameters
-
on Whether the torch should be switched on.
- Since
- 4.11.0
ScanOverlay getOverlayView | ( | ) |
Returns the overlay view which contains the main UI.
- Since
- 4.11.0
Converts a point of an Barcode's location into this picker's coordinate system.
The conversion takes the current resolution of the camera feed into consideration which means that if the resolution should change, converting a previously retrieved point successfully is no longer possible. A change in resolution happens for example if ScanSettings.setHighDensityModeEnabled(boolean) is changed or the camera is switched from back to front or vice versa.
- Parameters
-
point The point to be converted.
- Returns
- The point in this picker's coordinate system. Can be null if an error occurs.
- Since
- 4.11.0
- See also
- Scandit.Barcode.location
Member Data Documentation
boolean continuousMode |
Allows to scan multiple codes without closing the scanner.
By default continuousMode is false and the scanner closes after scanning a code.
- Since
- 4.11.0
Orientation [] orientations |
The orientations to which the barcode picker is allowed to rotate to.
- Since
- 4.11.0