Barcode AR Filter
Defined under the namespace Scandit.Datacapture.Barcode.Ar
- BarcodeArFilter
interface BarcodeArFilterAdded in version 8.7.0
Interface for filtering barcodes in BarcodeAr.
Implement this interface to provide custom barcode filtering logic that determines which barcodes should be visible in the BarcodeArSession. This allows you to selectively show only barcodes that meet certain criteria (e.g., specific symbologies, data patterns, or business logic).
The filter is evaluated:
Every time barcodes are added to or removed from the session
When the filter is first set or changed via BarcodeAr.setBarcodeFilter()
It is not re-evaluated when only barcode positions are updated.
- filterBarcodes(barcodes)
filterBarcodes(barcodes: Barcode[]): Barcode[]
Added in version 8.7.0
Filters the provided barcodes and returns which ones should be visible.
- Param barcodes
All currently visible barcodes.
- Returns
A subset of the input barcodes that should be shown to the user. The returned list must only contain barcodes from the input; any other barcodes will be ignored.
Note
This method is called on an internal recognition thread and must return quickly to avoid impacting frame processing performance.
Note
The implementation must be self-contained: it cannot reference variables from the surrounding scope, and globals such as
window,consoleandfetchare unavailable. Include any values it depends on directly in the function body, and call BarcodeAr.setBarcodeFilter() again if they change. This is also why the method returns the filtered list directly rather than a promise.A filter that throws, or returns anything other than a list, leaves all barcodes visible.