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

ScanCase Interface Reference

Public Member Functions

ScanCase Acquire (ScanCaseSettings settings, ScanCaseDelegate scanDelegate)
 
void ApplySettings (ScanCaseSettings settings, CompletionHandler completionHandler)
 
void SetTimeout (double timeout, ScanCaseState fromState, ScanCaseState toState)
 
void SetTimeout (double timeout, double tolerance, ScanCaseState fromState, ScanCaseState toState)
 
void RemoveTimeoutFromState (ScanCaseState fromState)
 

Properties

ScanCaseDelegate Delegate [get, set]
 
ScanCaseState State [get, set]
 
bool VolumeButtonToScanEnabled [get, set]
 
UIViewController CameraPreview [get]
 

Detailed Description

Start a scanner for the Scandit case.

ScanCase is a subclass of NSObject and it does not need to be added to the view hierarchy.

Example (minimal) usage:

// Set your app key on the license first.
License.SetAppKey(kScanditBarcodeScannerAppKey);
// Create the settings used for the scan case.
var settings = new ScanCaseSettings();
// Enable symbologies etc.
settings.SetSymbologyEnabled(Symbology.EAN13, true);
// Instantiate the scan case and keep a strong reference to it until needed.
_scanCase = ScanCase.Acquire(settings, this);
Since
4.16

Member Function Documentation

ScanCase Acquire ( ScanCaseSettings  settings,
ScanCaseDelegate  scanDelegate 
)

Initializes a new scan case.

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 License.SetAppKey() before you call this initializer.

This is the recommended way to create a new ScanCase object.

Parameters
settingsThe scan settings to use. You may pass nil, which is identical to passing a settings instance constructed through ScanSettings.DefaultSettings.
scanDelegateThe scan case delegate.
Returns
The newly constructed scan case instance.
Since
4.16
void ApplySettings ( ScanCaseSettings  settings,
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.16
void SetTimeout ( double  timeout,
ScanCaseState  fromState,
ScanCaseState  toState 
)

Set a timeout to automatically change state after a specific interval.

Set a timer that is started whenever the state is changed to fromState. The timer will have a time interval equal to timeout and then it will switch the state of the scan case to toState. The timer will be created every time the state of the scan case is equal to fromState. At any given time there could not be more than one timeout for each fromState.

Note that this method is actually calling ScanCase.SetTimeout() with 0 as tolerance. Please also note that in most of the cases it is better to set a tolerance higher than 0, as it gives the system more flexibility to schedule the firing date and increases responsiveness.

Parameters
timeoutThe interval of the timer.
fromStateThe state from which the timer should start.
toStateThe new state when the timer is fired.
Since
4.16
void SetTimeout ( double  timeout,
double  tolerance,
ScanCaseState  fromState,
ScanCaseState  toState 
)

Set a timeout to automatically change state after a specific interval.

Set a timer that is started whenever the state is changed to fromState. The timer will have a time interval equal to timeout and then it will switch the state of the scan case to toState. The timer will be created every time the state of the scan case is equal to fromState. At any given time there could not be more than one timeout for each fromState.

Please also note that in most of the cases it is better to set a tolerance higher than 0, as it gives the system more flexibility to schedule the firing date and increases responsiveness.

Parameters
timeoutThe interval of the timer.
toleranceThe tolerance of the timer.
fromStateThe state from which the timer should start.
toStateThe new state when the timer is fired.
Since
4.16
void RemoveTimeoutFromState ( ScanCaseState  fromState)

Remove a previously set timeout.

Remove a previously set timeout to avoid starting a new timer when the state is changed to fromState.

Parameters
fromStateThe state from which the timer should start.
Since
4.16

Property Documentation

ScanCaseDelegate Delegate
getset

The delegate for this scan case.

  • ScanCaseDelegate.DidInitialize is called when the scan case finished the initalization process.
  • ScanCaseDelegate.DidScan is invoked whenever a new code is scanned.
  • ScanCaseDelegate.DidChangeState is invoked whenever ScanCase.State changed.
Since
4.16
ScanCaseState State
getset

The state of the scan case.

Get or set the state of the scan case. Possible states:

  • ScanCaseState.Off to stop the scanner (camera off, torch off);
  • ScanCaseState.Standby to pause the scanner in order to save power but be ready to resume scanning (camera on but with throttled frame-rate, scanner off, torch off);
  • ScanCaseState.Active to start scanning (camera on, scanner on, torch on).

After the initialization the default state is ScanCaseState.Standby.

Since
4.16
bool VolumeButtonToScanEnabled
getset

Turn on/off scanning via the volume button.

Set to YES to change the state of the scan case using the volume button (holding the volume button changes the state to ScanCaseState.Active, while releasing it changes the state to ScanCaseState.Standby). Set to NO to not control the state of the scan case via the volume button.

The default value is NO.

Since
4.16
UIViewController CameraPreview
get

The camera preview.

Use this accessor if you would like to display a camera preview when using the scan case.

Since
4.16