From a2a2f325a64d27677fb4fec51bd7c573721b4d70 Mon Sep 17 00:00:00 2001
From: Travis CI Table of Contents
-
Characteristic.
The Bluetooth Attribute Caching system allows bonded clients
+ to save references to attributes from one connection to the next.
+ Web Bluetooth treats websites as not bonded to devices they have permission to access: BluetoothRemoteGATTService
, BluetoothRemoteGATTCharacteristic
,
+ and BluetoothRemoteGATTDescriptor
objects
+ become invalid on disconnection,
+ and the site must retrieved them again when it re-connects.
The UA MUST maintain a Bluetooth cache of the hierarchy of Services, Characteristics, and Descriptors
it has discovered on a device.
The UA MAY share this cache between multiple origins accessing the same device.
Each potential entry in the cache is either known-present, known-absent, or unknown.
The cache MUST NOT contain two entries that are for the same attribute.
- Each known-present entry in the cache is associated with an optional Promise<
, BluetoothRemoteGATTService
>Promise<
,
- or BluetoothRemoteGATTCharacteristic
>Promise<
instance
+ Each known-present entry in the cache is associated with an optional BluetoothRemoteGATTDescriptor
>Promise<
, BluetoothRemoteGATTService
>Promise<
,
+ or BluetoothRemoteGATTCharacteristic
>Promise<
instance
for each BluetoothRemoteGATTDescriptor
>Bluetooth
instance.
For example, if a user calls the serviceA.getCharacteristic(uuid1)
function
with an initially empty Bluetooth cache,
@@ -3107,17 +3117,17 @@
BluetoothDevice
obj.[[representedDevice]]
- BluetoothRemoteGATTService
+ BluetoothRemoteGATTService
obj.[[representedService]]
- BluetoothRemoteGATTCharacteristic
+ BluetoothRemoteGATTCharacteristic
obj.[[representedCharacteristic]]
- BluetoothRemoteGATTDescriptor
+ BluetoothRemoteGATTDescriptor
obj.[[representedDescriptor]]
To GetGATTChildren(attribute: GATT Attribute,
single: boolean,
uuidCanonicalizer: function,
uuid: optional (DOMString or unsigned int)
,
allowedUuids: optional ("all" or Array<DOMString>)
,
child type: GATT declaration type),
the UA MUST perform the following steps:
BluetoothDevice
attribute
- BluetoothRemoteGATTService
+ BluetoothRemoteGATTService
attribute.device
- BluetoothRemoteGATTCharacteristic
+ BluetoothRemoteGATTCharacteristic
attribute.service
.device
deviceObj.gatt.connected
is false
,
@@ -3144,7 +3154,8 @@ null
,
return a promise rejected with an InvalidStateError
and
abort these steps.
- Note: This happens when a Service or Characteristic is removed from the device, +
Note: This happens when a Service or Characteristic is removed from the device + or invalidated by a disconnection, and then its object is used again.
deviceObj
for entries that:
@@ -3170,7 +3181,7 @@ When checking whether two Services, Characteristics, or Descriptors a and b are the same attribute, the UA SHOULD determine that they are the same if a and b are inside the same device and have the same Attribute Handle, but MAY use any algorithm it wants with the constraint that a and b MUST NOT be considered the same attribute if @@ -3198,8 +3209,8 @@
this.connected
is false
, abort these steps.
- this.[[activeAlgorithms]]
.
- this.connected
to false
.
- gattserverdisconnected
with its bubbles
attribute initialized to true
at this.device
.
- This event is not fired at the BluetoothRemoteGATTServer
.
this.device
.
this.device.[[representedDevice]]
.
BluetoothDevice
s deviceObj
in the whole UA
- with deviceObj.[[representedDevice]]
the same device as device, deviceObj.gatt.connected
is false
,
+ with deviceObj.[[representedDevice]]
the same device as device, deviceObj.gatt.connected
is false
,
the UA SHOULD destroy device’s ATT Bearer.
Algorithms need to fail if
- their BluetoothRemoteGATTServer
was disconnected while they were running,
+ their BluetoothRemoteGATTServer
was disconnected while they were running,
even if the UA stays connected the whole time
- and the BluetoothRemoteGATTServer
is subsequently re-connected before they finish.
+ and the BluetoothRemoteGATTServer
is subsequently re-connected before they finish.
We wrap the returned Promise
to accomplish this.
To create a gattServer-connection-checking wrapper around a Promise
promise, the UA MUST:
gattServer.connected
is true
,
- add promise to gattServer.[[activeAlgorithms]]
.
+ add promise to gattServer.[[activeAlgorithms]]
.
gattServer.[[activeAlgorithms]]
,
+ gattServer.[[activeAlgorithms]]
,
remove it and return the first argument.
NetworkError
. Because gattServer was disconnected
during the execution of the main algorithm.
@@ -3292,7 +3299,7 @@ gattServer.[[activeAlgorithms]]
,
+ gattServer.[[activeAlgorithms]]
,
remove it and throw the first argument.
NetworkError
. Because gattServer was disconnected
during the execution of the main algorithm.
@@ -3323,35 +3330,35 @@ BluetoothRemoteGATTService
represents a GATT Service,
+
BluetoothRemoteGATTService
represents a GATT Service,
a collection of characteristics and relationships to other services
that encapsulate the behavior of part of a device.
interface BluetoothRemoteGATTService { +interface BluetoothRemoteGATTService { readonly attribute BluetoothDevice device; readonly attribute UUID uuid; readonly attribute boolean isPrimary; - Promise<BluetoothRemoteGATTCharacteristic> + Promise<BluetoothRemoteGATTCharacteristic> getCharacteristic(BluetoothCharacteristicUUID characteristic); - Promise<sequence<BluetoothRemoteGATTCharacteristic>> + Promise<sequence<BluetoothRemoteGATTCharacteristic>> getCharacteristics(optional BluetoothCharacteristicUUID characteristic); - Promise<BluetoothRemoteGATTService> + Promise<BluetoothRemoteGATTService> getIncludedService(BluetoothServiceUUID service); - Promise<sequence<BluetoothRemoteGATTService>> + Promise<sequence<BluetoothRemoteGATTService>> getIncludedServices(optional BluetoothServiceUUID service); }; -BluetoothRemoteGATTService implements EventTarget; -BluetoothRemoteGATTService implements CharacteristicEventHandlers; -BluetoothRemoteGATTService implements ServiceEventHandlers; +BluetoothRemoteGATTService implements EventTarget; +BluetoothRemoteGATTService implements CharacteristicEventHandlers; +BluetoothRemoteGATTService implements ServiceEventHandlers;--NOTE:+BluetoothRemoteGATTService
attributesNOTE:BluetoothRemoteGATTService
attributesdevice is the
BluetoothDevice
representing the remote peripheral that the GATT service belongs to.uuid is the UUID of the service, e.g.
'0000180d-0000-1000-8000-00805f9b34fb'
for the Heart Rate service.isPrimary indicates whether the type of this service is primary or secondary.
Instances of
+BluetoothRemoteGATTService
are created with the internal slots described in the following table:Instances of
BluetoothRemoteGATTService
are created with the internal slots described in the following table: