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| Member | Args | Kind | Description |
|---|---|---|---|
open() | 0 | method | Opens the port. |
close() | 0 | method | Closes the port. |
getInfo() | 0 | method | Returns port info (vendor/product, etc.). |
getSignals() | 0 | method | Reads control signals (CTS/DSR/DCD/RI). |
setSignals(signals) | 1 | method | Sets control signals (DTR/RTS/BRK). |
read(dest) | 1 | method | Reads bytes into a buffer. |
write(data) | 1 | method | Writes bytes. |
drain() | 0 | method | Waits until pending output is transmitted. |
flush() | 0 | method | Discards buffered input/output. |
fd | — | getter | Underlying file descriptor. |
name | — | getter | Device name. |
transport | — | getter | Transport identifier. |
description | — | getter | Human-readable description. |
inputWaiting | — | getter | Bytes available to read. |
outputWaiting | — | getter | Bytes pending to write. |
Serial
Static-only namespace object.
| Function | Args | Description |
|---|---|---|
getPorts() | 0 | Enumerates available serial ports. |
requestPort(filter) | 1 | Selects a port matching filter. |
SerialError
Error subclass (name = "SerialError") raised on serial I/O failures.
Export list
Generated by utilities/doc-api.js from the serial dump of utilities/api-surface.sh: 40 members. Edit the text above this block, not the block.
Serial
object
- static methods:
getPorts(),requestPort()
SerialError
class, constructible
- properties:
name,type = 0,[Symbol.toStringTag]
SerialPort
class, constructible
- static methods:
list() - static values:
BUF_BOTH = 3,BUF_INPUT = 1,BUF_OUTPUT = 2,ERR_ARG = -1,ERR_FAIL = -2,ERR_MEM = -3,ERR_SUPP = -4,MODE_READ = 1,MODE_READ_WRITE = 3,MODE_WRITE = 2 - methods:
close(),drain(),flush(),getInfo(),getSignals(),open(),read(),setSignals(),write() - properties:
description (get),fd (get),inputWaiting (get),name (get),outputWaiting (get),transport (get),[Symbol.toStringTag]
default
object
- static methods:
getPorts(),requestPort()