Adaptive Recognition Service Listener

Defined in package com.scandit.datacapture.barcode.adaptiverecognition

AdaptiveRecognitionErrorReason

Added in version 8.7.0

Reason an adaptive recognition dispatch failed, delivered to an AdaptiveRecognitionServiceListener.

UNKNOWN

Added in version 8.7.0

The dispatch failed for an unspecified reason, such as a network, backend, or pre-dispatch failure.

TIMEOUT

Added in version 8.7.0

The dispatch did not complete within the allotted time.

AdaptiveRecognitionServiceListener
interface AdaptiveRecognitionServiceListener

Added in version 8.7.0

Interface for the outcome of adaptive recognition dispatches performed by a capture mode’s adaptive recognition service. Register it on the mode with BarcodeCapture.addAdaptiveRecognitionServiceListener(). Each callback receives the AdaptiveRecognitionFrameMetadata of the originating frame, so an asynchronously-delivered outcome can be correlated back to the frame that produced it.

All callbacks are optional, so an implementor overrides only the ones it needs.

For any given frame, its response or error callback always follows that frame’s dispatch-started callback.

Dispatch-started callbacks are serialized on the capture thread; response and error callbacks arrive later on the adaptive recognition service’s callback thread. A dispatch-started callback for one frame may therefore run concurrently with an outcome callback for another frame, and none are guaranteed to be invoked on the main thread, so state shared across callbacks must be synchronized by the implementor.

onAdaptiveRecognitionServiceDispatchStarted(frameData, frameMetadata)
fun onAdaptiveRecognitionServiceDispatchStarted(frameData: FrameData,
        frameMetadata: AdaptiveRecognitionFrameMetadata)

Added in version 8.7.0

Invoked when a frame is dispatched to the adaptive recognition service. The frame data is provided for the mode’s own use, for example to display the dispatched frame.

onAdaptiveRecognitionServiceResponse(response, frameMetadata)
fun onAdaptiveRecognitionServiceResponse(response: String,
        frameMetadata: AdaptiveRecognitionFrameMetadata)

Added in version 8.7.0

Invoked when an adaptive recognition dispatch completes successfully. The response is a JSON string whose shape is defined by the task’s response schema and is opaque to the SDK.

onAdaptiveRecognitionServiceError(reason, frameMetadata)
fun onAdaptiveRecognitionServiceError(reason: AdaptiveRecognitionErrorReason,
        frameMetadata: AdaptiveRecognitionFrameMetadata)

Added in version 8.7.0

Invoked when an adaptive recognition dispatch fails.

AdaptiveRecognitionFrameMetadata
class AdaptiveRecognitionFrameMetadata

Added in version 8.7.0

Correlation metadata delivered with every AdaptiveRecognitionServiceListener callback. It ties an asynchronously-delivered adaptive recognition outcome back to the frame that produced the dispatch. The SDK produces these; applications do not construct them.

frameId
val frameId: Long

Added in version 8.7.0

Monotonic per-mode ordinal identifying the frame within a capture session.

barcodes
val barcodes: List<Barcode>

Added in version 8.7.0

The barcodes recognized in the dispatched frame.