Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Dedicated Web Workers.
The setSignals() method of the SerialPort interface sets control signals on the port and returns a Promise that resolves when they are set.
setSignals()
setSignals(options)options OptionalAn object with any of the following values:
dataTerminalReadyA boolean indicating whether to invoke the operating system to either assert (if true) or de-assert (if false) the "data terminal ready" or "DTR" signal on the serial port.
requestToSendA boolean indicating whether to invoke the operating system to either assert (if true) or de-assert (if false) the "request to send" or "RTS" signal on the serial port.
breakA boolean indicating whether to invoke the operating system to either assert (if true) or de-assert (if false) the "break" signal on the serial port.
A Promise.
The returned Promise rejects with one of the following exceptions:
InvalidStateError DOMExceptionIf setSignals() is called when the port is not open. Call SerialPort.open() to open the port first.
NetworkError DOMExceptionIf the signals on the device could not be set.
The following example asserts the DTR signal when a connection is established.
await port.open({ baudRate: 9600 });
await port.setSignals({ dataTerminalReady: true });