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< SBSScanCaseDelegate > | delegate |
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:
- 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
-
settings The scan settings to use. You may pass nil, which is identical to passing a settings instance constructed through defaultSettings (SBSScanSettings). delegate The 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
-
settings The scan settings to use. You may pass nil, which is identical to passing a settings instance constructed through defaultSettings (SBSScanSettings). delegate The 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
-
settings The 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
-
settings The new scan settings to apply. completionHandler An 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
-
timeout The interval of the timer. fromState The state from which the timer should start. toState The 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
-
timeout The interval of the timer. tolerance The tolerance of the timer. fromState The state from which the timer should start. toState The 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
-
fromState The 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
-
path The file name of the sound file (without suffix). extension The 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
-
path The file name of the sound file (without suffix). extension The file type.
- Returns
- Whether the change was successful.
Property Documentation
|
readwritenonatomicweak |
The delegate for this scan case.
- didInitializeScanCase: (SBSScanCaseDelegate-p) is called when the scan case finished the initalization process.
- scanCase:didScan: (SBSScanCaseDelegate-p) is invoked whenever a new code is scanned.
- scanCase:didChangeState:reason: (SBSScanCaseDelegate-p) is invoked whenever SBSScanCase::state changed.
- Since
- 4.13.0
|
readwritenonatomicassign |
The state of the scan case.
Get or set the state of the scan case. Possible states:
- SBSScanCaseStateOff to stop the scanner (camera off, torch off);
- SBSScanCaseStateStandby 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);
- SBSScanCaseStateActive to start scanning (camera on, scanner on, torch on).
After the initialization the default state is SBSScanCaseStateStandby. This property is thread safe.
- Since
- 4.13.0
|
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
|
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
|
readnonatomicstrong |
The camera preview.
Use this accessor if you would like to display a camera preview when using the scan case.
- Since
- 4.14
|
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
|
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: