MAIDR JavaScript API
    Preparing search index...

    Interface TactileDisplayDriver

    What MAIDR needs from the connection to one kind of tactile display.

    Each kind of device is reached its own way -- a DotPad through its vendor's SDK over Web Bluetooth or Web Serial, a Monarch through WebHID -- and each driver hides that behind this one surface, so the tactile service and the Settings dialog work the same whichever the reader has.

    The graphic payloads are a DotPad's: cells of two pins by four, packed by DotPack.graphic. A driver for a display laid out differently unpacks them into its own pins.

    interface TactileDisplayDriver {
        transports: readonly DotPadTransport[];
        current: DotPadState;
        isConnected: boolean;
        geometry: DotPadGeometry | null;
        canTranslate: boolean;
        breaksTextAtWords: boolean;
        isSupported: boolean;
        onStateChange: Event<DotPadState>;
        onWriteFailure: Event<void>;
        onKey: Event<DotPadKey>;
        supports: (transport: DotPadTransport) => boolean;
        preload: () => Promise<void>;
        connect: (transport: DotPadTransport) => Promise<DotPadState>;
        adopt: () => Promise<boolean>;
        disconnect: () => void;
        translate: (text: string) => Promise<string | null>;
        writeGraphic: (hex: string) => void;
        writeGraphicRow: (cellRow: number, hex: string) => void;
        writeText: (hex: string) => void;
        vibrate: (onFailure?: () => void) => boolean;
    }
    Index

    Properties

    transports: readonly DotPadTransport[]

    The transports this driver connects over, in the order Settings offers them.

    current: DotPadState

    Current connection state.

    isConnected: boolean

    True when a device is connected and ready for output.

    geometry: DotPadGeometry | null

    Layout of the connected device, or null.

    canTranslate: boolean

    True when the text line can be translated into contracted braille.

    breaksTextAtWords: boolean

    True when the text line is broken between words, so a scroll never lands in the middle of one; false when it is cut every so many cells.

    isSupported: boolean

    True when this browser can reach the device over any of its transports.

    onStateChange: Event<DotPadState>

    Fires whenever the connection state changes.

    onWriteFailure: Event<void>

    Fires when a write was refused before it reached the device.

    Fires when a hardware key MAIDR responds to is pressed.

    supports: (transport: DotPadTransport) => boolean

    Reports whether the browser can reach the device over one transport.

    Type Declaration

    preload: () => Promise<void>

    Fetches anything a connect attempt would otherwise wait on.

    connect: (transport: DotPadTransport) => Promise<DotPadState>

    Opens the browser's device picker and connects to the chosen display. Called from a user gesture; returns rather than throws.

    Type Declaration

    adopt: () => Promise<boolean>

    Connects to a display the page was already granted, without a picker, quietly.

    Type Declaration

      • (): Promise<boolean>
      • Returns Promise<boolean>

        True when a display was taken up

    disconnect: () => void

    Closes the connection.

    translate: (text: string) => Promise<string | null>

    Translates text into contracted braille cells, or null when the caller should fall back to MAIDR's own table.

    Type Declaration

      • (text: string): Promise<string | null>
      • Parameters

        • text: string

          The text to translate

        Returns Promise<string | null>

    writeGraphic: (hex: string) => void

    Sends a whole graphic frame.

    Type Declaration

      • (hex: string): void
      • Parameters

        • hex: string

          cellColumns * cellRows cells, as DotPack.graphic packs them

        Returns void

    writeGraphicRow: (cellRow: number, hex: string) => void

    Sends one row of cells of the graphic area.

    Type Declaration

      • (cellRow: number, hex: string): void
      • Parameters

        • cellRow: number

          Zero-based cell row

        • hex: string

          cellColumns cells, as DotPack.graphicRow packs them

        Returns void

    writeText: (hex: string) => void

    Sends the braille text line.

    Type Declaration

      • (hex: string): void
      • Parameters

        • hex: string

          textCells cells, bit 0 being dot 1

        Returns void

    vibrate: (onFailure?: () => void) => boolean

    Buzzes the device to say the reader has reached an edge.

    Type Declaration

      • (onFailure?: () => void): boolean
      • Parameters

        • OptionalonFailure: () => void

          Called when the device refused after the request was queued

        Returns boolean

        False when the device cannot vibrate, so the caller says it instead