Data layer for encoding and decoding payloads class. This class utilizes BCH codes for error correction.

Constructors

  • Initializes the DataLayer with specified parameters.

    Parameters

    • payload_len: number

      The length of the payload in bits.

    • verbose: boolean

      Flag to indicate if messages should be logged.

    • encoding_mode: number

      The encoding mode to be used (default is 0).

    Returns DataLayer

Properties

bch_decoders: Record<number, BCH>
bch_encoder: BCH
encoding_mode: number
payload_len: number
versionbits: number

Methods

  • Builds and returns a BCH instance based on the given encoding mode.

    Parameters

    • encoding_mode: number

      The encoding mode.

    Returns BCH

    A BCH instance configured for the specified encoding mode.

  • Encodes a string to a Float32Array using 7-bit ASCII encoding.

    Parameters

    • text: string

      The input text string.

    Returns Float32Array

    • The encoded Float32Array.
  • Encodes a binary string into a Float32Array with the ECC encoding.

    Parameters

    • strbin: string

      The input binary string.

    Returns Float32Array

    • The encoded Float32Array with the ECC encoding.
  • Processes and encodes the packet data.

    Parameters

    • packet_d: string

      The binary string representation of the packet data.

    Returns Float32Array

    • The encoded Float32Array.
  • Encodes a text string into a Float32Array with the ECC encoding.

    Parameters

    • text: string

      The input text string.

    Returns Float32Array

    • The encoded Float32Array.