Skip to content

Commit 1133700

Browse files
vivien-applepull[bot]
authored andcommitted
[matter_yamltests] Add CommissionerCommands and DiscoveryCommands method definitions (#25110)
* [matter_yamltests] Add CommissionerCommands methods definitions * [matter_yamltests] Add DiscoveryCommands methods definitions
1 parent 235c8be commit 1133700

File tree

4 files changed

+135
-1
lines changed

4 files changed

+135
-1
lines changed

scripts/py_matter_yamltests/matter_yamltests/constraints.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def check_response(self, value, value_type_name) -> bool:
8787
success = True
8888
elif self._type == 'vendor_id' and type(value) is int:
8989
success = value >= 0 and value <= 0xFFFF
90-
elif self._type == 'device_type_id' and type(value) is int:
90+
elif self._type == 'devtype_id' and type(value) is int:
9191
success = value >= 0 and value <= 0xFFFFFFFF
9292
elif self._type == 'cluster_id' and type(value) is int:
9393
success = value >= 0 and value <= 0xFFFFFFFF
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#
2+
# Copyright (c) 2023 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the 'License');
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an 'AS IS' BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
from ..pseudo_cluster import PseudoCluster
17+
18+
_DEFINITION = '''<?xml version="1.0"?>
19+
<configurator>
20+
<cluster>
21+
<name>CommissionerCommands</name>
22+
<code>0xFFF1FD04</code>
23+
24+
<command source="client" code="0" name="PairWithCode">
25+
<arg name="nodeId" type="node_id"/>
26+
<arg name="payload" type="char_string"/>
27+
</command>
28+
29+
<command source="client" code="1" name="Unpair">
30+
<arg name="nodeId" type="node_id"/>
31+
</command>
32+
33+
<command source="client" code="2" name="GetCommissionerNodeId" response="GetCommissionerNodeIdResponse">
34+
</command>
35+
36+
<command source="server" code="0" name="GetCommissionerNodeIdResponse">
37+
<arg name="nodeId" type="node_id"/>
38+
</command>
39+
</cluster>
40+
</configurator>
41+
'''
42+
43+
44+
class CommissionerCommands(PseudoCluster):
45+
name = 'CommissionerCommands'
46+
definition = _DEFINITION
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#
2+
# Copyright (c) 2023 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the 'License');
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an 'AS IS' BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
from ..pseudo_cluster import PseudoCluster
17+
18+
_DEFINITION = '''<?xml version="1.0"?>
19+
<configurator>
20+
<cluster>
21+
<name>DiscoveryCommands</name>
22+
<code>0xFFF1FD05</code>
23+
24+
<command source="client" code="0" name="FindCommissionable" response="FindResponse">
25+
</command>
26+
27+
<command source="client" code="1" name="FindCommissionableByShortDiscriminator" response="FindResponse">
28+
<arg name="value" type="int16u"/>
29+
</command>
30+
31+
<command source="client" code="2" name="FindCommissionableByLongDiscriminator" response="FindResponse">
32+
<arg name="value" type="int16u"/>
33+
</command>
34+
35+
<command source="client" code="3" name="FindCommissionableByCommissioningMode" response="FindResponse">
36+
</command>
37+
38+
<command source="client" code="4" name="FindCommissionableByVendorId" response="FindResponse">
39+
<arg name="value" type="vendor_id"/>
40+
</command>
41+
42+
<command source="client" code="5" name="FindCommissionableByDeviceType" response="FindResponse">
43+
<arg name="value" type="devtype_id"/>
44+
</command>
45+
46+
<command source="client" code="6" name="FindCommissioner" response="FindCommissionerResponse">
47+
</command>
48+
49+
<command source="client" code="7" name="FindCommissionerByVendorId" response="FindCommissionerResponse">
50+
<arg name="value" type="vendor_id"/>
51+
</command>
52+
53+
<command source="client" code="8" name="FindCommissionerByDeviceType" response="FindCommissionerResponse">
54+
<arg name="value" type="devtype_id"/>
55+
</command>
56+
57+
<command source="server" code="9" name="FindResponse">
58+
<arg name="hostName" type="char_string"/>
59+
<arg name="instanceName" type="char_string"/>
60+
<arg name="longDiscriminator" type="int16u"/>
61+
<arg name="shortDiscriminator" type="int16u"/>
62+
<arg name="vendorId" type="vendor_id"/>
63+
<arg name="productId" type="int16u"/>
64+
<arg name="commissioningMode" type="int8u"/>
65+
<arg name="deviceType" type="devtype_id"/>
66+
<arg name="deviceName" type="char_string"/>
67+
<arg name="rotatingId" type="octet_string"/>
68+
<arg name="rotatingIdLen" type="int64u"/>
69+
<arg name="pairingHint" type="int16u"/>
70+
<arg name="pairingInstruction" type="char_string"/>
71+
<arg name="supportsTcp" type="boolean"/>
72+
<arg name="numIPs" type="int8u"/>
73+
<arg name="port" type="int16u"/>
74+
<arg name="mrpRetryIntervalIdle" type="int32u" optional="true"/>
75+
<arg name="mrpRetryIntervalActive" type="int32u" optional="true"/>
76+
</command>
77+
</cluster>
78+
</configurator>
79+
'''
80+
81+
82+
class DiscoveryCommands(PseudoCluster):
83+
name = 'DiscoveryCommands'
84+
definition = _DEFINITION

scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py

+4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from .clusters.commissioner_commands import CommissionerCommands
1516
from .clusters.delay_commands import DelayCommands
17+
from .clusters.discovery_commands import DiscoveryCommands
1618
from .clusters.log_commands import LogCommands
1719
from .clusters.system_commands import SystemCommands
1820
from .pseudo_cluster import PseudoCluster
@@ -46,7 +48,9 @@ def __get_command(self, request):
4648

4749
def get_default_pseudo_clusters() -> PseudoClusters:
4850
clusters = [
51+
CommissionerCommands(),
4952
DelayCommands(),
53+
DiscoveryCommands(),
5054
LogCommands(),
5155
SystemCommands()
5256
]

0 commit comments

Comments
 (0)