diff --git a/index.bs b/index.bs index 0fc9eec..cf349c8 100644 --- a/index.bs +++ b/index.bs @@ -1578,7 +1578,7 @@ spec: permissions interface BluetoothDevice { readonly attribute DOMString id; readonly attribute DOMString? name; - readonly attribute BluetoothRemoteGATTServer gatt; + readonly attribute BluetoothRemoteGATTServer? gatt; readonly attribute FrozenArray<UUID> uuids; Promise<void> watchAdvertisements(); @@ -1605,7 +1605,8 @@ spec: permissions
- gatt provides a way to interact with this device's GATT server. + {{BluetoothDevice/gatt}} provides a way to interact with this device's GATT server + if the site has permission to use any of its services.
@@ -1645,6 +1646,17 @@ spec: permissions The Bluetooth device this object represents. +
result.watchingAdvertisements
to `false`.
result.gatt.{{BluetoothRemoteGATTServer/device}}
to result.
- result.gatt.{{BluetoothRemoteGATTServer/connected}}
to `false`.
-
+ Getting the gatt
attribute
+ MUST perform the following steps:
+
this.{{[[allowedServices]]}}
is an empty list,
+ return `null`.
+ this.{{[[gatt]]}}
.
+
Getting the uuids
attribute
MUST perform the following steps:
diff --git a/index.html b/index.html
index e965eb3..010c1a9 100644
--- a/index.html
+++ b/index.html
@@ -2483,7 +2483,7 @@
name is the human-readable name of the device.
-gatt provides a way to interact with this device’s GATT server.
+ gatt
provides a way to interact with this device’s GATT server
+ if the site has permission to use any of its services.
uuids
lists
the UUIDs of GATT services known to be on the device,
that the current origin is allowed to access.
undefined
BluetoothRemoteGATTServer
instance with
+ its device
attribute initialized to this
and its connected
attribute initialized to false
.
+ undefined
@@ -2574,8 +2580,6 @@ result.name
to that string.
result.watchingAdvertisements
to false
.
- result.gatt.device
to result.
- result.gatt.connected
to false
.
result@[[unfilteredUuids]]
.
[[deviceInstanceMap]]
whose key is the same device as device.
+ Getting the gatt
attribute
+ MUST perform the following steps:
this.[[allowedServices]]
is an empty list,
+ return null
.
+ this.[[gatt]]
.
+ Getting the uuids
attribute
MUST perform the following steps:
[[cachedAllowedServices]]
is not equal to [[allowedServices]]
or [[cachedUnfilteredUuids]]
is not equal to [[unfilteredUuids]]
,
+ If [[cachedAllowedServices]]
is not equal to [[allowedServices]]
or [[cachedUnfilteredUuids]]
is not equal to [[unfilteredUuids]]
,
perform the following sub-steps:
[[cachedAllowedServices]]
to a copy of [[allowedServices]]
.
+ [[cachedAllowedServices]]
to a copy of [[allowedServices]]
.
[[cachedUnfilteredUuids]]
to a copy of [[unfilteredUuids]]
.
[[filteredUuids]]
to a new FrozenArray
consisting of:
[[allowedServices]]
is "all"
+ [[allowedServices]]
is "all"
[[unfilteredUuids]]
[[unfilteredUuids]]
and [[allowedServices]]
.
+ [[unfilteredUuids]]
and [[allowedServices]]
.
[[filteredUuids]]
.
@@ -2876,7 +2889,7 @@ The GATT Profile Hierarchy describes how a GATT Server contains a hierarchy of Profiles, Primary Services, Included Services, Characteristics, and Descriptors.
+The GATT Profile Hierarchy describes how a GATT Server contains a hierarchy of Profiles, Primary Services, Included Services, Characteristics, and Descriptors.
Profiles are purely logical: the specification of a Profile describes the expected interactions between the other GATT entities the Profile contains, @@ -2897,7 +2910,7 @@
A Characteristic contains a value, which is an array of bytes, @@ -3035,11 +3048,11 @@
BluetoothRemoteGATTServer
represents a GATT Server on a remote device.
interface BluetoothRemoteGATTServer { ++
BluetoothRemoteGATTServer
represents a GATT Server on a remote device.interface BluetoothRemoteGATTServer { readonly attribute BluetoothDevice device; readonly attribute boolean connected; - Promise<BluetoothRemoteGATTServer> connect(); + Promise<BluetoothRemoteGATTServer> connect(); void disconnect(); Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service); Promise<sequence<BluetoothRemoteGATTService>> @@ -3047,21 +3060,21 @@
-NOTE:+BluetoothRemoteGATTServer
attributesNOTE:BluetoothRemoteGATTServer
attributesdevice is the device running this server.
connected is true while this instance is connected to
this.device
. It can be false while the UA is physically connected, - for example when there are other connectedBluetoothRemoteGATTServer
instances + for example when there are other connectedBluetoothRemoteGATTServer
instances for other global objects.When no ECMAScript code can - observe an instance of
-BluetoothRemoteGATTServer
server anymore, + observe an instance ofBluetoothRemoteGATTServer
server anymore, the UA SHOULD runserver.
. Becausedisconnect()
BluetoothDevice
instances are stored innavigator.bluetooth.
, this can’t happen at least until navigation releases the global object or closing the tab or window destroys the browsing context. Disconnecting on garbage collection ensures that the UA doesn’t keep consuming resources on the remote device unnecessarily.[[deviceInstanceMap]]
Instances of
BluetoothRemoteGATTServer
are created with the internal slots +Instances of
BluetoothRemoteGATTServer
are created with the internal slots described in the following table: