diff --git a/index.bs b/index.bs index c87a6f4..28bce08 100644 --- a/index.bs +++ b/index.bs @@ -4234,6 +4234,8 @@ To clean up the disconnected device |deviceObj|, the UA must: 1. Set deviceObj.gatt.{{BluetoothRemoteGATTServer/connected}} to `false`. 1. Clear deviceObj.gatt.{{[[activeAlgorithms]]}}. +1. Set deviceObj.gatt.{{[[automatedGATTConnectionResponse]]}} to + `"not-expected"`. 1. Let |context| be |deviceObj|.{{[[context]]}}. 1. Remove all entries from |context|.{{[[attributeInstanceMap]]}} whose keys are inside |deviceObj|.{{[[representedDevice]]}}. @@ -5163,6 +5165,7 @@ BluetoothCommand = ( bluetooth.SimulatePreconnectedPeripheral // bluetooth.SimulateAdvertisement // bluetooth.SimulateGattConnectionResponse // + bluetooth.SimulateGattDisconnection // ) @@ -5510,6 +5513,60 @@ A [=local end=] could simulate a device gatt connection response of success +#### The bluetooth.simulateGattDisconnection Command #### {#bluetooth-simulategattdisconnection-command} + +
+bluetooth.SimulateGattDisconnection = (
+   method: "bluetooth.simulateGattDisconnection",
+   params: bluetooth.SimulateGattDisconnectionParameters,
+)
+
+bluetooth.SimulateGattDisconnectionParameters = {
+   context: text,
+   address: text,
+}
+
+
+ +
+The [=remote end steps=] with command parameters |params| are: + +1. Let |contextId| be |params|[`"context"`]. +1. Let |navigable| be the result of [=trying=] to [=get a navigable=] with |contextId|. +1. Let |deviceAddress| be |params|[`"address"`]. +1. Let |simulatedBluetoothAdapter| be |navigable|'s simulated Bluetooth adapter. +1. If |simulatedBluetoothAdapter| is empty, return [=error=] with [=error code=] [=invalid argument=]. +1. Let |deviceMapping| be |simulatedBluetoothAdapter|'s simulated Bluetooth device mapping. +1. If |deviceMapping|[|deviceAddress|] [=map/exists=], let |simulatedDevice| be |deviceMapping|[|deviceAddress|]. + Otherwise, return [=error=] with [=error code=] [=invalid argument=]. +1. Let |simulatedDeviceInstance| be the result of get the BluetoothDevice representing + |simulatedDevice| inside |navigable|'s active window's associated Navigator's + [=associated Bluetooth=]. +1. If |simulatedDeviceInstance|.{{[[gatt]]}}.{{[[automatedGATTConnectionResponse]]}} is `"expected"`, + set |simulatedDeviceInstance|.{{[[gatt]]}}.{{[[automatedGATTConnectionResponse]]}} to `0x15`. +
+ `0x15` represents `"Remote Device Terminated Connection due to Power Off"` according to the + List of Error Codes. This simulates a scenario where the Bluetooth device is not able to + respond to a GATT connection attempt. +
+1. Otherwise, clean up the disconnected device |simulatedDeviceInstance|. + +
+ +
+A [=local end=] could simulate device GATT disconnection by sending the following message: + +
+{
+  "method": "bluetooth.simulateGattDisconnection",
+  "params": {
+    "context": "cxt-d03fdd81",
+    "address": "09:09:09:09:09:09",
+  }
+}
+
+
+ ### Events ### {#bidi-events} #### The bluetooth.requestDevicePromptUpdated Event #### {#bluetooth-requestdevicepromptupdated-event}