Skip to content

Commit 5508fa5

Browse files
authored
Properly set properties in bluetooth.simulateCharacteristic (#660)
1 parent 94157f9 commit 5508fa5

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

index.bs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5020,8 +5020,11 @@ A <dfn>simulated GATT service</dfn> is a software defined [=Service=] that belon
50205020
is an <a>ordered map</a> of Bluetooth <a>UUID</a> strings to <a>simulated GATT characteristics</a>.
50215021

50225022
A <dfn>simulated GATT characteristic</dfn> is a software defined [=Characteristic=] that belongs to a
5023-
<a>simulated GATT service</a>, has a property of <a>UUID</a>, and is known-present in the
5024-
<a>Bluetooth cache</a>.
5023+
<a>simulated GATT service</a>, has a property of <a>UUID</a>, a property of <a>Characteristic Properties</a>,
5024+
and is known-present in the <a>Bluetooth cache</a>.
5025+
5026+
<dfn>Simulated GATT characteristic properties</dfn> are software defined [=Characteristic Properties=] that belong to a
5027+
<a>simulated GATT characteristic</a> and are known-present in the <a>Bluetooth cache</a>.
50255028

50265029
Issue: CDDL snippetes use the "text" type instead of
50275030
"browsingContext.BrowsingContext" to allow indepedent programmatic
@@ -5719,14 +5722,35 @@ The [=remote end steps=] with command parameters |params| are:
57195722
1. If |params|[`"type"`] is `"add"`:
57205723
1. If |characteristicMapping|[|characteristicUuid|] [=map/exists=], return [=error=] with
57215724
[=error code=] [=invalid element state=].
5725+
1. If |params|[`"characteristicProperties"`] does not [=map/exist=], return [=error=] with [=error code=] [=invalid argument=].
5726+
1. Let |simulatedGattCharacteristicProperties| be new <a>simulated GATT characteristic properties</a> and run the following steps:
5727+
1. Let |properties| be |params|[`"characteristicProperties"`].
5728+
1. If |properties|[`"broadcast"`] [=map/exists=], set |simulatedGattCharacteristicProperties|'s `Broadcast` bit if
5729+
|properties|[`"broadcast"`] is `true`.
5730+
1. If |properties|[`"read"`] [=map/exists=], set |simulatedGattCharacteristicProperties|'s `Read` bit if
5731+
|properties|[`"read"`] is `true`.
5732+
1. If |properties|[`"writeWithoutResponse"`] [=map/exists=], set |simulatedGattCharacteristicProperties|'s `Write Without Response` bit if
5733+
|properties|[`"writeWithoutResponse"`] is `true`.
5734+
1. If |properties|[`"write"`] [=map/exists=], set |simulatedGattCharacteristicProperties|'s `Write` bit if
5735+
|properties|[`"write"`] is `true`.
5736+
1. If |properties|[`"notify"`] [=map/exists=], set |simulatedGattCharacteristicProperties|'s `Notify` bit if
5737+
|properties|[`"notify"`] is `true`.
5738+
1. If |properties|[`"indicate"`] [=map/exists=], set |simulatedGattCharacteristicProperties|'s `Indicate` bit if
5739+
|properties|[`"indicate"`] is `true`.
5740+
1. If |properties|[`"authenticatedSignedWrites"`] [=map/exists=], set |simulatedGattCharacteristicProperties|'s `Authenticated Signed Writes` bit if
5741+
|properties|[`"authenticatedSignedWrites"`] is `true`.
5742+
1. If |properties|[`"extendedProperties"`] [=map/exists=], set |simulatedGattCharacteristicProperties|'s `Extended Properties` bit if
5743+
|properties|[`"extendedProperties"`] is `true`.
57225744
1. Let |simulatedGattCharacteristic| be a new <a>simulated GATT characteristic</a>.
57235745
1. Set |simulatedGattCharacteristic|'s <a>UUID</a> to |characteristicUuid|.
5746+
1. Set |simulatedGattCharacteristic|'s <a>Characteristic Properties</a> to |simulatedGattCharacteristicProperties|.
57245747
1. Set |characteristicMapping|[|characteristicUuid|] to |simulatedGattCharacteristic|.
57255748
1. <a>Create a <code>BluetoothRemoteGATTCharacteristic</code> representing</a> |simulatedGattCharacteristic|
57265749
and add a mapping from |simulatedGattCharacteristic| to the resulting {{Promise}} in
57275750
|simulatedDeviceInstance|.{{[[context]]}}.{{Bluetooth/[[attributeInstanceMap]]}}.
57285751
1. Return [=success=] with data `null`.
57295752
1. Else if |params|[`"type"`] is `"remove"`:
5753+
1. If |params|[`"characteristicProperties"`] [=map/exists=], return [=error=] with [=error code=] [=invalid argument=].
57305754
1. If |characteristicMapping|[|characteristicUuid|] [=map/exists=], let |simulatedGattCharacteristic|
57315755
be |characteristicMapping|[|characteristicUuid|].
57325756
1. Otherwise, return [=error=] with [=error code=] [=invalid element state=].

0 commit comments

Comments
 (0)