NiimBlueLib Docs
    Preparing search index...

    Class NiimbotVirtualClient

    Virtual device, uses hex dump to simulate packet exchange.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    debug: boolean = false
    heartbeatData: HeartbeatData = {}
    mutex: Mutex = ...
    packetIntervalMs: number = NIIMBOT_CLIENT_DEFAULTS.packetIntervalMs
    printerInfo: PrinterInfo = ...
    protocol: NiimbotProtocol
    rfidInfo: CombinedRfidInfo = {}
    prefixed: string | boolean

    Methods

    • Send "connect" packet and fetch the protocol version.

      Returns Promise<void>

    • Disconnect from printer port.

      Returns Promise<void>

    • Determine print task version if any.

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

    • Dump example (case and spaces are ignored):

      >> 03 5555 c1 01 01 c1 aaaa
      << 5555 c2 01 02 c1 aaaa
      >> 5555 40 01 08 49 aaaa (packet comment)
      << 5555 48 02 0900 43 aaaa
      >> 5555 40 01 0c 4d aaaa
      << 5555 4c 02 051e 55 aaaa
      >> 5555 40 01 09 48 aaaa
      << 5555 49 02 051e 50 aaaa
      >> 5555 84 03 00c827 68 aaaa
      << NA
      >> 5555 85 *
      << NA

      Parameters

      • hex: string

      Returns void

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

      Parameters

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

        Bytes to process.

      Returns void

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

      Parameters

      • Optionalevent: keyof ClientEventMap

      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>

    • Enable some debug information logging.

      Parameters

      • value: boolean

      Returns void

    • Set max failed heartbeat attempts to disconnect. Use 0 to disable.

      Parameters

      • value: number

      Returns void

    • Set the interval between packets in milliseconds.

      Parameters

      • milliseconds: number

      Returns void

    • Stops the heartbeat by clearing the interval timer.

      Returns void