Barcode Pick Async Mapper Product Provider

Defined in package com.scandit.datacapture.barcode.pick.data

BarcodePickAsyncMapperProductProvider
class BarcodePickAsyncMapperProductProvider : BarcodePickProductProvider

Added in version 6.19.0

A product provider that takes on construction a list of products to pick and an async itemData to product mapper

Usage example:

val products = setOf(
    BarcodePickProduct("780846124122", 2),
    BarcodePickProduct("750865926478", 1),
    BarcodePickProduct("984579832123", 4)
)

val queryExecutor = Executors.newSingleThreadExecutor()

BarcodePickAsyncMapperProductProvider(
    products,
    object : BarcodePickAsyncMapperProductProviderCallback {
        override fun productIdentifierForItems(
            itemsData: List<String>,
            callback: BarcodePickProductProviderCallback
        ) {
            queryExecutor.execute {
                val result = myDb.findAndMapProductsForItemsData(itemsData)
                callback.onData(result)
            }
        }
    })

Note

Use your preferred way to retrieve the initial list of products to pick and to handle the async retrieval of products from itemsData. In this snippet we’re using a hardcoded set of products and an Executor with a fictitious myDb object for simplicity’s sake.

BarcodePickAsyncMapperProductProvider()
BarcodePickAsyncMapperProductProvider(@NonNull Set<@NonNull BarcodePickProduct> productsToPick,
        @NonNull BarcodePickAsyncMapperProductProviderCallback callback)

Added in version 6.19.0

Creates a new instance with the given set of BarcodePickProduct and callback to map items to products asynchronously.

updateProductList(products)
void updateProductList(@NonNull Set<@NonNull BarcodePickProduct> products)

Added in version 6.25.6

Replaces the products database to the newly provided list. This will reset scanning and all the previous picking progress will be lost.