FIT Parser - v6.2.7
    Preparing search index...

    Class FitEncoder

    A generic FIT binary encoder. Callers supply profile-specific field definitions and already-scaled field values. Numeric arrays, strings, and variable-length field values are supplied as raw Uint8Array values.

    Index
    • Returns a new FIT byte array containing the current messages, header and CRCs.

      Returns Uint8Array

    • Writes a definition when needed, then one message using the supplied raw values. The encoder does not derive fields from decoded objects or apply profile scales.

      Parameters

      • globalMessageNumber: number

        FIT global message number (0–65535).

      • fields: FitEncoderField[]

        Native field definitions and already-scaled values.

      • localMessageNumber: number = 0

        Local definition slot (0–15); defaults to zero.

      Returns this

      This encoder, for chaining.

      TypeError or RangeError for invalid definitions or values, before appending a partial message.

    • Computes the FIT CRC-16 for the supplied byte values.

      Parameters

      • bytes: ArrayLike<number>

      Returns number

    • Encodes UTF-8 with a terminating NUL byte. Use the returned byteLength as the field size.

      Parameters

      • value: string

      Returns Uint8Array

    • Converts a Date to whole native FIT seconds; rejects invalid dates and values outside the uint32 range.

      Parameters

      • date: Date

      Returns number