UNPKG

ngx-scanner-qrcode

Version:

This library is built to provide a solution scanner QR code. This library takes in raw images and will locate, extract and parse any QR code found within.

110 lines (109 loc) 5.05 kB
export interface ScannerQRCodeConfig { src?: string; fps?: number; vibrate?: number; /** support mobile */ decode?: string; unScan?: boolean; isBeep?: boolean; isMasked?: boolean; loadWasmUrl?: string; symbolType?: ScannerQRCodeSymbolType[]; constraints?: MediaStreamConstraints; canvasStyles?: CanvasRenderingContext2D[] | any[]; } export interface ScannerQRCodeSelectedFiles { url: string; name: string; file: File; data?: ScannerQRCodeResult[]; canvas?: HTMLCanvasElement; } export interface ScannerQRCodeDevice { kind: string; label: string; groupId: string; deviceId: string; } export interface ScannerQRCodePoint { x: number; y: number; } export declare enum ScannerQRCodeSymbolType { ScannerQRCode_NONE = 0,/**< no symbol decoded */ ScannerQRCode_PARTIAL = 1,/**< intermediate status */ ScannerQRCode_EAN2 = 2,/**< GS1 2-digit add-on */ ScannerQRCode_EAN5 = 5,/**< GS1 5-digit add-on */ ScannerQRCode_EAN8 = 8,/**< EAN-8 */ ScannerQRCode_UPCE = 9,/**< UPC-E */ ScannerQRCode_ISBN10 = 10,/**< ISBN-10 (from EAN-13). @since 0.4 */ ScannerQRCode_UPCA = 12,/**< UPC-A */ ScannerQRCode_EAN13 = 13,/**< EAN-13 */ ScannerQRCode_ISBN13 = 14,/**< ISBN-13 (from EAN-13). @since 0.4 */ ScannerQRCode_COMPOSITE = 15,/**< EAN/UPC composite */ ScannerQRCode_I25 = 25,/**< Interleaved 2 of 5. @since 0.4 */ ScannerQRCode_DATABAR = 34,/**< GS1 DataBar (RSS). @since 0.11 */ ScannerQRCode_DATABAR_EXP = 35,/**< GS1 DataBar Expanded. @since 0.11 */ ScannerQRCode_CODABAR = 38,/**< Codabar. @since 0.11 */ ScannerQRCode_CODE39 = 39,/**< Code 39. @since 0.4 */ ScannerQRCode_PDF417 = 57,/**< PDF417. @since 0.6 */ ScannerQRCode_QRCODE = 64,/**< QR Code. @since 0.10 */ ScannerQRCode_SQCODE = 80,/**< SQ Code. @since 0.20.1 */ ScannerQRCode_CODE93 = 93,/**< Code 93. @since 0.11 */ ScannerQRCode_CODE128 = 128,/**< Code 128 */ /** mask for base symbol type. * @deprecated in 0.11, remove this from existing code */ ScannerQRCode_SYMBOL = 255, /** 2-digit add-on flag. * @deprecated in 0.11, a ::ScannerQRCode_EAN2 component is used for * 2-digit GS1 add-ons */ ScannerQRCode_ADDON2 = 512, /** 5-digit add-on flag. * @deprecated in 0.11, a ::ScannerQRCode_EAN5 component is used for * 5-digit GS1 add-ons */ ScannerQRCode_ADDON5 = 1280, /** add-on flag mask. * @deprecated in 0.11, GS1 add-ons are represented using composite * symbols of type ::ScannerQRCode_COMPOSITE; add-on components use ::ScannerQRCode_EAN2 * or ::ScannerQRCode_EAN5 */ ScannerQRCode_ADDON = 1792 } export declare enum ScannerQRCodeConfigType { ScannerQRCode_CFG_ENABLE = 0,/**< enable symbology/feature */ ScannerQRCode_CFG_ADD_CHECK = /**< enable check digit when optional */ 1,/**< enable check digit when optional */ ScannerQRCode_CFG_EMIT_CHECK = /**< return check digit when present */ 2,/**< return check digit when present */ ScannerQRCode_CFG_ASCII = /**< enable full ASCII character set */ 3,/**< enable full ASCII character set */ ScannerQRCode_CFG_BINARY = /**< don't convert binary data to text */ 4,/**< don't convert binary data to text */ ScannerQRCode_CFG_NUM = /**< number of boolean decoder configs */ 5,/**< number of boolean decoder configs */ ScannerQRCode_CFG_MIN_LEN = 32,/**< minimum data length for valid decode */ ScannerQRCode_CFG_MAX_LEN = /**< maximum data length for valid decode */ 33,/**< maximum data length for valid decode */ ScannerQRCode_CFG_UNCERTAINTY = 64,/**< required video consistency frames */ ScannerQRCode_CFG_POSITION = 128,/**< enable scanner to collect position data */ ScannerQRCode_CFG_TEST_INVERTED = /**< if fails to decode, test inverted */ 129,/**< if fails to decode, test inverted */ ScannerQRCode_CFG_X_DENSITY = 256,/**< image scanner vertical scan density */ ScannerQRCode_CFG_Y_DENSITY = /**< image scanner horizontal scan density */ 257 } export declare enum ScannerQRCodeOrientation { ScannerQRCode_ORIENT_UNKNOWN = -1,/**< unable to determine orientation */ ScannerQRCode_ORIENT_UP = /**< upright, read left to right */ 0,/**< upright, read left to right */ ScannerQRCode_ORIENT_RIGHT = /**< sideways, read top to bottom */ 1,/**< sideways, read top to bottom */ ScannerQRCode_ORIENT_DOWN = /**< upside-down, read right to left */ 2,/**< upside-down, read right to left */ ScannerQRCode_ORIENT_LEFT = /**< sideways, read bottom to top */ 3 } export declare class ScannerQRCodeResult { type: ScannerQRCodeSymbolType; typeName: string; data: Int8Array; points: Array<ScannerQRCodePoint>; orientation: ScannerQRCodeOrientation; time: number; cacheCount: number; quality: number; value: string; private constructor(); static createSymbolsFromPtr(ptr: number, buf: ArrayBuffer): Array<ScannerQRCodeResult>; decode(encoding?: string): string; }