Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[matter_yamltests] Add CommissionerCommands and DiscoveryCommands method definitions #25110

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def check_response(self, value, value_type_name) -> bool:
success = True
elif self._type == 'vendor_id' and type(value) is int:
success = value >= 0 and value <= 0xFFFF
elif self._type == 'device_type_id' and type(value) is int:
elif self._type == 'devtype_id' and type(value) is int:
success = value >= 0 and value <= 0xFFFFFFFF
elif self._type == 'cluster_id' and type(value) is int:
success = value >= 0 and value <= 0xFFFFFFFF
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
vivien-apple marked this conversation as resolved.
Show resolved Hide resolved
# Copyright (c) 2023 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ..pseudo_cluster import PseudoCluster

_DEFINITION = '''<?xml version="1.0"?>
<configurator>
<cluster>
<name>CommissionerCommands</name>
<code>0xFFF1FD04</code>

<command source="client" code="0" name="PairWithCode">
<arg name="nodeId" type="node_id"/>
<arg name="payload" type="char_string"/>
</command>

<command source="client" code="1" name="Unpair">
<arg name="nodeId" type="node_id"/>
</command>

<command source="client" code="2" name="GetCommissionerNodeId" response="GetCommissionerNodeIdResponse">
</command>

<command source="server" code="0" name="GetCommissionerNodeIdResponse">
<arg name="nodeId" type="node_id"/>
</command>
</cluster>
</configurator>
'''


class CommissionerCommands(PseudoCluster):
name = 'CommissionerCommands'
definition = _DEFINITION
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#
# Copyright (c) 2023 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ..pseudo_cluster import PseudoCluster

_DEFINITION = '''<?xml version="1.0"?>
<configurator>
<cluster>
<name>DiscoveryCommands</name>
<code>0xFFF1FD05</code>

<command source="client" code="0" name="FindCommissionable" response="FindResponse">
</command>

<command source="client" code="1" name="FindCommissionableByShortDiscriminator" response="FindResponse">
<arg name="value" type="int16u"/>
</command>

<command source="client" code="2" name="FindCommissionableByLongDiscriminator" response="FindResponse">
<arg name="value" type="int16u"/>
</command>

<command source="client" code="3" name="FindCommissionableByCommissioningMode" response="FindResponse">
</command>

<command source="client" code="4" name="FindCommissionableByVendorId" response="FindResponse">
<arg name="value" type="vendor_id"/>
</command>

<command source="client" code="5" name="FindCommissionableByDeviceType" response="FindResponse">
<arg name="value" type="devtype_id"/>
</command>

<command source="client" code="6" name="FindCommissioner" response="FindCommissionerResponse">
</command>

<command source="client" code="7" name="FindCommissionerByVendorId" response="FindCommissionerResponse">
<arg name="value" type="vendor_id"/>
</command>

<command source="client" code="8" name="FindCommissionerByDeviceType" response="FindCommissionerResponse">
<arg name="value" type="devtype_id"/>
</command>

<command source="server" code="9" name="FindResponse">
<arg name="hostName" type="char_string"/>
<arg name="instanceName" type="char_string"/>
<arg name="longDiscriminator" type="int16u"/>
<arg name="shortDiscriminator" type="int16u"/>
<arg name="vendorId" type="vendor_id"/>
<arg name="productId" type="int16u"/>
<arg name="commissioningMode" type="int8u"/>
<arg name="deviceType" type="devtype_id"/>
<arg name="deviceName" type="char_string"/>
<arg name="rotatingId" type="octet_string"/>
<arg name="rotatingIdLen" type="int64u"/>
vivien-apple marked this conversation as resolved.
Show resolved Hide resolved
<arg name="pairingHint" type="int16u"/>
<arg name="pairingInstruction" type="char_string"/>
<arg name="supportsTcp" type="boolean"/>
<arg name="numIPs" type="int8u"/>
<arg name="port" type="int16u"/>
<arg name="mrpRetryIntervalIdle" type="int32u" optional="true"/>
<arg name="mrpRetryIntervalActive" type="int32u" optional="true"/>
</command>
</cluster>
</configurator>
'''


class DiscoveryCommands(PseudoCluster):
name = 'DiscoveryCommands'
definition = _DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .clusters.commissioner_commands import CommissionerCommands
from .clusters.delay_commands import DelayCommands
from .clusters.discovery_commands import DiscoveryCommands
from .clusters.log_commands import LogCommands
from .clusters.system_commands import SystemCommands
from .pseudo_cluster import PseudoCluster
Expand Down Expand Up @@ -46,7 +48,9 @@ def __get_command(self, request):

def get_default_pseudo_clusters() -> PseudoClusters:
clusters = [
CommissionerCommands(),
DelayCommands(),
DiscoveryCommands(),
LogCommands(),
SystemCommands()
]
Expand Down