@@ -5163,6 +5163,7 @@ BluetoothCommand = (
51635163 bluetooth.SimulatePreconnectedPeripheral //
51645164 bluetooth.SimulateAdvertisement //
51655165 bluetooth.SimulateGattConnectionResponse //
5166+ bluetooth.SimulateGattDisconnection //
51665167)
51675168</pre>
51685169
@@ -5510,6 +5511,55 @@ A [=local end=] could simulate a device gatt connection response of success
55105511</pre>
55115512</div>
55125513
5514+ #### The bluetooth.simulateGattDisconnection Command #### {#bluetooth-simulategattdisconnection-command}
5515+
5516+ <pre highlight="cddl" class="cddl remote-cddl local-cddl">
5517+ bluetooth.SimulateGattDisconnection = (
5518+ method: "bluetooth.simulateGattDisconnection",
5519+ params: bluetooth.SimulateGattDisconnectionParameters,
5520+ )
5521+
5522+ bluetooth.SimulateGattDisconnectionParameters = {
5523+ context: text,
5524+ address: text,
5525+ }
5526+
5527+ </pre>
5528+
5529+ <div algorithm="remote end steps for bluetooth.simulateGattDisconnection">
5530+ The [=remote end steps=] with command parameters |params| are:
5531+
5532+ 1. Let |contextId| be |params|[`"context"`] .
5533+ 1. Let |navigable| be the result of [=trying=] to [=get a navigable=] with |contextId|.
5534+ 1. Let |deviceAddress| be |params|[`"address"`] .
5535+ 1. Let |simulatedBluetoothAdapter| be |navigable|'s <a>simulated Bluetooth adapter</a> .
5536+ 1. If |simulatedBluetoothAdapter| is empty, return [=error=] with [=error code=] [=invalid argument=] .
5537+ 1. Let |deviceMapping| be |simulatedBluetoothAdapter|'s <a>simulated Bluetooth device mapping</a> .
5538+ 1. If |deviceMapping|[|deviceAddress|] [=map/exists=] , let |simulatedDevice| be |deviceMapping|[|deviceAddress|] .
5539+ Otherwise, return [=error=] with [=error code=] [=invalid argument=] .
5540+ 1. Let |simulatedDeviceInstance| be the result of <a>get the <code>BluetoothDevice</code> representing</a>
5541+ |simulatedDevice| inside |navigable|'s <a>active window</a>' s <a spec=HTML>associated <code>Navigator</code></a> 's
5542+ [=associated Bluetooth=] .
5543+ 1. If |simulatedDeviceInstance|.{{[[gatt]]}} .{{[[automatedGATTConnectionResponse]]}} is `"expected"`,
5544+ return [=error=] with [=error code=] [=invalid element state=] .
5545+ 1. <a>Clean up the disconnected device</a> |simulatedDeviceInstance|.
5546+
5547+ </div>
5548+
5549+ <div class="example">
5550+ A [=local end=] could simulate device gatt disconnection by sending the following message:
5551+
5552+ <pre highlight="json">
5553+ {
5554+ "method": "bluetooth.simulateGattDisconnection",
5555+ "params": {
5556+ "context": "cxt-d03fdd81",
5557+ "address": "09:09:09:09:09:09",
5558+ }
5559+ }
5560+ </pre>
5561+ </div>
5562+
55135563### Events ### {#bidi-events}
55145564
55155565#### The bluetooth.requestDevicePromptUpdated Event #### {#bluetooth-requestdevicepromptupdated-event}
0 commit comments