MAIDR JavaScript API
    Preparing search index...

    Class DotPackAbstract

    Packs pin buffers and braille cells into the hex payloads a DotPad expects.

    The device uses two different bit orders, one per display mode, and they are not interchangeable:

    • Graphic mode numbers the bits by physical pin position within a cell — the low nibble is the left column top-to-bottom, the high nibble is the right column top-to-bottom.
    • Text mode uses the standard braille dot order that Unicode's Braille Patterns block encodes, where bit 0 is dot 1 and bit 7 is dot 8.

    The two differ by a permutation of bits 0x08, 0x10, 0x20 and 0x40, so a payload packed for one mode is silently wrong in the other. They are kept as separate functions here, with separate tests, rather than as one function with a mode flag.

    Index

    Properties

    PINS_PER_CELL_X: 2

    Pins across a single braille cell.

    PINS_PER_CELL_Y: 4

    Pins down a single braille cell.

    Methods

    • Packs a pin buffer into a graphic-mode hex payload.

      Cells are emitted in row-major order — the full top row of cells left to right, then the next row down — which is the order the device scans them. A raster larger than the cell grid is cropped; a smaller one is padded with lowered pins, so a caller may hand over a buffer sized for a different DotPad model without the payload length changing.

      Parameters

      • raster: DotRaster

        The pin buffer to pack

      • cellColumns: number

        Cells across the device's graphic area

      • cellRows: number

        Cells down the device's graphic area

      Returns string

      Hex string of cellColumns * cellRows bytes

    • Packs one row of cells from a pin buffer, for a single-line update.

      Repainting one row instead of the whole frame keeps the device's acknowledgement chain to a single line, which matters because a full frame costs a second or more and the user is pressing arrow keys faster than that.

      Parameters

      • raster: DotRaster

        The pin buffer to read from

      • cellRow: number

        Zero-based cell row to pack

      • cellColumns: number

        Cells across the device's graphic area

      Returns string

      Hex string of cellColumns bytes

    • Reports which cell rows differ between two pin buffers, so only those rows need transmitting.

      Parameters

      • previous: DotRaster

        The frame currently on the device

      • next: DotRaster

        The frame to display

      • cellRows: number

        Cells down the device's graphic area

      Returns number[]

      Ascending list of zero-based cell rows that changed

    • Packs braille cells given as dot bit patterns into a text-mode hex payload.

      Parameters

      • cells: readonly number[]

        One byte per cell, bit 0 being dot 1

      • cellCount: number

        Cells on the device's text line; the input is cropped or padded with blanks to this length

      Returns string