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

BarcodePicker Interface Reference

Public Member Functions

IntPtr Constructor (ScanSettings settings)
 
void AddPropertyObserver (PropertyObserver observer)
 
void RemovePropertyObserver (PropertyObserver observer)
 
Parser ParserForFormat (ParserDataFormat dataFormat, out NSError error)
 
Barcode Decoder Configuration
void ApplyScanSettings (ScanSettings settings, [NullAllowed] CompletionHandler completionHandler)
 
Barcode Recognition Operation
bool IsScanning ()
 
void StartScanning (bool paused, [NullAllowed] CompletionHandler completionHandler)
 
void StartScanning ()
 
void StartScanning (bool paused)
 
void StopScanning ([NullAllowed] CompletionHandler completionHandler)
 
void StopScanning ()
 
void ResumeScanning ()
 
void ResumeScanning ([NullAllowed] CompletionHandler completionHandler)
 
void PauseScanning ()
 
void PauseScanning ([NullAllowed] CompletionHandler completionHandler)
 
Utility
CGPoint ConvertPoint (CGPoint point)
 
Camera Selection
bool SupportsCameraFacing (CameraFacingDirection facing)
 
bool ChangeToCameraFacing (CameraFacingDirection facing)
 
bool SwitchCameraFacing ()
 
Torch Control
void SwitchTorchOn (bool on)
 
Zoom control
bool SetRelativeZoom (float zoom)
 

Properties

UIInterfaceOrientationMask allowedInterfaceOrientations [get, set]
 
NSObject WeakProcessFrameDelegate [get, set]
 
NSObject WeakScanDelegate [get, set]
 
NSObject WeakTextRecognitionDelegate [get, set]
 
ScanOverlay OverlayView [get, set]
 
CameraFacingDirection CameraFacingDirection [get]
 
AVCaptureVideoOrientation CameraPreviewOrientation [get, set]
 
bool AutoFocusOnTapEnabled [get, set]
 
bool PinchToZoomEnabled [get, set]
 

Detailed Description

Controls the camera and orchestrates the barcode scanning process.

The barcode picker provides a high-level interface for scanning barcodes on iOS. The class is responsible for initializing and controlling the camera and manages the low-level barcode scanning process. The barcode picker also provides a configurable scan user interface in which recognized codes are highlighted.

Example (minimal) usage:

Set up the barcode picker in one of your view controllers:

// The scanning behavior of the barcode picker is configured through scan
// settings. We start with empty scan settings and enable a very generous
// set of symbologies. In your own apps, only enable the symbologies you
// actually need.
ScanSettings settings = ScanSettings.DefaultSettings ();
NSSet symbologiesToEnable = new NSSet(
Symbology.EAN13,
Symbology.EAN8,
Symbology.UPC12,
Symbology.UPCE,
Symbology.Datamatrix,
Symbology.Code39,
Symbology.Code128,
);
settings.EnableSymbologies(symbologiesToEnable);
// Setup the barcode scanner
BarcodePicker picker = new BarcodePicker(settings);
picker.OverlayView.ShowToolBar(true);
// Add delegates for the scan and cancel event. We keep references to the
// delegates until the picker is no longer used as the delegates are softly
// referenced and can be removed because of low memory.
scanDelegate = new PickerScanDelegate(this);
picker.ScanDelegate = scanDelegate;
cancelDelegate = new OverlayCancelDelegate(this);
picker.OverlayView.CancelDelegate = cancelDelegate;
PresentViewController(picker, true, null);
picker.StartScanning();
Since
4.7.0

Member Function Documentation

IntPtr Constructor ( ScanSettings  settings)

Initializes the barcode picker with the desired scan settings.

Note that the initial invocation of this method will activate the Scandit Barcode Scanner SDK, after which the device will count towards your device limit.

Make sure to set the app key available from your Scandit account through ScanditBarcodeScanner.iOS.License.SetAppKey before you call this initializer.

Since
4.7.0
Parameters
settingsThe scan settings to use. You may pass nil, which is identical to passing a settings instance constructed through ScanditBarcodeScanner.iOS.ScanSettings.DefaultSettings.
Returns
The newly constructed barcode picker instance.
void ApplyScanSettings ( ScanSettings  settings,
[NullAllowed] CompletionHandler  completionHandler 
)

Change the scan settings of an existing picker instance.

The scan settings are applied asynchronously after this call returns. You may use the completion handler to get notified when the settings have been applied to the picker. All frames processed after the settings have been applied will use the new scan settings.

