Switch Scanning Modes
This article will show you how to switch between the single barcode scanning mode and the multiple barcodes scanning mode.
How to Switch Scanning Modes
You can use method scanningMode
to switch between single-barcode and multi-barcode scanning modes.
multiple
: Multi-barcode scanning mode.single
: (Default) Single-barcode scanning mode.
Code Snippet
- Objective-C
- Swift
DSBarcodeScannerConfig *config = [[DSBarcodeScannerConfig alloc] init]; config.scanningMode = DSScanningModeMultiple;
let config = BarcodeScannerConfig() config.scanningMode = .multiple
Related APIs
Configure the Auto-Stop Conditions
For multi-barcode scanning, there are two automatic stop conditions:
- The number of successfully decoded barcodes reaches the
expectedBarcodesCount
. - There are no new decoding results for N consecutive frames. The value of N can be set using
maxConsecutiveStableFramesToExit
.
For example. Here we apply the following settings:
- Objective-C
- Swift
DSBarcodeScannerConfig *config = [[DSBarcodeScannerConfig alloc] init]; config.expectedBarcodesCount = 10; config.maxConsecutiveStableFramesToExit = 15;
let config = BarcodeScannerConfig() config.expectedBarcodesCount = 10 config.maxConsecutiveStableFramesToExit = 15
If there are at least 10 barcodes decoded, it will stop scanning. Otherwise, it will keep scanning for 15 frames. If there are still no barcodes decoded in the 15 frames, it will stop scanning.
Related APIs
Comparisons
If you are looking for a solution to scan large batches of barcodes, please refer to the BatchBarcodeScanner
. The BatchBarcodeScanner
has much higher ability on scanning large number of barcodes. It also provides you a highly interactable UI for result previewing, editing, saving, reusing and sharing.
BarcodeScanner Single Mode | BarcodeScanner Multi Mode | BatchBarcodeScanner | |
---|---|---|---|
Dependencies | DynamsoftBarcodeReaderBundle | DynamsoftBarcodeReaderBundle | DynamsoftBatchBarcodeReaderBundle |
Scan Ability | Decodes at lease one barcode that available on the latest frame. | Decodes all barcodes that available on the latest frame. | Decodes all barcodes that available on the latest frame. (TTL Overlap Mode) or Decodes all barcodes that available on the first frame. (TTS Ovarlap Mode) or Decodes all barcodes that ever exists while capturing. (Panorama Mode) |
Result | Always returns one barcode result. If decoded more than one barcodes, users will be asked to select one. | All decoded barcodes | All decoded barcodes as well as a PanoramicImage that highlighting all these barcodes on it. |
Result Editor | Not available | Not available | Supports the following operations 1. Extend the current result with all kinds of available image source. 2. Manual input new results or edit the existing results 3. Save as history 4. Export as file (.png, .csv, etc.) |