Result.d.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import ResultPoint from './ResultPoint';
  2. import BarcodeFormat from './BarcodeFormat';
  3. import ResultMetadataType from './ResultMetadataType';
  4. /**
  5. * <p>Encapsulates the result of decoding a barcode within an image.</p>
  6. *
  7. * @author Sean Owen
  8. */
  9. export default class Result {
  10. private text;
  11. private rawBytes;
  12. private numBits;
  13. private resultPoints;
  14. private format;
  15. private timestamp;
  16. private resultMetadata;
  17. constructor(text: string, rawBytes: Uint8Array, numBits: number, resultPoints: ResultPoint[], format: BarcodeFormat, timestamp?: number);
  18. /**
  19. * @return raw text encoded by the barcode
  20. */
  21. getText(): string;
  22. /**
  23. * @return raw bytes encoded by the barcode, if applicable, otherwise {@code null}
  24. */
  25. getRawBytes(): Uint8Array;
  26. /**
  27. * @return how many bits of {@link #getRawBytes()} are valid; typically 8 times its length
  28. * @since 3.3.0
  29. */
  30. getNumBits(): number;
  31. /**
  32. * @return points related to the barcode in the image. These are typically points
  33. * identifying finder patterns or the corners of the barcode. The exact meaning is
  34. * specific to the type of barcode that was decoded.
  35. */
  36. getResultPoints(): Array<ResultPoint>;
  37. /**
  38. * @return {@link BarcodeFormat} representing the format of the barcode that was decoded
  39. */
  40. getBarcodeFormat(): BarcodeFormat;
  41. /**
  42. * @return {@link Map} mapping {@link ResultMetadataType} keys to values. May be
  43. * {@code null}. This contains optional metadata about what was detected about the barcode,
  44. * like orientation.
  45. */
  46. getResultMetadata(): Map<ResultMetadataType, Object>;
  47. putMetadata(type: ResultMetadataType, value: Object): void;
  48. putAllMetadata(metadata: Map<ResultMetadataType, Object>): void;
  49. addResultPoints(newPoints: Array<ResultPoint>): void;
  50. getTimestamp(): number;
  51. toString(): string;
  52. }