Parameters
settingsThe new scan settings to apply.
completionHandlerAn optional block that will be invoked when the settings have been applied to the picker. The block will be invoked on an internal picker dispatch queue.
Since
4.7.0
bool IsScanning ( )

Returns true if scanning is in progress.

Since
1.0.0
Returns
boolean indicating whether scanning is in progress.
void StartScanning ( bool  paused,
[NullAllowed] CompletionHandler  completionHandler 
)

Starts/restarts the camera and potentially the scanning process.

Start or continue scanning barcodes after the creation of the barcode picker or a previous call to PauseScanning, ScanSession.PauseScanning, StopScanning or ScanSession.stopScanning.

In contrast to resumeScanning, startScanning clears the current barcode scanner session.

Since
4.7.0
Parameters
pausedIf true the barcode/2D recognition is paused but the streaming of preview images is started. If false both the barcode/2D recognition and the streaming of preview images are started.
completionHandlerIf nonnull, the handler is invoked when the camera has completed intiitalization. The handler is invoked from a picker-internal queue, which may or may not run on the UI thread.
void StartScanning ( )

Starts/restarts the camera and the scanning process.

Start or continue scanning barcodes after the creation of the barcode picker or a previous call to PauseScanning, ScanSession.PauseScanning, StopScanning or ScanSession.StopScanning.

This method is a convenience shortcut for calling picker.StartScanning(false, null);

Since
4.7.0
void StartScanning ( bool  paused)

Starts/restarts the camera and potentially the scanning process.

Start or continue scanning barcodes after the creation of the barcode picker or a previous call to PauseScanning, ScanSession.PauseScanning, StopScanning or ScanSession.StopScanning.

In contrast to resumeScanning, startScanning clears the current barcode scanner session.

Since
4.7.0
Parameters
pausedIf true the barcode/2D recognition is paused but the streaming of preview images is started. If false both the barcode/2D recognition and the streaming of preview images are started.
void StopScanning ( [NullAllowed] CompletionHandler  completionHandler)

Stop scanning and the video preview.

Since
4.7.0
Parameters
completionHandlerAn optional block that will be invoked when the picker has been stopped. The block will be invoked on an internal picker dispatch queue.
void StopScanning ( )

Stop scanning and the video preview.

Since
4.7.0
void ResumeScanning ( )

Resume scanning codes.

Continue (resume) scanning barcodes after a previous call to pauseScanning, or ScanSession.PauseScanning. Calling ResumeScanning on a picker that was stopped with StopScanning, will not resume the scanning process.

In contrast to startScanning, resumeScanning does not clear the current barcode scanner session. Thus if you want accumulate the codes, use PauseScanning/ResumeScanning, if you want to start from an empty session, use PauseScanning/StartScanning.

Since
4.7.0
void ResumeScanning ( [NullAllowed] CompletionHandler  completionHandler)

Resume scanning codes.

Continue (resume) scanning barcodes after a previous call to pauseScanning, or ScanSession.PauseScanning. Calling ResumeScanning on a picker that was stopped with stopScanning, will not resume the scanning process.

In contrast to StartScanning, ResumeScanning does not clear the current barcode scanner session. Thus if you want accumulate the codes, use PauseScanning/ResumeScanning, if you want to start from an empty session, use PauseScanning/StartScanning.

Parameters
completionHandlercallback to be invoked when the scanning has been resumed.
Since
4.16.0
void PauseScanning ( )

Pause scanning but keep preview on.

This method pauses barcode/2D recognition but continues streaming preview images. Use this method if you are interrupting barcode recognition for a short time and want to continue scanning barcodes/2D codes afterwards.

Use ResumeScanning to continue scanning barcodes.

Since
4.7.0
void PauseScanning ( [NullAllowed] CompletionHandler  completionHandler)

Pause scanning but keep preview on.

This method pauses barcode/2D recognition but continues streaming preview images. Use this method if you are interrupting barcode recognition for a short time and want to continue scanning barcodes/2D codes afterwards.

Use ResumeScanning to continue scanning barcodes.

Parameters
completionHandlercallback to be invoked when the scanning has been paused.
Since
4.7.0
CGPoint ConvertPoint ( CGPoint  point)

Converts a point of a 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::HighDensityModeEnabled is changed or the camera is switched from back to front or vice versa.

Since
4.9.0
Parameters
pointThe point to be converted.
Returns
The point in the picker's coordinate system.
See also
Barcode.Location
bool SupportsCameraFacing ( CameraFacingDirection  facing)

