ais-nmea-decoder
    Preparing search index...

    Class PayloadBits

    Index

    Constructors

    Properties

    bits: Bit[] = []

    Methods

    • Convert an array of bits (0s and 1s) to an unsigned integer ([1, 0, 1] => 5).

      Parameters

      • bits: Bit[]

        The array of bits to convert.

      Returns number

      The converted integer.

    • Converts AIS "armored ASCII" payload into a flat array of bits. See AIVDM/AIVDO Payload Armoring in the guide for details.

      The data payload is an ASCII-encoded bit vector. Each character represents six bits of data using two ASCII ranges: 6-bit 0-39 → ASCII 48-87 ('0' to 'W') 6-bit 40-63 → ASCII 96-119 ('`' to 'w')

      The gap ASCII 88-95 ('X' to '_') is unused.

      Parameters

      • payload: Uint8Array

        The payload to decode.

      Returns void

    • Extract a boolean (single bit) from the bit array.

      Parameters

      • start: number

        The starting position in the bit array.

      Returns boolean

      The extracted boolean.

    • Extract an integer (signed or unsigned) from the bit array.

      • For unsigned integers, the bits are converted directly to a number.
      • For signed integers, the first bit (MSB) indicates the sign: 0 = positive → convert bits to number as-is 1 = negative → use two's complement to get the negative value

      Parameters

      • start: number

        The starting position in the bit array.

      • length: number

        The number of bits to extract.

      • Optionalsigned: boolean

        Whether the integer is signed.

      Returns number

      The extracted integer.

    • Parameters

      • start: number

      Returns number

    • Parameters

      • start: number

      Returns number

    • Extract a text string from the bit array.

      Parameters

      • start: number

        The starting position in the bit array.

      • Optionallength: number

        The number of bits to extract - if not provided, extracts to end of array.

      Returns string

      The extracted text string.