UNPKG

3.38 kBTypeScriptView Raw
1import type { DataCaptureContext, DataCaptureMode, DataCaptureModeJSON, FrameData } from "scandit-web-datacapture-core";
2import { CameraSettings } from "scandit-web-datacapture-core";
3import type { Serializable } from "scandit-web-datacapture-core/build/js/private/Serializable";
4import { IdCaptureError } from "./IdCaptureError";
5import { IdCaptureFeedback } from "./IdCaptureFeedback";
6import { IdCaptureSession } from "./IdCaptureSession";
7import type { IdCaptureSettings, IdCaptureSettingsJSON } from "./IdCaptureSettings";
8type IdCaptureJSON = DataCaptureModeJSON<IdCaptureSettingsJSON>;
9export declare class IdCapture implements DataCaptureMode, Serializable<IdCaptureJSON> {
10 private readonly type;
11 private _isEnabled;
12 private settings;
13 private _context;
14 private listeners;
15 private _centaurusConnector?;
16 private _feedback;
17 private readonly _onProcessFrameListener;
18 private readonly workerMessageListener;
19 private constructor();
20 static get recommendedCameraSettings(): CameraSettings;
21 get context(): DataCaptureContext | null;
22 get feedback(): IdCaptureFeedback;
23 setFeedback(feedback: IdCaptureFeedback): Promise<void>;
24 static forContext(context: DataCaptureContext | null, settings: IdCaptureSettings): Promise<IdCapture>;
25 addListener(listener: IdCaptureListener): void;
26 removeListener(listener: IdCaptureListener): void;
27 isEnabled(): boolean;
28 setEnabled(enabled: boolean): Promise<void>;
29 reset(): Promise<void>;
30 applySettings(settings: IdCaptureSettings): Promise<void>;
31 toJSONObject(): IdCaptureJSON;
32 /**
33 * If settings include VIZ document but the SDK was not configured with "VIZEnabled: true", we throw.
34 */
35 private checkCaptureSettingsAgainstSDKConfiguration;
36 private onProcessFrame;
37 private documentsIncludeVIZDocuments;
38 private runWorkerCommand;
39 private attachedToContext;
40 private detachedFromContext;
41 private dispose;
42 private didChange;
43 private onWorkerMessage;
44 private processFrameWithCentaurus;
45 private sendClearFrameDataRequest;
46 private triggerListenersForResult;
47 private notifyRecoveryAfterCrash;
48 private triggerErrorListener;
49 /**
50 * Send the last result to the worker so that the SDC engine can get it.
51 */
52 private reportLastResult;
53 /**
54 * Send the last error to the worker so that the SDC engine can get it.
55 */
56 private reportLastError;
57 /**
58 * Send the last localized ID to the worker so that the SDC engine can get it.
59 */
60 private reportLastLocalizedId;
61 /**
62 * Send the last detection issue to the worker so that the SDC engine can get it.
63 */
64 private reportLastDetectionIssue;
65}
66export interface IdCaptureListener {
67 didUpdateSession?: (idCapture: IdCapture, session: IdCaptureSession, frameData: FrameData) => void;
68 didCaptureId?: (idCapture: IdCapture, session: IdCaptureSession, frameData: FrameData) => void;
69 didLocalizeId?: (idCapture: IdCapture, session: IdCaptureSession, frameData: FrameData) => void;
70 didRejectId?: (idCapture: IdCapture, session: IdCaptureSession, frameData: FrameData) => void;
71 didTimedOut?: (idCapture: IdCapture, session: IdCaptureSession, frameData: FrameData) => void;
72 didFailWithError?: (idCapture: IdCapture, error: IdCaptureError, session?: IdCaptureSession) => void;
73}
74export {};