import type { BarcodeSymbology, ReadOutputBarcodeFormat } from "./barcodeFormat.js"; import type { BarcodeSymbol } from "./barcodeSymbol.js"; import { type ContentType } from "./contentType.js"; import type { EcLevel } from "./ecLevel.js"; import type { Position, ZXingPosition } from "./position.js"; /** * @internal */ export interface ZXingReadResult { /** * Whether the barcode is valid. */ isValid: boolean; /** * Error message (if any). * * @see {@link ReaderOptions.returnErrors | `ReaderOptions.returnErrors`} */ error: string; /** * @internal */ format: string; /** * @internal */ symbology: string; /** * Raw / Standard content without any modifications like character set conversions. */ bytes: Uint8Array; /** * Raw / Standard content following the ECI protocol. */ bytesECI: Uint8Array; /** * The {@link ReadResult.bytes | `ReadResult.bytes`} content rendered to unicode / utf8 text * according to specified {@link ReaderOptions.textMode | `ReaderOptions.textMode`}. */ text: string; /** * @internal */ contentType: number; /** * Whether or not an ECI tag was found. */ hasECI: boolean; /** * @internal */ position: ZXingPosition; /** * Orientation of the barcode in degree. */ orientation: number; /** * Whether the symbol is mirrored (currently only supported by QRCode and DataMatrix). */ isMirrored: boolean; /** * Whether the symbol is inverted / has reversed reflectance. * * @see {@link ReaderOptions.tryInvert | `ReaderOptions.tryInvert`} */ isInverted: boolean; /** * Symbology identifier `"]cm"` where `"c"` is the symbology code character, `"m"` the modifier. */ symbologyIdentifier: string; /** * Number of symbols in a structured append sequence. * * If this is not part of a structured append sequence, the returned value is `-1`. * If it is a structured append symbol but the total number of symbols is unknown, the * returned value is `0` (see PDF417 if optional "Segment Count" not given). */ sequenceSize: number; /** * The `0`-based index of this symbol in a structured append sequence. */ sequenceIndex: number; /** * ID to check if a set of symbols belongs to the same structured append sequence. * * If the symbology does not support this feature, the returned value is empty (see MaxiCode). * For QR Code, this is the parity integer converted to a string. * For PDF417 and DataMatrix, this is the `"fileId"`. */ sequenceId: string; /** * Number of lines that have been detected with this code (applies only to linear symbologies). */ lineCount: number; /** * Barcode symbol in the shape of a one-channel image. * * @experimental The final form of this property is not yet settled and may change without a major version bump. */ symbol: BarcodeSymbol; /** * A stringified JSON object containing additional information about the barcode. * * @experimental The final form of this property is not yet settled and may change without a major version bump. */ extra: string; /** * QRCode / DataMatrix / Aztec version or size. * * @deprecated Parse the result from {@link ReadResult.extra | `ReadResult.extra`} instead. */ version: string; /** * Set if this is the reader initialisation / programming symbol. * * @deprecated Parse the result from {@link ReadResult.extra | `ReadResult.extra`} instead. */ readerInit: boolean; /** * Error correction level of the symbol (empty string if not applicable). * * @deprecated Parse the result from {@link ReadResult.extra | `ReadResult.extra`} instead. */ ecLevel: EcLevel; } /** * Result of reading a barcode. */ export interface ReadResult extends Omit { /** * Canonical format name of the barcode. * * Values are constrained by {@link ReadOutputBarcodeFormat | `ReadOutputBarcodeFormat`} * (plus `"None"` for empty/invalid results) and come from the C++ wrapper in canonical enum-name form * (not alias or HRI label form). */ format: ReadOutputBarcodeFormat; /** * Symbology group / base barcode family of {@link ReadResult.format | `ReadResult.format`}. * * Example: `EAN13` -> `EANUPC`, `MicroQRCode` -> `QRCode`, `Code39Ext` -> `Code39`. */ symbology: BarcodeSymbology; /** * A hint to the type of the content found. */ contentType: ContentType; /** * Position of the detected barcode. */ position: Position; } /** * Converts a ZXing read result to a standardized read result format. * * @param zxingReadResult - The raw result from ZXing barcode reader * @returns A normalized read result with decoded format and content type */ export declare function zxingReadResultToReadResult(zxingReadResult: ZXingReadResult): ReadResult;