{ } qjs-modules

serial

Source: quickjs-serial.c — module exports Serial, SerialPort, SerialError

Serial-port access (Web Serial-flavored API over POSIX termios).

SerialPort

new SerialPort([path, options])   // length 1
MemberArgsKindDescription
open()0methodOpens the port.
close()0methodCloses the port.
getInfo()0methodReturns port info (vendor/product, etc.).
getSignals()0methodReads control signals (CTS/DSR/DCD/RI).
setSignals(signals)1methodSets control signals (DTR/RTS/BRK).
read(dest)1methodReads bytes into a buffer.
write(data)1methodWrites bytes.
drain()0methodWaits until pending output is transmitted.
flush()0methodDiscards buffered input/output.
fd—getterUnderlying file descriptor.
name—getterDevice name.
transport—getterTransport identifier.
description—getterHuman-readable description.
inputWaiting—getterBytes available to read.
outputWaiting—getterBytes pending to write.

Serial

Static-only namespace object.

FunctionArgsDescription
getPorts()0Enumerates available serial ports.
requestPort(filter)1Selects a port matching filter.

SerialError

Error subclass (name = "SerialError") raised on serial I/O failures.