Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DecodedBitStreamParser

This class contains the methods for decoding the PDF417 codewords.

author

SITA Lab (kevin.osullivan@sita.aero)

author

Guenther Grau

Hierarchy

  • DecodedBitStreamParser

Index

Properties

Static Private AL

AL: int = 28

Static Private AS

AS: int = 27

Static Private BEGIN_MACRO_PDF417_CONTROL_BLOCK

BEGIN_MACRO_PDF417_CONTROL_BLOCK: int = 928

Static Private BEGIN_MACRO_PDF417_OPTIONAL_FIELD

BEGIN_MACRO_PDF417_OPTIONAL_FIELD: int = 923

Static Private BYTE_COMPACTION_MODE_LATCH

BYTE_COMPACTION_MODE_LATCH: int = 901

Static Private BYTE_COMPACTION_MODE_LATCH_6

BYTE_COMPACTION_MODE_LATCH_6: int = 924

Static Private ECI_CHARSET

ECI_CHARSET: int = 927

Static Private ECI_GENERAL_PURPOSE

ECI_GENERAL_PURPOSE: int = 926

Static Private ECI_USER_DEFINED

ECI_USER_DEFINED: int = 925

Static Private EXP900

EXP900: bigint[] = getBigIntConstructor() ? getEXP900() : []

Table containing values for the exponent of 900. This is used in the numeric compaction decode algorithm.

Static Private LL

LL: int = 27

Static Private MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE

MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE: int = 4

Static Private MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM

MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM: int = 6

Static Private MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME

MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME: int = 0

Static Private MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE

MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE: int = 5

Static Private MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT

MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT: int = 1

Static Private MACRO_PDF417_OPTIONAL_FIELD_SENDER

MACRO_PDF417_OPTIONAL_FIELD_SENDER: int = 3

Static Private MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP

MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP: int = 2

Static Private MACRO_PDF417_TERMINATOR

MACRO_PDF417_TERMINATOR: int = 922

Static Private MAX_NUMERIC_CODEWORDS

MAX_NUMERIC_CODEWORDS: int = 15

Static Private MIXED_CHARS

MIXED_CHARS: string = "0123456789& ,:#-.$/+%*=^"

Static Private ML

ML: int = 28

Static Private MODE_SHIFT_TO_BYTE_COMPACTION_MODE

MODE_SHIFT_TO_BYTE_COMPACTION_MODE: int = 913

Static Private NUMBER_OF_SEQUENCE_CODEWORDS

NUMBER_OF_SEQUENCE_CODEWORDS: int = 2

Static Private NUMERIC_COMPACTION_MODE_LATCH

NUMERIC_COMPACTION_MODE_LATCH: int = 902

Static Private PAL

PAL: int = 29

Static Private PL

PL: int = 25

Static Private PS

PS: int = 29

Static Private PUNCT_CHARS

PUNCT_CHARS: string = ";<>@[\]_`~! ,:-.$/"|*()?{}'"

Static Private TEXT_COMPACTION_MODE_LATCH

TEXT_COMPACTION_MODE_LATCH: int = 900

Methods

Static Private byteCompaction

  • Byte Compaction mode (see 5.4.3) permits all 256 possible 8-bit byte values to be encoded. This includes all ASCII characters value 0 to 127 inclusive and provides for international character set support.

    Parameters

    • mode: int

      The byte compaction mode i.e. 901 or 924

    • codewords: Int32Array

      The array of codewords (data + error)

    • encoding: CharacterSetECI

      Currently active character encoding

    • codeIndex: int

      The current index into the codeword array.

    • result: StringBuilder

      The decoded data is appended to the result.

    Returns number

    The next index into the codeword array.

Static decode

Static Private decodeBase900toBase10

  • decodeBase900toBase10(codewords: Int32Array, count: int): string
  • Convert a list of Numeric Compacted codewords from Base 900 to Base 10.

    throws

    FormatException

    Parameters

    • codewords: Int32Array

      The array of codewords

    • count: int

      The number of codewords

    Returns string

    The decoded string representing the Numeric data.

    EXAMPLE Encode the fifteen digit numeric string 000213298174000 Prefix the numeric string with a 1 and set the initial value of t = 1 000 213 298 174 000 Calculate codeword 0 d0 = 1 000 213 298 174 000 mod 900 = 200

    t = 1 000 213 298 174 000 div 900 = 1 111 348 109 082 Calculate codeword 1 d1 = 1 111 348 109 082 mod 900 = 282

    t = 1 111 348 109 082 div 900 = 1 234 831 232 Calculate codeword 2 d2 = 1 234 831 232 mod 900 = 632

    t = 1 234 831 232 div 900 = 1 372 034 Calculate codeword 3 d3 = 1 372 034 mod 900 = 434

    t = 1 372 034 div 900 = 1 524 Calculate codeword 4 d4 = 1 524 mod 900 = 624

    t = 1 524 div 900 = 1 Calculate codeword 5 d5 = 1 mod 900 = 1 t = 1 div 900 = 0 Codeword sequence is: 1, 624, 434, 632, 282, 200

    Decode the above codewords involves 1 x 900 power of 5 + 624 x 900 power of 4 + 434 x 900 power of 3 + 632 x 900 power of 2 + 282 x 900 power of 1 + 200 x 900 power of 0 = 1000213298174000

    Remove leading 1 => Result is 000213298174000

Static decodeMacroBlock

  • decodeMacroBlock(codewords: Int32Array, codeIndex: int, resultMetadata: PDF417ResultMetadata): int

Static Private decodeTextCompaction

  • decodeTextCompaction(textCompactionData: Int32Array, byteCompactionData: Int32Array, length: int, result: StringBuilder): void
  • The Text Compaction mode includes all the printable ASCII characters (i.e. values from 32 to 126) and three ASCII control characters: HT or tab (9: e), LF or line feed (10: e), and CR or carriage return (13: e). The Text Compaction mode also includes various latch and shift characters which are used exclusively within the mode. The Text Compaction mode encodes up to 2 characters per codeword. The compaction rules for converting data into PDF417 codewords are defined in 5.4.2.2. The sub-mode switches are defined in 5.4.2.3.

    Parameters

    • textCompactionData: Int32Array

      The text compaction data.

    • byteCompactionData: Int32Array

      The byte compaction data if there was a mode shift.

    • length: int

      The size of the text compaction and byte compaction data.

    • result: StringBuilder

      The decoded data is appended to the result.

    Returns void

Static Private numericCompaction

  • numericCompaction(codewords: Int32Array, codeIndex: number, result: StringBuilder): int
  • Numeric Compaction mode (see 5.4.4) permits efficient encoding of numeric data strings.

    throws

    FormatException

    Parameters

    • codewords: Int32Array

      The array of codewords (data + error)

    • codeIndex: number

      The current index into the codeword array.

    • result: StringBuilder

      The decoded data is appended to the result.

    Returns int

    The next index into the codeword array.

Static Private textCompaction

  • textCompaction(codewords: Int32Array, codeIndex: int, result: StringBuilder): int
  • Text Compaction mode (see 5.4.1.5) permits all printable ASCII characters to be encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as well as selected control characters.

    Parameters

    • codewords: Int32Array

      The array of codewords (data + error)

    • codeIndex: int

      The current index into the codeword array.

    • result: StringBuilder

      The decoded data is appended to the result.

    Returns int

    The next index into the codeword array.

Generated using TypeDoc