1// GENERATED CONTENT - DO NOT EDIT
2// Content was automatically extracted by Reffy into webref
3// (https://github.com/w3c/webref)
4// Source: Web Serial API (https://wicg.github.io/serial/)
5
6[Exposed=Window, SecureContext]
7partial interface Navigator {
8  [SameObject] readonly attribute Serial serial;
9};
10
11[Exposed=DedicatedWorker, SecureContext]
12partial interface WorkerNavigator {
13  [SameObject] readonly attribute Serial serial;
14};
15
16[Exposed=(DedicatedWorker, Window), SecureContext]
17interface Serial : EventTarget {
18  attribute EventHandler onconnect;
19  attribute EventHandler ondisconnect;
20  Promise<sequence<SerialPort>> getPorts();
21  [Exposed=Window] Promise<SerialPort> requestPort(optional SerialPortRequestOptions options = {});
22};
23
24dictionary SerialPortRequestOptions {
25  sequence<SerialPortFilter> filters;
26};
27
28dictionary SerialPortFilter {
29  unsigned short usbVendorId;
30  unsigned short usbProductId;
31};
32
33[Exposed=(DedicatedWorker,Window), SecureContext]
34interface SerialPort : EventTarget {
35  attribute EventHandler onconnect;
36  attribute EventHandler ondisconnect;
37  readonly attribute ReadableStream readable;
38  readonly attribute WritableStream writable;
39
40  SerialPortInfo getInfo();
41
42  Promise<undefined> open(SerialOptions options);
43  Promise<undefined> setSignals(optional SerialOutputSignals signals = {});
44  Promise<SerialInputSignals> getSignals();
45  Promise<undefined> close();
46};
47
48dictionary SerialPortInfo {
49  unsigned short usbVendorId;
50  unsigned short usbProductId;
51};
52
53dictionary SerialOptions {
54  required [EnforceRange] unsigned long baudRate;
55  [EnforceRange] octet dataBits = 8;
56  [EnforceRange] octet stopBits = 1;
57  ParityType parity = "none";
58  [EnforceRange] unsigned long bufferSize = 255;
59  FlowControlType flowControl = "none";
60};
61
62enum ParityType {
63  "none",
64  "even",
65  "odd"
66};
67
68enum FlowControlType {
69  "none",
70  "hardware"
71};
72
73dictionary SerialOutputSignals {
74  boolean dataTerminalReady;
75  boolean requestToSend;
76  boolean break;
77};
78
79dictionary SerialInputSignals {
80  required boolean dataCarrierDetect;
81  required boolean clearToSend;
82  required boolean ringIndicator;
83  required boolean dataSetReady;
84};
85