SBSScanSession Class Reference

Inherits NSObject.

Instance Methods

(void) - clear
 
(void) - pauseScanning
 
(void) - stopScanning
 
(void) - rejectCode:
 
(void) - rejectTrackedCode:
 

Properties

NSArray< SBSCode * > * newlyRecognizedCodes
 
NSArray< SBSCode * > * newlyLocalizedCodes
 
NSArray< SBSCode * > * allRecognizedCodes
 
NSDictionary< NSNumber
*, SBSTrackedCode * > * 
trackedCodes
 

Detailed Description

Holds all barcodes that were decoded in the current session.

Configuring Session Behavior

The scan session is responsible for determining the list of "relevant" barcodes by filtering out duplicates. Depending on your app, different duplicate removal is required. For some applications, only one barcode is required. The scanning process is stopped as soon as one code is decoded. For other applications, multiple codes are scanned after another. For example, a scanner at the cash desk may need to scan multiple products. To avoid duplicates, the same barcode should not be scanned in short succession. The same barcode (data, symbology) should not count as a duplicate if encountered again after a few seconds.

By default, if a barcode has the same symbology and data as code that was decoded less than 500ms ago, it is filtered out as a duplicate. The exact filtering behavior can be changed by setting the "code duplicate filter", see SBSScanSettings::codeDuplicateFilter for details.

Session Lifetime

The session is cleared when startScanning (SBSBarcodePicker) is called, or when the user manually clears the session using clear (SBSScanSession).

Method Documentation

- (void) clear

Remove all codes from the scan session.

Use this method to manually remove all codes from the scan session. Typicaly you will not have to this method directly but instead configure the duplicate removal and code caching duration through SBSScanSettings

- (void) pauseScanning

Immediately pauses barcode recognition, but keeps camera preview open.

This is useful for briefly pausing the barcode recognition to show the recognized code in an overlay and then resume the scan process to scan more codes.

When only scanning one code and then returning to another part of the application, it is recommended to call stopScanning instead.

Pausing will not clear the scan session. To remove all codes from the scan session call clear.

- (void) stopScanning

Immediately stop barcode recognition and close camera.

Use this method when you finished scanning barcodes. In case you want to only briefly pause barcode recognition, use pauseScanning instead.

- (void) rejectCode: (nonnull SBSCode *)  code

Prevent beeping/vibrate and highlighting for a particular code.

Use this method to reject a certain code if you have additional methods for verifying the integrity of the code, e.g. with a custom checksum. Rejected codes won't be highlighted in the scan UI. Additionally beep and vibration will be surpressed.

For this feature to work, you will have to enable code rejection by setting SBSScanSettings::codeRejectionEnabled to YES.

Rejected codes will be added to allRecognizedCodes like all other codes.

Note that you should only pass codes returned by newlyRecognizedCodes, as passing any other code will have no effect. Additionally, you should only calls this method from barcodePicker:didScan: (SBSScanDelegate-p).

Parameters
codeThe code to reject
Since
4.15
- (void) rejectTrackedCode: (nonnull SBSTrackedCode *)  trackedCode

The codes that should be visualized as rejected in the matrix scan view.

Use this method to visually reject a certain code in the matrix scan API. In order to use this feature it is necessary to enable SBSScanSettings::matrixScanEnabled and set SBSOverlayController::guiStyle to SBSGuiStyleMatrixScan.

Warning
This property is meant to be used only in the session thread. Additionally, you should only calls this method from barcodePicker:didProcessFrame:session: (SBSProcessFrameDelegate-p).
Parameters
trackedCodeThe tracked code to visually reject
Since
5.2

Property Documentation

- (NSArray<SBSCode *>*) newlyRecognizedCodes
readnonatomiccopy

A new copy of the list of barcodes that have been successfully decoded in the last frame.

- (NSArray<SBSCode *>*) newlyLocalizedCodes
readnonatomiccopy

A new copy of the list of barcodes that have been localized but not recognized in the last frame.

- (NSArray<SBSCode *>*) allRecognizedCodes
readnonatomiccopy

Returns the list of barcodes (data, symbology) that have been decoded (recognized) in this session.

Depending on the code caching and duplicate filtering behavior, different sets of codes are returned by this method.

See also
SBSScanSettings::codeDuplicateFilter
SBSScanSettings::codeCachingDuration
Returns
a new copy of the list of barcodes that have been successfully decoded in this session
- (NSDictionary<NSNumber *, SBSTrackedCode *>*) trackedCodes
readnonatomiccopy

Returns a dictionary representing a map between tracked object identifiers and tracked objects.

To toggle matrix scan use SBSScanSettings::matrixScanEnabled.

Warning
It will return nil when matrix scan is disabled.
This property is meant to be used only in the session thread.
Returns
a new copy of the dictionary of tracked objects that have been successfully tracked in the last frame.
Since
5.2

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