@scandit/web-datacapture-barcode
Version:
Scandit Data Capture SDK for the Web
52 lines • 2.28 kB
TypeScript
import { t as Barcode } from "./Barcode-DNvaiOyn.js";
import { FrameData } from "@scandit/web-datacapture-core";
//#region src/main/AdaptiveRecognitionServiceListener.d.ts
/**
* Reason an adaptive recognition dispatch failed, delivered to an {@link AdaptiveRecognitionServiceListener}.
*/
declare enum AdaptiveRecognitionErrorReason {
/**
* The dispatch failed for an unspecified reason (network, backend, or pre-dispatch failure).
*/
Unknown = 0,
/**
* The dispatch did not complete within the allotted time.
*/
Timeout = 1
}
/**
* Frame correlation metadata delivered with every {@link AdaptiveRecognitionServiceListener} callback. It ties an
* asynchronously-delivered adaptive recognition outcome back to the scan moment that produced the dispatched frame.
*/
interface AdaptiveRecognitionFrameMetadata {
/**
* Monotonic per-mode ordinal identifying the frame within a capture session.
*/
frameId: number;
/**
* The barcodes recognized in the dispatched frame.
*/
barcodes: Barcode[];
}
/**
* Listener for the outcome of adaptive recognition dispatches performed by a capture mode's auto-wired adaptive recognition service.
* Registered on the mode via `BarcodeCapture.addAdaptiveRecognitionServiceListener`. All callbacks are optional so an
* implementor overrides only the ones it needs.
*/
interface AdaptiveRecognitionServiceListener {
/**
* Invoked when a frame is dispatched to the adaptive recognition service.
*/
onAdaptiveRecognitionServiceDispatchStarted?: (frameData: FrameData, frameMetadata: AdaptiveRecognitionFrameMetadata) => void;
/**
* 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.
*/
onAdaptiveRecognitionServiceResponse?: (response: string, frameMetadata: AdaptiveRecognitionFrameMetadata) => void;
/**
* Invoked when an adaptive recognition dispatch fails.
*/
onAdaptiveRecognitionServiceError?: (reason: AdaptiveRecognitionErrorReason, frameMetadata: AdaptiveRecognitionFrameMetadata) => void;
}
//#endregion
export { AdaptiveRecognitionFrameMetadata as n, AdaptiveRecognitionServiceListener as r, AdaptiveRecognitionErrorReason as t };