NiimBlueLib Docs
    Preparing search index...

    Class NiimbotAbstractClientAbstract

    Abstract class representing a client with common functionality for interacting with a printer. Hardware interface must be defined after extending this class.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    abstraction: Abstraction
    debug: boolean = false
    info: PrinterInfo = {}
    mutex: Mutex = ...
    packetIntervalMs: number = 1000
    prefixed: string | boolean

    Methods

    • Type Parameters

      Parameters

      Returns this

    • Return an array listing the events for which the emitter has registered listeners.

      Returns (keyof ClientEventMap)[]

    • Determine print task version if any.

      Returns undefined | "B1" | "D110" | "D11_V1" | "B21_V1" | "D110M_V4"

    • Return the number of listeners listening to a given event.

      Parameters

      Returns number

    • Return the listeners registered for a given event.

      Type Parameters

      Parameters

      • event: T

      Returns (
          (
              ...args: ArgumentMap<ClientEventMap>[Extract<T, keyof ClientEventMap>],
          ) => void
      )[]

    • Type Parameters

      Parameters

      Returns this

    • Add a listener for a given event.

      Type Parameters

      Parameters

      Returns this

    • Add a one-time listener for a given event.

      Type Parameters

      Parameters

      Returns this

    • Convert raw bytes to packet objects and fire events. Defragmentation included.

      Parameters

      • data: DataView<ArrayBufferLike> | Uint8Array<ArrayBufferLike>

        Bytes to process.

      Returns void

    • Remove all listeners, or those of the specified event.

      Parameters

      • Optionalevent: keyof ClientEventMap

      Returns this

    • Remove the listeners of a given event.

      Type Parameters

      Parameters

      Returns this

    • Send raw bytes to the printer port.

      Parameters

      • data: Uint8Array

        Bytes to send.

      • Optionalforce: boolean

        Ignore mutex lock. It used internally and you should avoid using it.

      Returns Promise<void>

    • Set the interval between packets in milliseconds.

      Parameters

      • milliseconds: number

      Returns void