Returns whether the specified camera facing direction is supported by the current device.

Since
3.0.0
Parameters
facingThe camera facing direction in question.
Returns
Whether the camera facing direction is supported
bool ChangeToCameraFacing ( CameraFacingDirection  facing)

Changes to the specified camera facing direction if it is supported.

Since
3.0.0
Parameters
facingThe new camera facing direction
Returns
Whether the change was successful
bool SwitchCameraFacing ( )

Changes to the opposite camera facing if it is supported.

Since
3.0.0
Returns
Whether the change was successful
void SwitchTorchOn ( bool  on)

Switches the torch (if available) on or off programmatically.

There is also a method in the ScanditSDKOverlayController to add a torch icon that the user can click to activate the torch.

Parameters
ontrue when the torch should be switched on, NO if the torch should be turned off.

By default the torch switch is off.

Since
2.0.0
bool SetRelativeZoom ( float  zoom)

Sets the zoom to the given percentage of the maximum analog zoom possible.

Parameters
zoomThe percentage of the max zoom (between 0 and 1)
Returns
Whether setting the zoom was successful
Since
4.7.0
void AddPropertyObserver ( PropertyObserver  observer)

Add a observer that gets called whenever a property changes.

This API is experimental. There are no API stability guarantees at this point and this API might change or dissapear in a future release.

Parameters
observerThe observer to add
Since
4.14.0
void RemovePropertyObserver ( PropertyObserver  observer)

remove a property changed delegate

In case the observer was not registered previously, this call has no effect.

Parameters
observerThe observer to remove
Since
4.14.0
Parser ParserForFormat ( ParserDataFormat  dataFormat,
out NSError  error 
)

Instantiates a parser object.

Parameters
dataFormatThe format of the input data for the parser.
errorDescribes errors during instantiation of the parser. This out parameter is set to nil on success.
Returns
A parser instance or nil
Since
5.7.0

Property Documentation

UIInterfaceOrientationMask allowedInterfaceOrientations
getset

Orientations that the barcode picker is allowed to rotate to.

The orientations returned by this view controller's supportedInterfaceOrientations function. Be aware that this orientation mask will not be taken into consideration if the view controller is part of a UITableViewController for example (in that case the UITableViewController's supportedInterfaceOrientations matter). This orientation will also not be taken into consideration if this view controller's view is directly added to a view hierarchy.

By default all orientations are allowed (UIInterfaceOrientationMaskAll).

Since
4.7.0
NSObject WeakProcessFrameDelegate
getset

The process frame delegate for this barcode picker.

NSObject WeakScanDelegate
getset

The scan delegate for this barcode picker.

ScanditBarcodeScanner.iOS.ScanDelegate.DidScan is invoked on the registered scanDelegate whenever a new barcode/2d code has been recognized. To react to barcode scanned events, you must provide a scan delegate that contains your application logic.

Since
4.7.0
NSObject WeakTextRecognitionDelegate
getset

The text recognition settings to be used.

By default, the text recognition settings are set to nil. If you want to use the text recognition feature, you must set this property and configure the settings accordingly.

This feature is only available if you have text recognition enabled.

Since
5.1
ScanOverlay OverlayView
getset

The overlay controller controls the scan user interface.

The Scandit BarcodeScanner contains a default implementation that developers can inherit from to define their own scan UI (enterprise licensees only).

Since
4.7.0

The facing direction of the used camera.

Since
2.0.0
AVCaptureVideoOrientation CameraPreviewOrientation
getset

The orientation of the camera preview.

The orientation of the camera preview. In general the preview's orientation will be as wanted, but there may be cases where it needs to be set individually. This does not change the orientation of the overlayed UI elements.

Possible values are: AVCaptureVideoOrientationPortrait, AVCaptureVideoOrientationPortraitUpsideDown, AVCaptureVideoOrientationLandscapeLeft, AVCaptureVideoOrientationLandscapeRight

bool AutoFocusOnTapEnabled
getset

Whether tapping on the screen should trigger an auto-focus.

By default, the camera triggers an auto-focus whenever the user taps the screen. To disable this feature, set this property to NO.

bool PinchToZoomEnabled
getset

Whether pinch to zoom is enabled.

By default, the camera preview zoom factor can be changed by using a pinch gesture. To disable this feature, set this property to NO. The feature is only available on devices with iOS 7 and greater.

Since
4.15