-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial commit to add some MEI types - specifically a MEI attribute * Update code to be non-hex * Add an extensions xml file * Added a manufacturer specific extension, codegen seems to work on all clusters app * ran zap regen after adding custom command in zap file * Move extensions to separate json ... does not work in generation yet though * Detect zcl path from zap file during generation * Slight update with comment update * Update code to generate MEI command * Update comment * Remove custom command - all clusters fails to compile with that. unsure why however assuming constants generated separately in different codegen paths * Restyle * Make run_zaptool.sh be able to use test extensions for all clusters app * add zcl file detection for convert.py as well * Add json import * Ran convert.py on all-clusters * Restyle * Add extra slash to check for file path for all clusters * Add linter rule for ZCL file being in sync * Restyle
- Loading branch information
Showing
10 changed files
with
494 additions
and
50 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
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
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
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,72 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright (c) 2022 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. | ||
# | ||
|
||
""" | ||
Validates that the json zcl files that are used by the app are in sync. | ||
Current rule: | ||
- all-clusters app uses an extension on top of the "standard" zcl file. | ||
Ensure that the two fies are in sync EXCEPT the extension. | ||
""" | ||
|
||
import json | ||
import sys | ||
import os | ||
import difflib | ||
|
||
|
||
def main(): | ||
if len(sys.argv) != 2: | ||
print('Please pass CHIP_ROOT as an argument (and only chip root)') | ||
return 1 | ||
|
||
base_name = os.path.join(sys.argv[1], "src", "app", "zap-templates", "zcl", "zcl.json") | ||
ext_name = os.path.join(sys.argv[1], "src", "app", "zap-templates", "zcl", "zcl-with-test-extensions.json") | ||
|
||
base_data = json.load(open(base_name)) | ||
ext_data = json.load(open(ext_name)) | ||
|
||
# ext should be IDENTICAL with base if we add a few things to base: | ||
base_data["xmlRoot"].append("./data-model/test") | ||
base_data["xmlFile"].append("mode-select-extensions.xml") | ||
|
||
# do not care about sorting. mainly do not check if extension xml | ||
# is at the end or in the middle | ||
base_data["xmlFile"].sort() | ||
ext_data["xmlFile"].sort() | ||
|
||
if base_data == ext_data: | ||
return 0 | ||
|
||
print("%s and %s have unexpected differences." % (base_name, ext_name)) | ||
print("Differences between expected and actual:") | ||
|
||
for l in difflib.unified_diff( | ||
json.dumps(ext_data, indent=2).split('\n'), | ||
json.dumps(base_data, indent=2).split('\n'), | ||
fromfile=ext_name, | ||
tofile="<Expected extension file content>", | ||
): | ||
if l.endswith('\n'): | ||
l = l[:-1] | ||
print(l) | ||
|
||
return 1 | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
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
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
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
37 changes: 37 additions & 0 deletions
37
src/app/zap-templates/zcl/data-model/test/mode-select-extensions.xml
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,37 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
Copyright (c) 2022 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. | ||
--> | ||
<configurator> | ||
<domain name="CHIP"/> | ||
<!-- This extends the ModeSelect cluster --> | ||
<clusterExtension code="0x0050"> | ||
<!-- | ||
Manufacturer specific extension attribute: | ||
- Prefix: 0xFFF1 - Test vendor MC | ||
- Suffix: 0x0001 - Non-global attribute id | ||
--> | ||
<attribute side="server" code="0xFFF10001" define="MEI_EXTENSION" type="INT8U" writable="false" optional="true" isNullable="false">ManufacturerExtension</attribute> | ||
|
||
<!-- | ||
Manufacturer specific extension command: | ||
- Prefix: 0xFFF1 - Test vendor MC | ||
- Suffix: 0x0001 - command id | ||
--> | ||
<command source="client" code="0xFFF10001" name="SampleMfgExtensionCommand" optional="true"> | ||
<description>Sample manufacturer specific extension command</description> | ||
</command> | ||
</clusterExtension> | ||
</configurator> |
Oops, something went wrong.