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

    Interface BoksTransport

    Interface abstracting the underlying BLE transport layer. Allows the BoksClient to be agnostic of the environment (Web Bluetooth, Cordova, Node.js, etc.).

    interface BoksTransport {
        connect(): Promise<void>;
        disconnect(): Promise<void>;
        read(uuid: string): Promise<Uint8Array<ArrayBufferLike>>;
        subscribe(callback: (data: Uint8Array) => void): Promise<void>;
        subscribeTo(
            uuid: string,
            callback: (data: Uint8Array) => void,
        ): Promise<void>;
        write(data: Uint8Array): Promise<void>;
    }

    Implemented by

    Index

    Methods

    • Reads data from a specific characteristic.

      Parameters

      • uuid: string

        The characteristic UUID to read.

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Subscribes to notifications from the Boks device (Notify Characteristic).

      Parameters

      • callback: (data: Uint8Array) => void

        Function called when data is received.

      Returns Promise<void>

    • Subscribes to notifications from a specific characteristic.

      Parameters

      • uuid: string

        The characteristic UUID to subscribe to.

      • callback: (data: Uint8Array) => void

        Function called when data is received.

      Returns Promise<void>

    • Sends data to the Boks device (Write Characteristic).

      Parameters

      • data: Uint8Array

        The raw bytes to send.

      Returns Promise<void>