serial.idl (2385B)
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] 7 partial interface Navigator { 8 [SameObject] readonly attribute Serial serial; 9 }; 10 11 [Exposed=DedicatedWorker, SecureContext] 12 partial interface WorkerNavigator { 13 [SameObject] readonly attribute Serial serial; 14 }; 15 16 [Exposed=(DedicatedWorker, Window), SecureContext] 17 interface 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 24 dictionary SerialPortRequestOptions { 25 sequence<SerialPortFilter> filters; 26 sequence<BluetoothServiceUUID> allowedBluetoothServiceClassIds; 27 }; 28 29 dictionary SerialPortFilter { 30 unsigned short usbVendorId; 31 unsigned short usbProductId; 32 BluetoothServiceUUID bluetoothServiceClassId; 33 }; 34 35 [Exposed=(DedicatedWorker,Window), SecureContext] 36 interface SerialPort : EventTarget { 37 attribute EventHandler onconnect; 38 attribute EventHandler ondisconnect; 39 readonly attribute boolean connected; 40 readonly attribute ReadableStream readable; 41 readonly attribute WritableStream writable; 42 43 SerialPortInfo getInfo(); 44 45 Promise<undefined> open(SerialOptions options); 46 Promise<undefined> setSignals(optional SerialOutputSignals signals = {}); 47 Promise<SerialInputSignals> getSignals(); 48 Promise<undefined> close(); 49 Promise<undefined> forget(); 50 }; 51 52 dictionary SerialPortInfo { 53 unsigned short usbVendorId; 54 unsigned short usbProductId; 55 BluetoothServiceUUID bluetoothServiceClassId; 56 }; 57 58 dictionary SerialOptions { 59 [EnforceRange] required unsigned long baudRate; 60 [EnforceRange] octet dataBits = 8; 61 [EnforceRange] octet stopBits = 1; 62 ParityType parity = "none"; 63 [EnforceRange] unsigned long bufferSize = 255; 64 FlowControlType flowControl = "none"; 65 }; 66 67 enum ParityType { 68 "none", 69 "even", 70 "odd" 71 }; 72 73 enum FlowControlType { 74 "none", 75 "hardware" 76 }; 77 78 dictionary SerialOutputSignals { 79 boolean dataTerminalReady; 80 boolean requestToSend; 81 boolean break; 82 }; 83 84 dictionary SerialInputSignals { 85 required boolean dataCarrierDetect; 86 required boolean clearToSend; 87 required boolean ringIndicator; 88 required boolean dataSetReady; 89 };