Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MspDataView

Helpful custom DataView class with extra methods.

Adapted from: https://github.com/betaflight/betaflight-configurator/src/js/injected_methods.js

Hierarchy

  • DataView
    • MspDataView

Index

Constructors

constructor

  • new MspDataView(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): MspDataView
  • Parameters

    • buffer: ArrayBufferLike
    • Optional byteOffset: number
    • Optional byteLength: number

    Returns MspDataView

Properties

Readonly [toStringTag]

[toStringTag]: string

Readonly buffer

buffer: ArrayBuffer

Readonly byteLength

byteLength: number

Readonly byteOffset

byteOffset: number

offset

offset: number = 0

Methods

getBigInt64

  • getBigInt64(byteOffset: number, littleEndian?: boolean): bigint
  • Gets the BigInt64 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be retrieved.

    • Optional littleEndian: boolean

    Returns bigint

getBigUint64

  • getBigUint64(byteOffset: number, littleEndian?: boolean): bigint
  • Gets the BigUint64 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be retrieved.

    • Optional littleEndian: boolean

    Returns bigint

getFloat32

  • getFloat32(byteOffset: number, littleEndian?: boolean): number
  • Gets the Float32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be retrieved.

    • Optional littleEndian: boolean

    Returns number

getFloat64

  • getFloat64(byteOffset: number, littleEndian?: boolean): number
  • Gets the Float64 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be retrieved.

    • Optional littleEndian: boolean

    Returns number

getInt16

  • getInt16(byteOffset: number, littleEndian?: boolean): number
  • Gets the Int16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be retrieved.

    • Optional littleEndian: boolean

    Returns number

getInt32

  • getInt32(byteOffset: number, littleEndian?: boolean): number
  • Gets the Int32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be retrieved.

    • Optional littleEndian: boolean

    Returns number

getInt8

  • getInt8(byteOffset: number): number
  • Gets the Int8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be retrieved.

    Returns number

getUint16

  • getUint16(byteOffset: number, littleEndian?: boolean): number
  • Gets the Uint16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be retrieved.

    • Optional littleEndian: boolean

    Returns number

getUint32

  • getUint32(byteOffset: number, littleEndian?: boolean): number
  • Gets the Uint32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be retrieved.

    • Optional littleEndian: boolean

    Returns number

getUint8

  • getUint8(byteOffset: number): number
  • Gets the Uint8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be retrieved.

    Returns number

read16

  • read16(): number

read32

  • read32(): number

read8

  • read8(): number

readU16

  • readU16(): number

readU32

  • readU32(): number

readU8

  • readU8(): number

remaining

  • remaining(): number

setBigInt64

  • setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void
  • Stores a BigInt64 value at the specified byte offset from the start of the view.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be set.

    • value: bigint

      The value to set.

    • Optional littleEndian: boolean

      If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.

    Returns void

setBigUint64

  • setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void
  • Stores a BigUint64 value at the specified byte offset from the start of the view.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be set.

    • value: bigint

      The value to set.

    • Optional littleEndian: boolean

      If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.

    Returns void

setFloat32

  • setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void
  • Stores an Float32 value at the specified byte offset from the start of the view.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be set.

    • value: number

      The value to set.

    • Optional littleEndian: boolean

      If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.

    Returns void

setFloat64

  • setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void
  • Stores an Float64 value at the specified byte offset from the start of the view.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be set.

    • value: number

      The value to set.

    • Optional littleEndian: boolean

      If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.

    Returns void

setInt16

  • setInt16(byteOffset: number, value: number, littleEndian?: boolean): void
  • Stores an Int16 value at the specified byte offset from the start of the view.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be set.

    • value: number

      The value to set.

    • Optional littleEndian: boolean

      If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.

    Returns void

setInt32

  • setInt32(byteOffset: number, value: number, littleEndian?: boolean): void
  • Stores an Int32 value at the specified byte offset from the start of the view.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be set.

    • value: number

      The value to set.

    • Optional littleEndian: boolean

      If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.

    Returns void

setInt8

  • setInt8(byteOffset: number, value: number): void
  • Stores an Int8 value at the specified byte offset from the start of the view.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be set.

    • value: number

      The value to set.

    Returns void

setUint16

  • setUint16(byteOffset: number, value: number, littleEndian?: boolean): void
  • Stores an Uint16 value at the specified byte offset from the start of the view.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be set.

    • value: number

      The value to set.

    • Optional littleEndian: boolean

      If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.

    Returns void

setUint32

  • setUint32(byteOffset: number, value: number, littleEndian?: boolean): void
  • Stores an Uint32 value at the specified byte offset from the start of the view.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be set.

    • value: number

      The value to set.

    • Optional littleEndian: boolean

      If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.

    Returns void

setUint8

  • setUint8(byteOffset: number, value: number): void
  • Stores an Uint8 value at the specified byte offset from the start of the view.

    Parameters

    • byteOffset: number

      The place in the buffer at which the value should be set.

    • value: number

      The value to set.

    Returns void

Static Private error

  • error(): never

Generated using TypeDoc