Skip to content

Commit ea503b9

Browse files
committed
Add it to bluetooth.commands
1 parent b751163 commit ea503b9

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

index.bs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5173,6 +5173,7 @@ BluetoothCommand = (
51735173
bluetooth.SimulateAdvertisement //
51745174
bluetooth.SimulateGattConnectionResponse //
51755175
bluetooth.SimulateGattDisconnection //
5176+
bluetooth.SimulateService //
51765177
)
51775178
</pre>
51785179

@@ -5606,20 +5607,21 @@ The [=remote end steps=] with command parameters |params| are:
56065607
|simulatedDevice| inside |navigable|'s <a>active window</a>'s <a spec=HTML>associated <code>Navigator</code></a>'s
56075608
[=associated Bluetooth=].
56085609
1. Let |serviceMapping| be |simulatedDevice|'s <a>simulated GATT service mapping</a>.
5610+
1. Let |uuid| be |params|[`"uuid"`].
56095611
1. If |params|[`"type"`] is `"add"`:
5610-
1. If |serviceMapping|[|params|[`"uuid"`]] [=map/exists=], return [=error=] with [=error code=] [=invalid element state=].
5612+
1. If |serviceMapping|[|uuid|] [=map/exists=], return [=error=] with [=error code=] [=invalid element state=].
56115613
1. Let |simulatedGattService| be a new <a>simulated GATT service</a>.
5612-
1. Set |simulatedGattService|'s <a>UUID</a> to |params|[`"uuid"`].
5613-
1. Set |serviceMapping|[|params|[`"uuid"`]] to |simulatedGattService|.
5614+
1. Set |simulatedGattService|'s <a>UUID</a> to |uuid|.
5615+
1. Set |serviceMapping|[|uuid|] to |simulatedGattService|.
56145616
1. <a>Create a <code>BluetoothRemoteGATTService</code> representing</a> |simulatedGattService|
56155617
and add a mapping from |simulatedGattService| to the resulting {{Promise}} in
56165618
|simulatedDeviceInstance|.{{[[context]]}}.{{Bluetooth/[[attributeInstanceMap]]}}.
56175619
1. Return [=success=] with data `null`.
56185620
1. Else if |params|[`"type"`] is `"remove"`:
5619-
1. If |serviceMapping|[|params|[`"uuid"`]] [=map/exists=], let |simulatedGattService| be |serviceMapping|[|params|[`"uuid"`]].
5621+
1. If |serviceMapping|[|uuid|] [=map/exists=], let |simulatedGattService| be |serviceMapping|[|uuid|].
56205622
1. Otherwise, return [=error=] with [=error code=] [=invalid element state=].
56215623
1. Remove |simulatedGattService| from |simulatedDeviceInstance|.{{[[context]]}}.{{Bluetooth/[[attributeInstanceMap]]}}.
5622-
1. Remove |params|[`"uuid"`] from |serviceMapping|.
5624+
1. Remove |uuid| from |serviceMapping|.
56235625
1. Return [=success=] with data `null`.
56245626
1. Return [=error=] with [=error code=] [=invalid argument=].
56255627

0 commit comments

Comments
 (0)