scandit-web-datacapture-id
Version:
Scandit Data Capture SDK for the Web
115 lines (114 loc) • 5.15 kB
TypeScript
import type { DataCaptureContext, DataCaptureMode, DataCaptureModeJSON, FrameData } 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 { IdCaptureError } from "./IdCaptureError";
import { IdCaptureFeedback } from "./IdCaptureFeedback";
import { IdCaptureSession } from "./IdCaptureSession";
import type { IdCaptureSettings, IdCaptureSettingsJSON } from "./IdCaptureSettings";
import { CapturedId } from "./captured-id/CapturedId";
type IdCaptureJSON = DataCaptureModeJSON<IdCaptureSettingsJSON>;
export declare const STATE: {
readonly Available: "Available";
readonly ProcessingFrame: "ProcessingFrame";
readonly ProcessingQueue: "ProcessingQueue";
};
export declare class IdCapture implements DataCaptureMode, Serializable<IdCaptureJSON> {
private readonly type;
private readonly _synchronousFrameFlow;
private state;
private _isEnabled;
private settings;
private _context;
private listeners;
private overlayListeners;
private contextListener;
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 forContext(context: DataCaptureContext | null, settings: IdCaptureSettings): Promise<IdCapture>;
setFeedback(feedback: IdCaptureFeedback): Promise<void>;
addListener(listener: IdCaptureListener): void;
removeListener(listener: IdCaptureListener): void;
isEnabled(): boolean;
setEnabled(enabled: boolean): Promise<void>;
reset(): Promise<void>;
applySettings(settings: IdCaptureSettings): Promise<void>;
parse(code: string): Promise<CapturedId | null>;
toJSONObject(): IdCaptureJSON;
/**
* Called when the context has changed source.
* It is possible that we are still processing a frame when a source change occurs, which could prevent the
* current frame from completing its processing and leave us in an unexpected state (processing a frame forever).
*/
private didChangeFrameSource;
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 documentsIncludeVIZDocuments;
private attachedToContext;
private detachedFromContext;
private dispose;
private didChange;
private onWorkerMessage;
private processFrameWithCentaurus;
private sendClearFrameDataRequest;
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 interface IdCaptureListener {
didUpdateSession?: (idCapture: IdCapture, session: IdCaptureSession, frameData: FrameData) => void;
didCaptureId?: (idCapture: IdCapture, session: IdCaptureSession, frameData: FrameData) => void;
didLocalizeId?: (idCapture: IdCapture, session: IdCaptureSession, frameData: FrameData) => void;
didRejectId?: (idCapture: IdCapture, session: IdCaptureSession, frameData: FrameData) => void;
didTimedOut?: (idCapture: IdCapture, session: IdCaptureSession, frameData: FrameData) => void;
didFailWithError?: (idCapture: IdCapture, error: IdCaptureError, session?: IdCaptureSession) => void;
}
export {};