1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
// 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<BluetoothServiceUUID> services;
DOMString name;
DOMString namePrefix;
sequence<BluetoothManufacturerDataFilterInit> manufacturerData;
sequence<BluetoothServiceDataFilterInit> serviceData;
};
dictionary RequestDeviceOptions {
sequence<BluetoothLEScanFilterInit> filters;
sequence<BluetoothLEScanFilterInit> exclusionFilters;
sequence<BluetoothServiceUUID> optionalServices = [];
sequence<unsigned short> optionalManufacturerData = [];
boolean acceptAllDevices = false;
};
[Exposed=Window, SecureContext]
interface Bluetooth : EventTarget {
Promise<boolean> getAvailability();
attribute EventHandler onavailabilitychanged;
[SameObject]
readonly attribute BluetoothDevice? referringDevice;
Promise<sequence<BluetoothDevice>> getDevices();
Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options = {});
};
Bluetooth includes BluetoothDeviceEventHandlers;
Bluetooth includes CharacteristicEventHandlers;
Bluetooth includes ServiceEventHandlers;
dictionary BluetoothPermissionDescriptor : PermissionDescriptor {
DOMString deviceId;
// These match RequestDeviceOptions.
sequence<BluetoothLEScanFilterInit> filters;
sequence<BluetoothServiceUUID> optionalServices = [];
sequence<unsigned short> 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<UUID>) allowedServices;
required sequence<unsigned short> allowedManufacturerData;
};
dictionary BluetoothPermissionStorage {
required sequence<AllowedBluetoothDevice> allowedDevices;
};
[Exposed=Window]
interface BluetoothPermissionResult : PermissionStatus {
attribute FrozenArray<BluetoothDevice> 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<undefined> forget();
Promise<undefined> 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<unsigned short, DataView>;
};
[Exposed=Window, SecureContext]
interface BluetoothServiceDataMap {
readonly maplike<UUID, DataView>;
};
[
Exposed=Window,
SecureContext
]
interface BluetoothAdvertisingEvent : Event {
constructor(DOMString type, BluetoothAdvertisingEventInit init);
[SameObject]
readonly attribute BluetoothDevice device;
readonly attribute FrozenArray<UUID> 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<BluetoothRemoteGATTServer> connect();
undefined disconnect();
Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service);
Promise<sequence<BluetoothRemoteGATTService>>
getPrimaryServices(optional BluetoothServiceUUID service);
};
[Exposed=Window, SecureContext]
interface BluetoothRemoteGATTService : EventTarget {
[SameObject]
readonly attribute BluetoothDevice device;
readonly attribute UUID uuid;
readonly attribute boolean isPrimary;
Promise<BluetoothRemoteGATTCharacteristic>
getCharacteristic(BluetoothCharacteristicUUID characteristic);
Promise<sequence<BluetoothRemoteGATTCharacteristic>>
getCharacteristics(optional BluetoothCharacteristicUUID characteristic);
Promise<BluetoothRemoteGATTService>
getIncludedService(BluetoothServiceUUID service);
Promise<sequence<BluetoothRemoteGATTService>>
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<BluetoothRemoteGATTDescriptor> getDescriptor(BluetoothDescriptorUUID descriptor);
Promise<sequence<BluetoothRemoteGATTDescriptor>>
getDescriptors(optional BluetoothDescriptorUUID descriptor);
Promise<DataView> readValue();
Promise<undefined> writeValue(BufferSource value);
Promise<undefined> writeValueWithResponse(BufferSource value);
Promise<undefined> writeValueWithoutResponse(BufferSource value);
Promise<BluetoothRemoteGATTCharacteristic> startNotifications();
Promise<BluetoothRemoteGATTCharacteristic> 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<DataView> readValue();
Promise<undefined> 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;
};
|