diff --git a/index.bs b/index.bs index 9a6dcc1..7ea9f6f 100644 --- a/index.bs +++ b/index.bs @@ -5008,7 +5008,15 @@ Each simulated Bluetooth adapter has an adapter state that is Each simulated Bluetooth adapter has a low-energy supported state that is a boolean describing if the adapter supports Bluetooth Low Energy. -A simulated Bluetooth device is a software defined [=Bluetooth device=] that behaves like a physical device, and may be attached to a simulated Bluetooth adapter, and may have associated properties like Manufacturer Specific Data and Service UUIDs. +A simulated Bluetooth device is a software defined [=Bluetooth device=] that +behaves like a physical device, may be attached to a simulated Bluetooth adapter, +may have associated properties like Manufacturer Specific Data and Service UUIDs, +and has a simulated GATT service mapping, which is an ordered map of Bluetooth +UUID strings to simulated GATT services. + +A simulated GATT service is a software defined [=Service=] that belongs to a +simulated Bluetooth device, has a property of UUID, and is known-present in the +Bluetooth cache. Issue: CDDL snippetes use the "text" type instead of "browsingContext.BrowsingContext" to allow indepedent programmatic @@ -5599,8 +5607,37 @@ bluetooth.SimulateServiceParameters = {
BluetoothDevice representing
+ |simulatedDevice| inside |navigable|'s active window's associated Navigator's
+ [=associated Bluetooth=].
+1. Let |serviceMapping| be |simulatedDevice|'s simulated GATT service mapping.
+1. Let |uuid| be |params|[`"uuid"`].
+1. If |params|[`"type"`] is `"add"`:
+ 1. If |serviceMapping|[|uuid|] [=map/exists=], return [=error=] with [=error code=] [=invalid element state=].
+ 1. Let |simulatedGattService| be a new simulated GATT service.
+ 1. Set |simulatedGattService|'s UUID to |uuid|.
+ 1. Set |serviceMapping|[|uuid|] to |simulatedGattService|.
+ 1. Create a BluetoothRemoteGATTService representing |simulatedGattService|
+ and add a mapping from |simulatedGattService| to the resulting {{Promise}} in
+ |simulatedDeviceInstance|.{{[[context]]}}.{{Bluetooth/[[attributeInstanceMap]]}}.
+ 1. Return [=success=] with data `null`.
+1. Else if |params|[`"type"`] is `"remove"`:
+ 1. If |serviceMapping|[|uuid|] [=map/exists=], let |simulatedGattService| be |serviceMapping|[|uuid|].
+ 1. Otherwise, return [=error=] with [=error code=] [=invalid element state=].
+ 1. Remove |simulatedGattService| from |simulatedDeviceInstance|.{{[[context]]}}.{{Bluetooth/[[attributeInstanceMap]]}}.
+ 1. Remove |uuid| from |serviceMapping|.
+ 1. Return [=success=] with data `null`.
+1. Return [=error=] with [=error code=] [=invalid argument=].