UNPKG

@scandit/web-datacapture-id

Version:

Scandit Data Capture SDK for the Web

105 lines (104 loc) 4.27 kB
import type { DataCaptureContext, DataCaptureMode, DataCaptureModeJSON } from "@scandit/web-datacapture-core"; import { CameraSettings } from "@scandit/web-datacapture-core"; import type { Serializable } from "@scandit/web-datacapture-core/build/js/private/Serializable"; import { IdCaptureFeedback } from "./IdCaptureFeedback"; import type { IdCaptureSettings, IdCaptureSettingsJSON } from "./IdCaptureSettings"; import type { Listener } from "./Listener"; import { CapturedId } from "./captured-id/CapturedId"; import type { CentaurusLoader } from "scandit-web-datacapture-id-private"; type IdCaptureJSON = DataCaptureModeJSON<IdCaptureSettingsJSON & { licensee: string; licenseKey: string; }>; export declare const STATE: { readonly Available: "Available"; readonly ProcessingFrame: "ProcessingFrame"; readonly ProcessingQueue: "ProcessingQueue"; }; export declare class IdCapture implements DataCaptureMode, Serializable<IdCaptureJSON> { private static _centaurusLoader?; private readonly type; private state; private _isEnabled; private settings; private _context; private listeners; private overlayListeners; private _centaurusConnector?; private _endOfCycleTasks; private _feedback; private readonly _onProcessFrameListener; private readonly workerMessageListener; private constructor(); static get recommendedCameraSettings(): CameraSettings; get context(): DataCaptureContext | null; get feedback(): IdCaptureFeedback; private get privateContext(); static setCentaurusLoader(loader: CentaurusLoader): void; static forContext(context: DataCaptureContext | null, settings: IdCaptureSettings): Promise<IdCapture>; setFeedback(feedback: IdCaptureFeedback): Promise<void>; addListener(listener: Listener): void; removeListener(listener: Listener): void; isEnabled(): boolean; setEnabled(enabled: boolean): Promise<void>; reset(): Promise<void>; applySettings(settings: IdCaptureSettings): Promise<void>; parse(code: string): Promise<CapturedId | null>; toJSONObject(): IdCaptureJSON; private moveToState; private doReset; private doApplySettings; private addOverlayListener; private removeOverlayListener; /** * If settings include VIZ document but the SDK was not configured with "VIZEnabled: true", we throw. */ private checkCaptureSettingsAgainstSDKConfiguration; /** * Called many times by the DataCaptureContext when it receives a frame to process. * * To avoid any synchronization issue between Centaurus and SDC, we only process one frame at a time and don't allow * any other asynchronous operation (like reset()) while a frame is being processed both by Centaurus and SDC. * Any incoming async operation should be performed after the frame was processed, or before we process the next * frame. * The end of the frame processing is notified by the DataCaptureContext through the "onFrameProcessingFinished" * event. * @param frame FrameCapture * @returns A promise informing the Context on the next steps to undertake. */ private onProcessFrame; private doProcessFrame; private onAfterProcessFrame; private logPerformance; private enqueueTask; private processQueue; private settingsIncludeVIZDocuments; private attachedToContext; private detachedFromContext; private dispose; private didChange; private onWorkerMessage; private processFrameWithCentaurus; private uint8ArrayImageToBase64; private convertRawImagesToBase64; private triggerListenersForResult; private notifyRecoveryAfterCrash; private triggerErrorListener; /** * Send the last result to the worker so that the SDC engine can get it. */ private reportLastResult; /** * Send the last error to the worker so that the SDC engine can get it. */ private reportLastError; /** * Send the last localized ID to the worker so that the SDC engine can get it. */ private reportLastLocalizedId; /** * Send the last detection issue to the worker so that the SDC engine can get it. */ private reportLastDetectionIssue; } export {};