Port accepted by IDFMonitor. Web Serial SerialPort and esptool-js WebUSBSerialPort both satisfy this shape.

interface MonitorPort {
    readable: null | ReadableStream<Uint8Array>;
    writable: null | WritableStream<Uint8Array>;
    close(): Promise<void>;
    getInfo(): SerialPortInfo;
    open(options): Promise<void>;
    setSignals(signals): Promise<void>;
}

Properties

readable: null | ReadableStream<Uint8Array>

Byte stream from the device. null while the port is closed.

writable: null | WritableStream<Uint8Array>

Byte stream to the device. null while the port is closed.

Methods

  • Close the port and release the device.

    Returns Promise<void>

    Resolves when the port is closed.

  • USB identity, when the browser exposes it.

    Returns SerialPortInfo

    Vendor and product ids, possibly empty.

  • Open the port.

    Parameters

    • options: {
          baudRate: number;
      }

      Serial options. Only baudRate is required.

      • baudRate: number

    Returns Promise<void>

    Resolves when the port is open.

  • Set DTR and RTS. true is asserted, which the auto-reset circuit treats as pin-low.

    Parameters

    • signals: SerialOutputSignals

      Line states to apply.

    Returns Promise<void>

    Resolves when the control transfer finishes.