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 --- .../tests/interfaces/web-bluetooth.idl | 251 +++++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 testing/web-platform/tests/interfaces/web-bluetooth.idl (limited to 'testing/web-platform/tests/interfaces/web-bluetooth.idl') diff --git a/testing/web-platform/tests/interfaces/web-bluetooth.idl b/testing/web-platform/tests/interfaces/web-bluetooth.idl new file mode 100644 index 0000000000..21c237040e --- /dev/null +++ b/testing/web-platform/tests/interfaces/web-bluetooth.idl @@ -0,0 +1,251 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Web Bluetooth (https://webbluetoothcg.github.io/web-bluetooth/) + +dictionary BluetoothDataFilterInit { + BufferSource dataPrefix; + BufferSource mask; +}; + +dictionary BluetoothManufacturerDataFilterInit : BluetoothDataFilterInit { + required [EnforceRange] unsigned short companyIdentifier; +}; + +dictionary BluetoothServiceDataFilterInit : BluetoothDataFilterInit { + required BluetoothServiceUUID service; +}; + +dictionary BluetoothLEScanFilterInit { + sequence services; + DOMString name; + DOMString namePrefix; + sequence manufacturerData; + sequence serviceData; +}; + +dictionary RequestDeviceOptions { + sequence filters; + sequence optionalServices = []; + sequence optionalManufacturerData = []; + boolean acceptAllDevices = false; +}; + +[Exposed=Window, SecureContext] +interface Bluetooth : EventTarget { + Promise getAvailability(); + attribute EventHandler onavailabilitychanged; + [SameObject] + readonly attribute BluetoothDevice? referringDevice; + Promise> getDevices(); + Promise requestDevice(optional RequestDeviceOptions options = {}); +}; + +Bluetooth includes BluetoothDeviceEventHandlers; +Bluetooth includes CharacteristicEventHandlers; +Bluetooth includes ServiceEventHandlers; + +dictionary BluetoothPermissionDescriptor : PermissionDescriptor { + DOMString deviceId; + // These match RequestDeviceOptions. + sequence filters; + sequence optionalServices = []; + sequence optionalManufacturerData = []; + boolean acceptAllDevices = false; +}; + +dictionary AllowedBluetoothDevice { + required DOMString deviceId; + required boolean mayUseGATT; + // An allowedServices of "all" means all services are allowed. + required (DOMString or sequence) allowedServices; + required sequence allowedManufacturerData; +}; +dictionary BluetoothPermissionStorage { + required sequence allowedDevices; +}; + +[Exposed=Window] +interface BluetoothPermissionResult : PermissionStatus { + attribute FrozenArray devices; +}; + +[ + Exposed=Window, + SecureContext +] +interface ValueEvent : Event { + constructor(DOMString type, optional ValueEventInit initDict = {}); + readonly attribute any value; +}; + +dictionary ValueEventInit : EventInit { + any value = null; +}; + +[Exposed=Window, SecureContext] +interface BluetoothDevice : EventTarget { + readonly attribute DOMString id; + readonly attribute DOMString? name; + readonly attribute BluetoothRemoteGATTServer? gatt; + + Promise forget(); + Promise watchAdvertisements( + optional WatchAdvertisementsOptions options = {}); + readonly attribute boolean watchingAdvertisements; +}; +BluetoothDevice includes BluetoothDeviceEventHandlers; +BluetoothDevice includes CharacteristicEventHandlers; +BluetoothDevice includes ServiceEventHandlers; + +dictionary WatchAdvertisementsOptions { + AbortSignal signal; +}; + +[Exposed=Window, SecureContext] +interface BluetoothManufacturerDataMap { + readonly maplike; +}; +[Exposed=Window, SecureContext] +interface BluetoothServiceDataMap { + readonly maplike; +}; +[ + Exposed=Window, + SecureContext +] +interface BluetoothAdvertisingEvent : Event { + constructor(DOMString type, BluetoothAdvertisingEventInit init); + [SameObject] + readonly attribute BluetoothDevice device; + readonly attribute FrozenArray uuids; + readonly attribute DOMString? name; + readonly attribute unsigned short? appearance; + readonly attribute byte? txPower; + readonly attribute byte? rssi; + [SameObject] + readonly attribute BluetoothManufacturerDataMap manufacturerData; + [SameObject] + readonly attribute BluetoothServiceDataMap serviceData; +}; +dictionary BluetoothAdvertisingEventInit : EventInit { + required BluetoothDevice device; + sequence<(DOMString or unsigned long)> uuids; + DOMString name; + unsigned short appearance; + byte txPower; + byte rssi; + BluetoothManufacturerDataMap manufacturerData; + BluetoothServiceDataMap serviceData; +}; + +[Exposed=Window, SecureContext] +interface BluetoothRemoteGATTServer { + [SameObject] + readonly attribute BluetoothDevice device; + readonly attribute boolean connected; + Promise connect(); + undefined disconnect(); + Promise getPrimaryService(BluetoothServiceUUID service); + Promise> + getPrimaryServices(optional BluetoothServiceUUID service); +}; + +[Exposed=Window, SecureContext] +interface BluetoothRemoteGATTService : EventTarget { + [SameObject] + readonly attribute BluetoothDevice device; + readonly attribute UUID uuid; + readonly attribute boolean isPrimary; + Promise + getCharacteristic(BluetoothCharacteristicUUID characteristic); + Promise> + getCharacteristics(optional BluetoothCharacteristicUUID characteristic); + Promise + getIncludedService(BluetoothServiceUUID service); + Promise> + getIncludedServices(optional BluetoothServiceUUID service); +}; +BluetoothRemoteGATTService includes CharacteristicEventHandlers; +BluetoothRemoteGATTService includes ServiceEventHandlers; + +[Exposed=Window, SecureContext] +interface BluetoothRemoteGATTCharacteristic : EventTarget { + [SameObject] + readonly attribute BluetoothRemoteGATTService service; + readonly attribute UUID uuid; + readonly attribute BluetoothCharacteristicProperties properties; + readonly attribute DataView? value; + Promise getDescriptor(BluetoothDescriptorUUID descriptor); + Promise> + getDescriptors(optional BluetoothDescriptorUUID descriptor); + Promise readValue(); + Promise writeValue(BufferSource value); + Promise writeValueWithResponse(BufferSource value); + Promise writeValueWithoutResponse(BufferSource value); + Promise startNotifications(); + Promise stopNotifications(); +}; +BluetoothRemoteGATTCharacteristic includes CharacteristicEventHandlers; + +[Exposed=Window, SecureContext] +interface BluetoothCharacteristicProperties { + readonly attribute boolean broadcast; + readonly attribute boolean read; + readonly attribute boolean writeWithoutResponse; + readonly attribute boolean write; + readonly attribute boolean notify; + readonly attribute boolean indicate; + readonly attribute boolean authenticatedSignedWrites; + readonly attribute boolean reliableWrite; + readonly attribute boolean writableAuxiliaries; +}; + +[Exposed=Window, SecureContext] +interface BluetoothRemoteGATTDescriptor { + [SameObject] + readonly attribute BluetoothRemoteGATTCharacteristic characteristic; + readonly attribute UUID uuid; + readonly attribute DataView? value; + Promise readValue(); + Promise writeValue(BufferSource value); +}; + +[SecureContext] +interface mixin CharacteristicEventHandlers { + attribute EventHandler oncharacteristicvaluechanged; +}; + +[SecureContext] +interface mixin BluetoothDeviceEventHandlers { + attribute EventHandler onadvertisementreceived; + attribute EventHandler ongattserverdisconnected; +}; + +[SecureContext] +interface mixin ServiceEventHandlers { + attribute EventHandler onserviceadded; + attribute EventHandler onservicechanged; + attribute EventHandler onserviceremoved; +}; + +typedef DOMString UUID; + +[Exposed=Window] +interface BluetoothUUID { + static UUID getService((DOMString or unsigned long) name); + static UUID getCharacteristic((DOMString or unsigned long) name); + static UUID getDescriptor((DOMString or unsigned long) name); + + static UUID canonicalUUID([EnforceRange] unsigned long alias); +}; + +typedef (DOMString or unsigned long) BluetoothServiceUUID; +typedef (DOMString or unsigned long) BluetoothCharacteristicUUID; +typedef (DOMString or unsigned long) BluetoothDescriptorUUID; + +[SecureContext] +partial interface Navigator { + [SameObject] + readonly attribute Bluetooth bluetooth; +}; -- cgit v1.2.3