Boks SDK Documentation - v0.0.11
    Preparing search index...

    Class BoksClient

    High-level client for interacting with a Boks device. Focuses on protocol orchestration and transport abstraction.

    Index

    Constructors

    Methods

    • Connects to the Boks device and sets up notification listeners.

      Returns Promise<void>

    • Fetches the full history from the Boks device using the transaction model.

      Parameters

      • timeoutMs: number = 2000

        Timeout between two history packets.

      Returns Promise<BoksHistoryEvent[]>

      Array of history events.

    • Reads the current battery level (standard Bluetooth characteristic).

      Returns Promise<number | undefined>

      Battery level (0-100) or undefined if unreliable.

    • Subscribes to all incoming packets.

      Parameters

      • callback: (packet: BoksPacket) => void

        Function called for every parsed packet received.

      Returns () => void

      A function to unsubscribe.

    • Reads data from a specific BLE characteristic.

      Parameters

      • uuid: string

        The UUID of the characteristic to read.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      The raw data as a Uint8Array.