From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/interfaces/webusb.idl | 249 +++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 testing/web-platform/tests/interfaces/webusb.idl (limited to 'testing/web-platform/tests/interfaces/webusb.idl') diff --git a/testing/web-platform/tests/interfaces/webusb.idl b/testing/web-platform/tests/interfaces/webusb.idl new file mode 100644 index 0000000000..fb0a71f307 --- /dev/null +++ b/testing/web-platform/tests/interfaces/webusb.idl @@ -0,0 +1,249 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: WebUSB API (https://wicg.github.io/webusb/) + +dictionary USBDeviceFilter { + unsigned short vendorId; + unsigned short productId; + octet classCode; + octet subclassCode; + octet protocolCode; + DOMString serialNumber; +}; + +dictionary USBDeviceRequestOptions { + required sequence filters; +}; + +[Exposed=(Worker,Window), SecureContext] +interface USB : EventTarget { + attribute EventHandler onconnect; + attribute EventHandler ondisconnect; + Promise> getDevices(); + [Exposed=Window] Promise requestDevice(USBDeviceRequestOptions options); +}; + +[Exposed=Window, SecureContext] +partial interface Navigator { + [SameObject] readonly attribute USB usb; +}; + +[Exposed=Worker, SecureContext] +partial interface WorkerNavigator { + [SameObject] readonly attribute USB usb; +}; + +dictionary USBConnectionEventInit : EventInit { + required USBDevice device; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBConnectionEvent : Event { + constructor(DOMString type, USBConnectionEventInit eventInitDict); + [SameObject] readonly attribute USBDevice device; +}; + +enum USBTransferStatus { + "ok", + "stall", + "babble" +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBInTransferResult { + constructor(USBTransferStatus status, optional DataView? data); + readonly attribute DataView? data; + readonly attribute USBTransferStatus status; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBOutTransferResult { + constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0); + readonly attribute unsigned long bytesWritten; + readonly attribute USBTransferStatus status; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBIsochronousInTransferPacket { + constructor(USBTransferStatus status, optional DataView? data); + readonly attribute DataView? data; + readonly attribute USBTransferStatus status; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBIsochronousInTransferResult { + constructor(sequence packets, optional DataView? data); + readonly attribute DataView? data; + readonly attribute FrozenArray packets; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBIsochronousOutTransferPacket { + constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0); + readonly attribute unsigned long bytesWritten; + readonly attribute USBTransferStatus status; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBIsochronousOutTransferResult { + constructor(sequence packets); + readonly attribute FrozenArray packets; +}; + +[Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext] +interface USBDevice { + readonly attribute octet usbVersionMajor; + readonly attribute octet usbVersionMinor; + readonly attribute octet usbVersionSubminor; + readonly attribute octet deviceClass; + readonly attribute octet deviceSubclass; + readonly attribute octet deviceProtocol; + readonly attribute unsigned short vendorId; + readonly attribute unsigned short productId; + readonly attribute octet deviceVersionMajor; + readonly attribute octet deviceVersionMinor; + readonly attribute octet deviceVersionSubminor; + readonly attribute DOMString? manufacturerName; + readonly attribute DOMString? productName; + readonly attribute DOMString? serialNumber; + readonly attribute USBConfiguration? configuration; + readonly attribute FrozenArray configurations; + readonly attribute boolean opened; + Promise open(); + Promise close(); + Promise forget(); + Promise selectConfiguration(octet configurationValue); + Promise claimInterface(octet interfaceNumber); + Promise releaseInterface(octet interfaceNumber); + Promise selectAlternateInterface(octet interfaceNumber, octet alternateSetting); + Promise controlTransferIn(USBControlTransferParameters setup, unsigned short length); + Promise controlTransferOut(USBControlTransferParameters setup, optional BufferSource data); + Promise clearHalt(USBDirection direction, octet endpointNumber); + Promise transferIn(octet endpointNumber, unsigned long length); + Promise transferOut(octet endpointNumber, BufferSource data); + Promise isochronousTransferIn(octet endpointNumber, sequence packetLengths); + Promise isochronousTransferOut(octet endpointNumber, BufferSource data, sequence packetLengths); + Promise reset(); +}; + +enum USBRequestType { + "standard", + "class", + "vendor" +}; + +enum USBRecipient { + "device", + "interface", + "endpoint", + "other" +}; + +dictionary USBControlTransferParameters { + required USBRequestType requestType; + required USBRecipient recipient; + required octet request; + required unsigned short value; + required unsigned short index; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBConfiguration { + constructor(USBDevice device, octet configurationValue); + readonly attribute octet configurationValue; + readonly attribute DOMString? configurationName; + readonly attribute FrozenArray interfaces; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBInterface { + constructor(USBConfiguration configuration, octet interfaceNumber); + readonly attribute octet interfaceNumber; + readonly attribute USBAlternateInterface alternate; + readonly attribute FrozenArray alternates; + readonly attribute boolean claimed; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBAlternateInterface { + constructor(USBInterface deviceInterface, octet alternateSetting); + readonly attribute octet alternateSetting; + readonly attribute octet interfaceClass; + readonly attribute octet interfaceSubclass; + readonly attribute octet interfaceProtocol; + readonly attribute DOMString? interfaceName; + readonly attribute FrozenArray endpoints; +}; + +enum USBDirection { + "in", + "out" +}; + +enum USBEndpointType { + "bulk", + "interrupt", + "isochronous" +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBEndpoint { + constructor(USBAlternateInterface alternate, octet endpointNumber, USBDirection direction); + readonly attribute octet endpointNumber; + readonly attribute USBDirection direction; + readonly attribute USBEndpointType type; + readonly attribute unsigned long packetSize; +}; + +dictionary USBPermissionDescriptor : PermissionDescriptor { + sequence filters; +}; + +dictionary AllowedUSBDevice { + required octet vendorId; + required octet productId; + DOMString serialNumber; +}; + +dictionary USBPermissionStorage { + sequence allowedDevices = []; +}; + +[Exposed=(DedicatedWorker,SharedWorker,Window)] +interface USBPermissionResult : PermissionStatus { + attribute FrozenArray devices; +}; -- cgit v1.2.3