v130 · device

Web Serial: connected attribute and RFCOMM connection events

This feature adds a boolean SerialPort.connected attribute. The attribute is true if the serial port is logically connected. For wired serial ports, a port is logically connected if the port is physically attached to the system. For wireless serial ports, a port is logically connected if the device hosting the port has any open connections to the host. Pr

concepts

  1. SerialPort probe

    Probes the SerialPort interface for the new connected attribute and registers connect / disconnect listeners against a real port from navigator.serial.requestPort().

  2. Reconnect policy decision tree

    The chromestatus motivation by name: re-open after range loss, but NOT after a user-initiated disconnect. Six real-world scenarios (range loss, system disconnect, battery die, cable unplug, permission revoke, page reload) each with the correct policy under the new event model.

  3. State-machine debugger

    Drive a real granted serial port through permission, open, reader-lock, and close states. The event ticker records browser connect / disconnect events with the current port.connected value.

  4. RFCOMM Device Explorer

    List real granted serial ports, inspect SerialPort.connected, and watch live connect / disconnect events from navigator.serial.

why it shipped

A wireless serial port opened by an application is closed when the wireless device moves out of range of the host. In this scenario, the application that opened the wireless serial port may attempt to re-open it. However, if the wireless device was disconnected intentionally (for instance, if the user disconnected the device from the system control panel) then the application should avoid re-opening the port in order to prevent reconnecting to the device.

references