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

Restyle Mei data in all clusters #19318

Closed
wants to merge 17 commits into from
Closed
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 @@ -2170,6 +2170,7 @@ server cluster ModeSelect = 80 {
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;
readonly attribute int8u manufacturerExtension = 4293984257;

request struct ChangeToModeRequest {
INT8U newMode = 0;
Expand Down Expand Up @@ -4324,6 +4325,7 @@ endpoint 1 {
callback attribute attributeList;
ram attribute featureMap default = 1;
ram attribute clusterRevision default = 1;
ram attribute manufacturerExtension default = 255;
}

server cluster DoorLock {
Expand Down
21 changes: 18 additions & 3 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"package": [
{
"pathRelativity": "relativeToZap",
"path": "../../../src/app/zap-templates/zcl/zcl.json",
"path": "../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json",
"version": "ZCL Test Data",
"type": "zcl-properties"
},
Expand Down Expand Up @@ -12664,6 +12664,22 @@
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ManufacturerExtension",
"code": 4293984257,
"mfgCode": null,
"side": "server",
"type": "int8u",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "255",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
}
]
},
Expand Down Expand Up @@ -25142,6 +25158,5 @@
"endpointVersion": 1,
"deviceIdentifier": 61442
}
],
"log": []
]
}
22 changes: 21 additions & 1 deletion scripts/tools/zap/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#

import argparse
import json
import os
import subprocess
import sys
Expand Down Expand Up @@ -66,9 +67,28 @@ def runArgumentsParser():
return zap_file


def detectZclFile(zapFile):
print(f"Searching for zcl file from {zapFile}")

path = 'src/app/zap-templates/zcl/zcl.json'

data = json.load(open(zapFile))
for package in data["package"]:
if package["type"] != "zcl-properties":
continue

# found the right path, try to figure out the actual path
if package["pathRelativity"] == "relativeToZap":
path = os.path.abspath(os.path.join(os.path.dirname(zapFile), package["path"]))
else:
path = package["path"]

return getFilePath(path)


def runConversion(zap_file):
templates_file = getFilePath('src/app/zap-templates/app-templates.json')
zcl_file = getFilePath('src/app/zap-templates/zcl/zcl.json')
zcl_file = detectZclFile(zap_file)

generator_dir = getDirPath('third_party/zap/repo')
os.chdir(generator_dir)
Expand Down
31 changes: 27 additions & 4 deletions scripts/tools/zap/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,36 @@ def getDirPath(name):
return fullpath


def detectZclFile(zapFile):
print(f"Searching for zcl file from {zapFile}")

path = 'src/app/zap-templates/zcl/zcl.json'

data = json.load(open(zapFile))
for package in data["package"]:
if package["type"] != "zcl-properties":
continue

# found the right path, try to figure out the actual path
if package["pathRelativity"] == "relativeToZap":
path = os.path.abspath(os.path.join(os.path.dirname(zapFile), package["path"]))
else:
path = package["path"]

return getFilePath(path)


def runArgumentsParser():
default_templates = 'src/app/zap-templates/app-templates.json'
default_zcl = 'src/app/zap-templates/zcl/zcl.json'
default_output_dir = 'zap-generated/'

parser = argparse.ArgumentParser(
description='Generate artifacts from .zapt templates')
parser.add_argument('zap', help='Path to the application .zap file')
parser.add_argument('-t', '--templates', default=default_templates,
help='Path to the .zapt templates records to use for generating artifacts (default: "' + default_templates + '")')
parser.add_argument('-z', '--zcl', default=default_zcl,
help='Path to the zcl templates records to use for generating artifacts (default: "' + default_zcl + '")')
parser.add_argument('-z', '--zcl',
help='Path to the zcl templates records to use for generating artifacts (default: autodetect read from zap file)')
parser.add_argument('-o', '--output-dir', default=None,
help='Output directory for the generated files (default: automatically selected)')
args = parser.parse_args()
Expand All @@ -86,7 +104,12 @@ def runArgumentsParser():
output_dir = ''

zap_file = getFilePath(args.zap)
zcl_file = getFilePath(args.zcl)

if args.zcl:
zcl_file = getFilePath(args.zcl)
else:
zcl_file = detectZclFile(zap_file)

templates_file = getFilePath(args.templates)
output_dir = getDirPath(output_dir)

Expand Down
11 changes: 9 additions & 2 deletions scripts/tools/zap/run_zaptool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ CHIP_ROOT="${SCRIPT_PATH%/scripts/tools/zap/run_zaptool.sh}"
npm install
fi

echo "ARGS: ${ZAP_ARGS[@]}"

if [[ "${ZAP_ARGS[@]}" == *"all-clusters-app.zap"* ]]; then
ZCL_FILE="$CHIP_ROOT/src/app/zap-templates/zcl/zcl-with-test-extensions.json"
else
ZCL_FILE="$CHIP_ROOT/src/app/zap-templates/zcl/zcl.json"
fi

node src-script/zap-start.js --logToStdout \
--gen "$CHIP_ROOT/src/app/zap-templates/app-templates.json" \
--zcl "$CHIP_ROOT/src/app/zap-templates/zcl/zcl.json" \
--zcl "$ZCL_FILE" \
"${ZAP_ARGS[@]}"

)
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>
Loading