Options
All
  • Public
  • Public/Protected
  • All
Menu

It represents a USB comm at the client side.

Hierarchy

  • USBComm

Index

Constructors

  • new USBComm(devicePath: string): USBComm
  • Creates an instance of the USBComm class wiht the specified information.

    Parameters

    • devicePath: string

      The USB device path. Use JSPM.JSPrintManager.getUsbDevices() to get it if unkown.

    Returns USBComm

Accessors

  • get receiveBufferSize(): number
  • set receiveBufferSize(value: number): void
  • Gets or sets the size of the receive buffer, in bytes. Default value is 1024

    Returns number

  • Gets or sets the size of the receive buffer, in bytes. Default value is 1024

    Parameters

    • value: number

    Returns void

Methods

  • close(): void
  • Closes the USB connection

    Returns void

  • connect(): Promise<unknown>
  • Connects to a USB device using the specified path.

    Returns Promise<unknown>

  • onClose(data: any): void
  • Occurs when communication is close.

    Parameters

    • data: any

      The callback function

    Returns void

  • onDataReceived(data: any): void
  • Occurs when data is received.

    Parameters

    • data: any

      The callback function

    Returns void

  • onError(data: any, critical: any): void
  • Occurs when an error is thrown.

    Parameters

    • data: any

      The callback function

    • critical: any

    Returns void

  • propertiesJSON(): { type: string }
  • Returns { type: string }

    • type: string
  • send(utf8string: string): void
  • Sends the specified string to the USB device.

    Parameters

    • utf8string: string

      The string to send to the USB device.

    Returns void