@scandit/web-datacapture-id
Version:
Scandit Data Capture SDK for the Web
88 lines (87 loc) • 5.01 kB
TypeScript
import type { UpdateContextParameters, CaptureModeDeserializerInstance, ModuleHandler, Vector, WorkerFunctions as BaseWorkerFunctions, ProcessFrameParameters } 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 { CapturedIdJSONWithoutCommonFieldsJSON, DataCaptureCallbackMessage, EngineWorkerResponse, IdCaptureSessionHolder, Module, ParseResult, WasmCaptureId } from "./dataCaptureWorkerRelated";
import type { IdCaptureSettingsJSON } from "../IdCaptureSettings";
import type { AamvaBarcodeVerificationResultJSON, CapturedIdJSON, CapturedIdJSONWithRawImageInfo, IdCaptureSessionJSON } 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">>;
idCaptureBarcodeVerifyAamvaCapture(capturedId: CapturedIdJSON): Promise<EngineWorkerResponse<"idCaptureBarcodeVerifyAamvaCapture">>;
idCaptureDrivingLicenseDetailsCreateWithBlinkIdData(vehicleClass: string, restrictions: string, endorsements: string): EngineWorkerResponse<"idCaptureDrivingLicenseDetailsCreateWithBlinkIdData">;
getIdOpenSourceSoftwareLicenseInfo(): EngineWorkerResponse<"getIdOpenSourceSoftwareLicenseInfo">;
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;
idCaptureBarcodeVerifyAamvaCapture(capturedId: CapturedIdJSON): Promise<AamvaBarcodeVerificationResultJSON & {
error: string;
serverResponseJSON: string;
isSuccess: boolean;
}>;
start(): void;
onResetFromSDC(): void;
setDetectionOnlyMode(detectionOnlyMode: boolean): void;
onIdCapturedCallback(capturedId: WasmCaptureId): void;
onIdRejectedCallback(capturedId: WasmCaptureId, rejectionReason: string): void;
extractCaptureId(wasmCapturedId: WasmCaptureId | null): CapturedIdJSONWithRawImageInfo | null;
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 extractImageTransferablesFromCapturedId;
private isReadyToDisplayHints;
private initHintPresenterIfNotInitialized;
}
export {};