forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add generator for pseudocluster tables
- Loading branch information
Showing
2 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<!--- | ||
This file is automatically generated by a script. | ||
DO NOT HAND-EDIT THIS FILE. | ||
Script: generate_pseudo_cluster_doc_tables.py | ||
--> | ||
|
||
|
||
|
||
CommissionerCommands | ||
|command|args|arg type| arg optional| | ||
|:---|:---|:---|:---| | ||
|PairWithCode|nodeId<br />payload<br />discoverOnce|node_id<br />char_string<br />boolean|false<br />false<br />true| | ||
|Unpair|nodeId|node_id|false| | ||
|GetCommissionerNodeId|||| | ||
|GetCommissionerNodeIdResponse|nodeId|node_id|false| | ||
|GetCommissionerRootCertificate|||| | ||
|GetCommissionerRootCertificateResponse|RCAC|OCTET_STRING|false| | ||
|IssueNocChain|Elements<br />nodeId|octet_string<br />node_id|false<br />false| | ||
|IssueNocChainResponse|NOC<br />ICAC<br />RCAC<br />IPK|octet_string<br />octet_string<br />octet_string<br />octet_string|false<br />false<br />false<br />false| | ||
|
||
|
||
DelayCommands | ||
|command|args|arg type| arg optional| | ||
|:---|:---|:---|:---| | ||
|WaitForCommissioning|||| | ||
|WaitForCommissionee|nodeId<br />expireExistingSession|node_id<br />bool|false<br />true| | ||
|WaitForMs|ms|int16u|false| | ||
|WaitForMessage|registerKey<br />message|char_string<br />char_string|false<br />false| | ||
|
||
|
||
DiscoveryCommands | ||
|command|args|arg type| arg optional| | ||
|:---|:---|:---|:---| | ||
|FindCommissionable|||| | ||
|FindCommissionableByShortDiscriminator|value|int16u|false| | ||
|FindCommissionableByLongDiscriminator|value|int16u|false| | ||
|FindCommissionableByCommissioningMode|||| | ||
|FindCommissionableByVendorId|value|vendor_id|false| | ||
|FindCommissionableByDeviceType|value|devtype_id|false| | ||
|FindCommissioner|||| | ||
|FindCommissionerByVendorId|value|vendor_id|false| | ||
|FindCommissionerByDeviceType|value|devtype_id|false| | ||
|FindResponse|hostName<br />instanceName<br />longDiscriminator<br />shortDiscriminator<br />vendorId<br />productId<br />commissioningMode<br />deviceType<br />deviceName<br />rotatingId<br />rotatingIdLen<br />pairingHint<br />pairingInstruction<br />supportsTcp<br />numIPs<br />port<br />mrpRetryIntervalIdle<br />mrpRetryIntervalActive<br />mrpRetryActiveThreshold<br />isICDOperatingAsLIT|char_string<br />char_string<br />int16u<br />int16u<br />vendor_id<br />int16u<br />int8u<br />devtype_id<br />char_string<br />octet_string<br />int64u<br />int16u<br />char_string<br />boolean<br />int8u<br />int16u<br />int32u<br />int32u<br />int16u<br />boolean|false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />true<br />true<br />true<br />true| | ||
|
||
|
||
EqualityCommands | ||
|command|args|arg type| arg optional| | ||
|:---|:---|:---|:---| | ||
|BooleanEquals|Value1<br />Value2|boolean<br />boolean|false<br />false| | ||
|SignedNumberEquals|Value1<br />Value2|int64s<br />int64s|false<br />false| | ||
|UnsignedNumberEquals|Value1<br />Value2|int64u<br />int64u|false<br />false| | ||
|EqualityResponse|Equals|bool|false| | ||
|
||
|
||
LogCommands | ||
|command|args|arg type| arg optional| | ||
|:---|:---|:---|:---| | ||
|Log|message|char_string|false| | ||
|UserPrompt|message<br />expectedValue|char_string<br />char_string|false<br />true| | ||
|
||
|
||
SystemCommands | ||
|command|args|arg type| arg optional| | ||
|:---|:---|:---|:---| | ||
|Start|registerKey<br />discriminator<br />port<br />minCommissioningTimeout<br />kvs<br />filepath<br />otaDownloadPath|char_string<br />int16u<br />int16u<br />int16u<br />char_string<br />char_string<br />char_string|true<br />true<br />true<br />true<br />true<br />true<br />true| | ||
|Stop|registerKey|char_string|true| | ||
|Reboot|registerKey|char_string|true| | ||
|FactoryReset|registerKey|char_string|true| | ||
|CreateOtaImage|otaImageFilePath<br />rawImageFilePath<br />rawImageContent|char_string<br />char_string<br />char_string|false<br />false<br />false| | ||
|CompareFiles|file1<br />file2|char_string<br />char_string|false<br />false| |
50 changes: 50 additions & 0 deletions
50
scripts/py_matter_yamltests/generate_pseudo_cluster_doc_tables.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright (c) 2024 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. | ||
|
||
import os | ||
from matter_yamltests.pseudo_clusters.pseudo_clusters import get_default_pseudo_clusters | ||
import xml.etree.ElementTree as ElementTree | ||
|
||
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) | ||
WARNING = ("<!---\n" | ||
"This file is automatically generated by a script.\n" | ||
"DO NOT HAND-EDIT THIS FILE.\n" | ||
f"Script: {os.path.basename(__file__)}\n" | ||
"-->\n\n") | ||
|
||
|
||
def create_tables(): | ||
pseudo_clusters = get_default_pseudo_clusters() | ||
|
||
doc_path = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..', 'docs', 'testing', 'yaml_pseudocluster.md')) | ||
with open(doc_path, "w") as f: | ||
f.writelines(WARNING) | ||
|
||
for cluster in pseudo_clusters.clusters: | ||
f.writelines(f'\n\n{cluster.name}\n') | ||
f.writelines('|command|args|arg type| arg optional|\n') | ||
f.writelines('|:---|:---|:---|:---|\n') | ||
|
||
et = ElementTree.fromstring(cluster.definition) | ||
cluster_xml = next(et.iter('cluster')) | ||
for command_xml in cluster_xml.iter('command'): | ||
cmd = command_xml.get('name') | ||
arg = '<br />'.join([arg_xml.get('name') for arg_xml in command_xml.iter('arg')]) | ||
argtype = '<br />'.join([arg_xml.get('type') for arg_xml in command_xml.iter('arg')]) | ||
optional = '<br />'.join([arg_xml.get('optional', 'false') for arg_xml in command_xml.iter('arg')]) | ||
|
||
f.writelines(f'|{cmd}|{arg}|{argtype}|{optional}|\n') | ||
|
||
|
||
create_tables() |