UNPKG

scandit-web-datacapture-id

Version:

Scandit Data Capture SDK for the Web

98 lines (97 loc) 6.15 kB
import type { UpdateContextParameters, CaptureModeDeserializerInstance, ModuleHandler, Vector, WorkerFunctions as BaseWorkerFunctions, ProcessFrameParameters, WasmFrameData } from "scandit-web-datacapture-core/build/js/worker/index"; import { DataCaptureEngine as CoreDataCaptureEngine } from "scandit-web-datacapture-core/build/js/worker/index.js"; import type { CapturedIdCommonFieldsGetters, CapturedIdJSONWithoutCommonFieldsJSON, DataCaptureCallbackMessage, EngineWorkerResponse, IdCaptureSessionHolder, Module, ParseResult } from "./dataCaptureWorkerRelated"; import type { IdCaptureSettingsJSON } from "../IdCaptureSettings"; import type { AamvaBarcodeVerificationResultJSON, AamvaVizBarcodeComparisonResultJSON, CapturedIdJSON, IdCaptureSessionJSON, VizMrzComparisonResultJSON } from "../SerializedTypes"; export interface WorkerFunctions extends BaseWorkerFunctions { postMessage: (message: DataCaptureCallbackMessage, transfer?: Transferable[]) => void; } /** * DataCaptureEngine is an abstraction of the engine, it is created by the engine worker * and should be used as a singleton. It calls the underlying engine methods directly. */ export declare class DataCaptureEngine extends CoreDataCaptureEngine<Module> { protected idCaptureMode: IdCaptureMode; protected workerFunctions: WorkerFunctions; protected lastIdCaptureModeSerializedSettings: string; constructor(moduleHandler: ModuleHandler<Module>, workerFunctions: WorkerFunctions); processFrame(parameters: ProcessFrameParameters): EngineWorkerResponse<"processFrame">; updateContext(contextUpdateParameters: UpdateContextParameters): EngineWorkerResponse<"updateContext">; idCaptureSetLastResult(result: string): void; idCaptureSetLastError(error: string): void; idCaptureSetLastLocalizedId(localizedId: string): void; idCaptureSetLastDetectionIssue(issue: string): void; idCaptureReset(): Promise<void>; idCaptureApplySettings(settings: IdCaptureSettingsJSON): Promise<void>; idCaptureParse(code: string): Promise<EngineWorkerResponse<"idCaptureParse">>; idCaptureVerifyAamvaCapture(capturedId: CapturedIdJSON): EngineWorkerResponse<"idCaptureVerifyAamvaCapture">; idCaptureVerifyVizMrzCapture(capturedId: CapturedIdJSON): EngineWorkerResponse<"idCaptureVerifyVizMrzCapture">; idCaptureBarcodeVerifyAamvaCapture(capturedId: CapturedIdJSON, endpoint: string | null): Promise<EngineWorkerResponse<"idCaptureBarcodeVerifyAamvaCapture">>; idCaptureDrivingLicenseDetailsCreateWithBlinkIdData(vehicleClass: string, restrictions: string, endorsements: string): EngineWorkerResponse<"idCaptureDrivingLicenseDetailsCreateWithBlinkIdData">; getModeDeserializers(): Vector; protected getWasmSideModuleFileName(): string; protected getWasmCoreFileName(simdSupport: boolean, webassemblyMultithreadingSupport: boolean): string; protected getWasmCoreExpectedHash(simdSupport: boolean, webassemblyMultithreadingSupport: boolean): string; protected getWasmMetadata(): Record<string, { bytes: number; }>; } type IdCaptureModeState = "created" | "disposed" | "initial" | "started"; export declare class IdCaptureMode { private idCaptureDeserializer; private SDCIdCaptureMode; private listenerSet; private lastResult; private lastError; private lastLocalizedId; private lastDetectionIssue; private readonly coreEngine; private readonly Module; private readonly workerFunctions; private _state; constructor(coreEngine: DataCaptureEngine, Module: Module, workerFunctions: WorkerFunctions); get state(): IdCaptureModeState; private set state(value); isReadyToProcessFrame(): boolean; setLastResult(result: string): void; setLastError(error: string): void; setLastLocalizedId(localizedId: string): void; setLastDetectionIssue(issue: string): void; applySettings(settings: IdCaptureSettingsJSON): Promise<void>; reset(): void; parse(code: string): ParseResult | null; idCaptureVerifyAamvaCapture(capturedId: CapturedIdJSON): AamvaVizBarcodeComparisonResultJSON | null; idCaptureVerifyVizMrzCapture(capturedId: CapturedIdJSON): VizMrzComparisonResultJSON | null; idCaptureBarcodeVerifyAamvaCapture(capturedId: CapturedIdJSON, endpoint: string | null): Promise<AamvaBarcodeVerificationResultJSON & { error: string; serverResponseJSON: string; isSuccess: boolean; }>; start(): void; onResetFromSDC(): void; setDetectionOnlyMode(detectionOnlyMode: boolean): void; onSessionUpdated(session: IdCaptureSessionHolder, frameData: WasmFrameData): void; onIdCapturedCallback(session: IdCaptureSessionHolder, frameData: WasmFrameData): void; /** * Build a CapturedIdJSON object. Initially we only have a partial capture, which needs to be augmented with * common fields getters provided by the session holder. */ buildCapturedIdFromSession(session: IdCaptureSessionHolder, partialCapturedId: CapturedIdJSONWithoutCommonFieldsJSON | null): CapturedIdJSON | null; buildCapturedIdFromCommonFields(capturedIdCommonFields: CapturedIdCommonFieldsGetters | null, partialCapturedId: CapturedIdJSONWithoutCommonFieldsJSON | null): CapturedIdJSON | null; onIdLocalizedCallback(session: IdCaptureSessionHolder, frameData: WasmFrameData): void; onIdRejectedCallback(session: IdCaptureSessionHolder, frameData: WasmFrameData): void; onIdCaptureTimedOutCallback(session: IdCaptureSessionHolder, frameData: WasmFrameData): void; onShutterButtonPositionChangedCallback(position: string): void; onShutterButtonStateChangedCallback(state: string): void; /** * The session holder contains everything except the common fields for the captured id, which have to be * gathered manually. */ parseIdCaptureSession(session: IdCaptureSessionHolder): Omit<IdCaptureSessionJSON, keyof CapturedIdJSONWithoutCommonFieldsJSON>; getDeserializer(): CaptureModeDeserializerInstance; dispose(): void; restart(): void; private isReadyToDisplayHints; private initHintPresenterIfNotInitialized; } export {};