SBSScanCase Class Reference

Inherits NSObject.

Instance Methods

(nonnull instancetype) - initWithSettings:delegate:
 
(nonnull instancetype) - initWithSettings:
 
(void) - applySettings:completionHandler:
 
(void) - setTimeout:fromState:toState:
 
(void) - setTimeout:tolerance:fromState:toState:
 
(void) - removeTimeoutFromState:
 
(BOOL) - setScanSoundResource:ofType:
 
(BOOL) - setErrorSoundResource:ofType:
 

Class Methods

(nonnull instancetype) + acquireWithSettings:delegate:
 

Properties

id< SBSScanCaseDelegatedelegate
 
SBSScanCaseState state
 
BOOL volumeButtonToScanEnabled
 
NSTimeInterval activateDurationAfterVolumeButtonRelease
 
UIViewController * cameraPreview
 
BOOL scanBeepEnabled
 
BOOL errorSoundEnabled
 

Detailed Description

Start a scanner for the Scandit case.

SBSScanCase 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.
[SBSLicense setAppKey:kScanditBarcodeScannerAppKey];
// Create the settings used for the scan case.
SBSScanCaseSettings *settings = [[SBSScanCaseSettings alloc] init];
// Enable symbologies etc.
[scanSettings setSymbology:SBSSymbologyEAN13 enabled:YES];
// Instantiate the scan case and keep a strong reference to it until needed.
self.scanCase = [SBSScanCase acquireWithSettings:settings delegate:self];
Since
4.13.0

Method Documentation

+ (nonnull instancetype) acquireWithSettings: (nullable SBSScanCaseSettings *)  settings
delegate: (nullable id< SBSScanCaseDelegate >)  delegate 

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 setAppKey: (SBSLicense) before you call this initializer.

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

Parameters
settingsThe scan settings to use. You may pass nil, which is identical to passing a settings instance constructed through defaultSettings (SBSScanSettings).
delegateThe scan case delegate.
Returns
The newly constructed scan case instance.
Since
4.13.0
- (nonnull instancetype) initWithSettings: (nullable SBSScanCaseSettings *)  settings
delegate: (nullable id< SBSScanCaseDelegate >)  delegate 

The designated initializer for instantiating 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 setAppKey: (SBSLicense) before you call this initializer.

Parameters
settingsThe scan settings to use. You may pass nil, which is identical to passing a settings instance constructed through defaultSettings (SBSScanSettings).
delegateThe scan case delegate.
Returns
The newly constructed scan case instance.
Since
4.13.0
- (nonnull instancetype) initWithSettings: (nullable SBSScanCaseSettings *)  settings

A convenience initializer for instantiating 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 setAppKey: (SBSLicense) before you call this initializer.

Note that the delegate must be set in order to receive scan events.

Parameters
settingsThe scan settings to use. You may pass nil, which is identical to passing a settings instance constructed through defaultSettings (SBSScanSettings).
Returns
The newly constructed scan case instance.
Since
5.2.0
- (void) applySettings: (nonnull SBSScanCaseSettings *)  settings
completionHandler: (nullable void(^)(void))  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.13.0
- (void) setTimeout: (NSTimeInterval)  timeout
fromState: (SBSScanCaseState fromState
toState: (SBSScanCaseState 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 setTimeout:tolerance:fromState:toState: 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.13.0
- (void) setTimeout: (NSTimeInterval)  timeout
tolerance: (NSTimeInterval)  tolerance
fromState: (SBSScanCaseState fromState
toState: (SBSScanCaseState 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.13.0
- (void) removeTimeoutFromState: (SBSScanCaseState 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.13.0
- (BOOL) setScanSoundResource: (nonnull NSString *)  path
ofType: (nonnull NSString *)  extension 

Sets the audio sound played when a code has been successfully recognized.

The file needs to be included in the application bundle.

The default is: "beep.wav"

Since
5.3.1
Parameters
pathThe file name of the sound file (without suffix).
extensionThe file type.
Returns
Whether the change was successful.
- (BOOL) setErrorSoundResource: (nonnull NSString *)  path
ofType: (nonnull NSString *)  extension 

Sets the audio sound played when no code was recognized.

This sound file is played when controlling the scan case with the volume button and no code was scanned.

The file needs to be included in the application bundle.

The default is: "error.wav"

Since
5.3.1
Parameters
pathThe file name of the sound file (without suffix).
extensionThe file type.
Returns
Whether the change was successful.

Property Documentation

- (id<SBSScanCaseDelegate>) delegate
readwritenonatomicweak

The delegate for this scan case.

Since
4.13.0
- (SBSScanCaseState) state
readwritenonatomicassign

The state of the scan case.

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

After the initialization the default state is SBSScanCaseStateStandby. This property is thread safe.

Since
4.13.0
- (BOOL) volumeButtonToScanEnabled
readwritenonatomicassign

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 SBSScanCaseStateActive, while releasing it changes the state to SBSScanCaseStateStandby). Set to NO to avoid controlling the state of the scan case via the volume button.

The default value is NO.

Since
4.13.0
- (NSTimeInterval) activateDurationAfterVolumeButtonRelease
readwritenonatomicassign

The duration in seconds for which the scanner should remain in active state after the volume button has been released.

The value is clamped to be at least 0.93 seconds. The default value is 0.93 seconds.

Since
5.3.1
- (UIViewController*) cameraPreview
readnonatomicstrong

The camera preview.

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

Since
4.14
- (BOOL) scanBeepEnabled
readwritenonatomicassign

Whether to play a beep sound upon a successful scan.

By default, a beep sound is played upon successfully scanning a barcode. Set this property to NO, to disable the sound. If the ringer mode is set to silent, no beep sound is played, regardless of the value of this property.

Since
5.3.1
- (BOOL) errorSoundEnabled
readwritenonatomicassign

Whether to play an error sound when no code was scanned.

By default, an error sound is played when activating the scanner using the volume button control when no could be scanned. If the ringer mode is set to silent, no sound is played, regardless of the value of this property.

Since
5.3.1

The documentation for this class was generated from the following file: