From f4cbde19df9a70f05b0ac8d0246684916f513942 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Thu, 26 May 2022 20:02:06 +0000 Subject: [PATCH 01/22] Squashed commit of the following: commit bc116c2fb65459dafec6ca8ef701e58ece34dd75 Author: Austin Bozowski Date: Thu May 26 19:53:36 2022 +0000 Update manifest commit e89bddae010bd0112a6d54042428be85b104209a Author: Austin Bozowski Date: Thu May 26 19:48:58 2022 +0000 Resync workflows with master, delete test example commit 6da917b0f2ea9135ffa4977b97874c1ff1b85e86 Author: Austin Bozowski Date: Thu May 26 19:41:53 2022 +0000 Workflow naming commit 80506eb0f0b7446a9c8c8e8b7ebbfbceaa8b0272 Author: Austin Bozowski Date: Thu May 26 19:36:45 2022 +0000 Help messages commit c1724ec879673759a337705c98a5d5bdca59fd10 Author: Austin Bozowski Date: Thu May 26 19:29:19 2022 +0000 Restyle commit e24916f0ff0e457bbb4bac2c6cb24e1071492acc Author: Austin Bozowski Date: Thu May 26 19:21:06 2022 +0000 Style commit cdbc67c60134384ba6a8dcdfc3bfa034fc5a86b0 Author: Austin Bozowski Date: Thu May 26 19:02:23 2022 +0000 Re run generate commit 03361f76794163127b36e119ee93807eccd8dd1a Author: Austin Bozowski Date: Thu May 26 18:48:10 2022 +0000 Indent error commit 82daba0f834723af22c56e56151a31d240aea520 Author: Austin Bozowski Date: Thu May 26 18:45:37 2022 +0000 Further validate CI - expected fail now commit d10389334508eeeb0703fe06e30ba8775fb97e6c Author: Austin Bozowski Date: Thu May 26 08:06:27 2022 +0000 TODO and err msg commit b2e5cb3bce4f1d8ee387b607a1ce2ec9fd4cdf1c Author: Austin Bozowski Date: Thu May 26 07:59:28 2022 +0000 Demo fix CI commit d7dd6a2097b75533f34109ddc4a49803bb777a8e Author: Austin Bozowski Date: Thu May 26 07:41:13 2022 +0000 More elegant CI fail commit 51595e93b4e79c87b86d95aeb7cf062324d64d44 Author: Austin Bozowski Date: Thu May 26 07:36:46 2022 +0000 Missed commit 4070d6f6b78b0026a7a41a1c105fdce236d18c2b Author: Austin Bozowski Date: Thu May 26 07:35:26 2022 +0000 Use cached files in GCB, test CI fail commit bf89f5a16fc47fea4efb45dd7bf22a95dd28e94d Author: Austin Bozowski Date: Thu May 26 01:33:30 2022 +0000 Flush buffers to fix stdout ordering commit 3a9012b7e7bde0bd036b2543682b9a66ce4b6fb1 Author: Austin Bozowski Date: Thu May 26 00:54:40 2022 +0000 Missed revert commit c25a5bbe41cf03d43468a2d72fb92ca1c0b6e6f5 Author: Austin Bozowski Date: Wed May 25 23:14:09 2022 +0000 Minor commit 1898821d44077d93b89e37f91bb307e7dbdcc6bf Author: Austin Bozowski Date: Wed May 25 22:33:36 2022 +0000 Revert commit 86de3af37fc871f57342ad7af9963a5475e961af Author: Austin Bozowski Date: Wed May 25 20:40:59 2022 +0000 Split builds commit 56afe2198dad11ea835ca20631c1a894e194b035 Author: Austin Bozowski Date: Wed May 25 17:17:23 2022 +0000 Revert commit 88b88bdf39f65edfaa36d6c6f150e5bc07c4c9ee Author: Austin Bozowski Date: Wed May 25 02:14:42 2022 +0000 Switch to stateful shell commit 1b4a0f1946bf7f5723b1af8c98c5af5f5764540c Author: Austin Bozowski Date: Wed May 25 01:25:43 2022 +0000 Minot commit b26e609b08f0db142c887272662aa12d7ca056b8 Author: Austin Bozowski Date: Wed May 25 01:04:16 2022 +0000 Restyle commit 547a3612c3bebbd9be38abe18e470403aa5895a0 Author: Austin Bozowski Date: Wed May 25 00:11:17 2022 +0000 Fix underscore commit 9193a3db8f6738bc4c0c9b5c59832cbb541394f7 Author: Austin Bozowski Date: Tue May 24 23:54:53 2022 +0000 Make CI uniform commit 91c7a225264dbcdaa4587c1e4804859b502a1067 Author: Austin Bozowski Date: Tue May 24 23:27:14 2022 +0000 Fix indent error commit 70c578012bddd6823a6a28b2b487027b6c47b193 Author: Austin Bozowski Date: Tue May 24 22:44:04 2022 +0000 Close quote commit 7fad5ecd783da0c9012c954777d1238435e7d206 Author: Austin Bozowski Date: Tue May 24 22:33:38 2022 +0000 Test impact of bootstrap commit 33631309cf882c16ac7709337ffdc48fa5667108 Author: Austin Bozowski Date: Tue May 24 21:30:03 2022 +0000 Example GCB config (no test) commit 187da61191f4c5d359741275b806a6603bb47294 Author: Austin Bozowski Date: Tue May 24 21:13:06 2022 +0000 Compress outputs to tar file in GCB dir commit 7c9866db08e5f5c1ef26a2c10f73a6b04a97c4ac Author: Austin Bozowski Date: Tue May 24 20:23:53 2022 +0000 Move non re-used logic to chef, simplify commit 921557a830aea09855070a1fff93fb15733febcb Author: Austin Bozowski Date: Tue May 24 20:10:35 2022 +0000 Build all function commit ba144ea4cc3ac9bba2fb514d8222aa5a43cf37ad Author: Austin Bozowski Date: Tue May 24 18:13:56 2022 +0000 Refactor commit e007f0e15203bba8e49070145eefef4aae6b0d16 Author: Austin Bozowski Date: Tue May 24 16:55:23 2022 +0000 clear allow list var commit 0bc28e7703242775289c5b45aad6d02258ddf0ae Author: Austin Bozowski Date: Tue May 24 10:12:32 2022 +0000 Disable git manifest commit df7883e2a3352e083c93e49dfce78a4271b2d909 Author: Austin Bozowski Date: Tue May 24 10:10:10 2022 +0000 Disable git manifest commit 78752e248a3526bfcce9cd8dc7d893ce91265ae4 Author: Austin Bozowski Date: Tue May 24 10:01:23 2022 +0000 Fetch commit 5523fb158ca524d8019e42512da05473f8898965 Author: Austin Bozowski Date: Tue May 24 09:52:56 2022 +0000 Use included image commit caafa2e668493f24553c2095d1d1bab03bce6d40 Author: Austin Bozowski Date: Tue May 24 09:42:48 2022 +0000 Image for CI commit 929ef49977d05a599e2b505f2a35798626b40038 Author: Austin Bozowski Date: Tue May 24 09:20:35 2022 +0000 Install git commit a09f7e56f024b210d0c5758b7bf4a7c304eec8de Author: Austin Bozowski Date: Tue May 24 09:16:28 2022 +0000 validate zzz in workflow commit 47c63e77d9363046dc0935b12789104644a7ff9d Author: Austin Bozowski Date: Tue May 24 08:48:35 2022 +0000 Delete dup declare commit 603e531ed4c889042c51b299c54176c00b04f9d3 Author: Austin Bozowski Date: Tue May 24 08:45:30 2022 +0000 Keep cached ZAP output fresh with validator function commit 78a87ba896d0df3a944d1ffd43ee79c5d6ca5e6f Author: Austin Bozowski Date: Tue May 24 08:13:14 2022 +0000 Filter zap cache to one file, Add zap version to manifest commit 53156a16f676986f7d5470ffa8f15304d108c16a Author: Austin Bozowski Date: Tue May 24 07:35:19 2022 +0000 Move zzz to chef dir, write manifest, new opt commit a345cb557de8cc07658ec32d797bbd4bb342f1e7 Author: Austin Bozowski Date: Tue May 24 06:23:33 2022 +0000 typo commit 8ee0354c3b1fa85837f22d8a856b88f0fc3e2241 Author: Austin Bozowski Date: Tue May 24 06:05:53 2022 +0000 Add shell commit bb454c828056411988fdb33aae75efc6285dea51 Author: Austin Bozowski Date: Tue May 24 05:56:50 2022 +0000 bootstrap commit c4186dd557155cce64ad48920e7eb551cd47deb9 Author: Austin Bozowski Date: Tue May 24 05:53:51 2022 +0000 Split bootstrap, run script direct commit 366d91b5d8fab50c08ccd84df5195ea3646082cc Author: Austin Bozowski Date: Tue May 24 03:21:15 2022 +0000 Minor style commit a2d973c7ddcf42077a0ddbc3b3c2461fef23228a Author: Austin Bozowski Date: Tue May 24 00:19:51 2022 +0000 Temp delete other workflows, fix newlines commit c29d9edc33c20134f22bbd17e52ba82b76a54403 Author: Austin Bozowski Date: Mon May 23 23:40:11 2022 +0000 Chef workflow commit c3f2ee26c38f66941c62b9386b3a3ddaf7dc5a50 Author: Austin Bozowski Date: Mon May 23 22:44:57 2022 +0000 Add cached ZAP output commit 6f04f9e360b5231c6384f72865ddc9276af6b945 Author: Austin Bozowski Date: Mon May 23 22:20:35 2022 +0000 chef: fix path error, add options for cached zap --- .github/workflows/chef.yaml | 119 ++ examples/chef/chef.py | 198 ++- examples/chef/chef_util.py | 66 + examples/chef/cimanifest.json | 4 + .../zzz_generated/lighting-app/INPUTMD5.txt | 1 + .../zap-generated/CHIPClientCallbacks.h | 32 + .../lighting-app/zap-generated/CHIPClusters.h | 41 + .../zap-generated/IMClusterCommandHandler.cpp | 1227 +++++++++++++++++ .../PluginApplicationCallbacks.h | 51 + .../lighting-app/zap-generated/access.h | 287 ++++ .../lighting-app/zap-generated/af-gen-event.h | 0 .../zap-generated/callback-stub.cpp | 343 +++++ .../zap-generated/endpoint_config.h | 1125 +++++++++++++++ .../lighting-app/zap-generated/gen_config.h | 202 +++ .../lighting-app/zap-generated/gen_tokens.h | 45 + integrations/cloudbuild/chef.yaml | 42 + 16 files changed, 3757 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/chef.yaml create mode 100644 examples/chef/chef_util.py create mode 100644 examples/chef/cimanifest.json create mode 100644 examples/chef/zzz_generated/lighting-app/INPUTMD5.txt create mode 100644 examples/chef/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.h create mode 100644 examples/chef/zzz_generated/lighting-app/zap-generated/CHIPClusters.h create mode 100644 examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp create mode 100644 examples/chef/zzz_generated/lighting-app/zap-generated/PluginApplicationCallbacks.h create mode 100644 examples/chef/zzz_generated/lighting-app/zap-generated/access.h create mode 100644 examples/chef/zzz_generated/lighting-app/zap-generated/af-gen-event.h create mode 100644 examples/chef/zzz_generated/lighting-app/zap-generated/callback-stub.cpp create mode 100644 examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h create mode 100644 examples/chef/zzz_generated/lighting-app/zap-generated/gen_config.h create mode 100644 examples/chef/zzz_generated/lighting-app/zap-generated/gen_tokens.h create mode 100644 integrations/cloudbuild/chef.yaml diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml new file mode 100644 index 00000000000000..9e34ecd94a8556 --- /dev/null +++ b/.github/workflows/chef.yaml @@ -0,0 +1,119 @@ +# Copyright (c) 2021 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. + +name: Build Chef CI examples on all platforms + +on: + push: + pull_request: + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} + cancel-in-progress: true + +jobs: + + validate_zzz: + name: Chef - Validate cached ZAP output + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + container: + image: connectedhomeip/chip-build:0.5.73 + options: --user root + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - name: Chef validate zzz + shell: bash + run: | + cd examples/chef + python3 chef.py --validate_zzz + + chef_linux: + name: Chef - Linux CI Examples + needs: validate_zzz + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build:0.5.73 + options: --user root + + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - name: CI Examples Linux + shell: bash + run: | + ./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci -t linux" + + chef_esp32: + name: Chef - ESP32 CI Examples + needs: validate_zzz + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-esp32:0.5.73 + options: --user root + + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - name: CI Examples ESP32 + shell: bash + run: | + ./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci -t esp32" + + chef_nrfconnect: + name: Chef - NRFConnect CI Examples + needs: validate_zzz + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-nrf-platform:0.5.73 + options: --user root + + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - name: CI Examples NRFConnect + shell: bash + run: | + ./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci -t nrfconnect" diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 299229e890a92f..90fa678028dcf7 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -19,12 +19,18 @@ import os import sys import textwrap -from typing import Sequence +import shutil import yaml +import hashlib +import json +import tarfile +import subprocess import constants import stateful_shell +import chef_util +from typing import Sequence TermColors = constants.TermColors @@ -34,6 +40,9 @@ _REPO_BASE_PATH = os.path.join(_CHEF_SCRIPT_PATH, "../../") _DEVICE_FOLDER = os.path.join(_CHEF_SCRIPT_PATH, "devices") _DEVICE_LIST = [file[:-4] for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap")] +_CHEF_ZZZ_ROOT = os.path.join(_CHEF_SCRIPT_PATH, "zzz_generated") +_CI_MANIFEST_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cimanifest.json") +_CHEF_DEVICES_DIR = os.path.join(_CHEF_SCRIPT_PATH, "devices") gen_dir = "" # Filled in after sample app type is read from args. @@ -49,7 +58,7 @@ def splash() -> None: | `----.| | | | | |____ | | \\______||__| |__| |_______||__|{TermColors.STRRESET} """) - print(splashText) + print(splashText, flush=True) def load_config() -> None: @@ -57,7 +66,6 @@ def load_config() -> None: config["nrfconnect"] = dict() config["esp32"] = dict() config["silabs-thread"] = dict() - configFile = f"{_CHEF_SCRIPT_PATH}/config.yaml" if (os.path.exists(configFile)): configStream = open(configFile, 'r') @@ -66,7 +74,7 @@ def load_config() -> None: else: print("Running for the first time and configuring config.yaml. " + "Change this configuration file to include correct configuration " + - "for the vendor's SDK") + "for the vendor's SDK", flush=True) configStream = open(configFile, 'w') config["nrfconnect"]["ZEPHYR_BASE"] = os.environ.get('ZEPHYR_BASE') config["nrfconnect"]["TTY"] = None @@ -76,7 +84,7 @@ def load_config() -> None: config["silabs-thread"]["TTY"] = None config["silabs-thread"]["CU"] = None - print(yaml.dump(config)) + print(yaml.dump(config), flush=True) yaml.dump(config, configStream) configStream.close() @@ -164,11 +172,160 @@ def main(argv: Sequence[str]) -> None: action="store_true", dest="do_rpc_console") parser.add_option("-y", "--tty", help="Enumerated USB tty/serial interface enumerated for your physical device. E.g.: /dev/ACM0", dest="tty", metavar="TTY", default=None) + parser.add_option("", "--generate_zzz", help="Populates zzz_generated/chef//zap-generated with output of ZAP tool for every device in examples/chef/devices. If this flag is set, all other arguments are ignored except for --bootstrap_zap and --validate_zzz.", + dest="generate_zzz", action="store_true") + parser.add_option("", "--validate_zzz", help="Checks if cached ZAP output needs to be regenrated, for use in CI. If this flag is set, all other arguments are ignored.", + dest="validate_zzz", action="store_true") + parser.add_option("", "--use_zzz", help="Use pre generated output from the ZAP tool found in the zzz_generated folder. Used to decrease execution time of CI/CD jobs", + dest="use_zzz", action="store_true") + parser.add_option("", "--build_all", help="For use in CD only. Builds and bundles all chef examples for the specified platform. Uses --use_zzz. Chef exits after completion.", + dest="build_all", action="store_true") + parser.add_option( + "", "--ci", help="Builds Chef examples defined in chef_util.ci_allowlist. Uses --use_zzz. Uses specified target from -t. Chef exits after completion.", dest="ci", action="store_true") options, _ = parser.parse_args(argv) splash() + # + # Validate zzz_generated + # + + if options.validate_zzz: + fix_instructions = "Cached files out of date. Please bootstrap, activate, install zap, run chef with the flag --generate_zzz and commit /examples/chef/zzz_generated and /examples/chef/cimanifes.json" + ci_manifest = chef_util.generate_device_manifest(_CHEF_DEVICES_DIR) + with open(_CI_MANIFEST_FILE_NAME, "r", encoding="utf-8") as ci_manifest_file: + cached_manifest = json.loads(ci_manifest_file.read()) + for device in ci_manifest: + if device != "zap_commit": + try: + if cached_manifest[device] != ci_manifest[device]: + print("MISMATCH INPUT - "+fix_instructions) + exit(1) + else: + zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device) + device_md5_file = os.path.join(zzz_dir, "INPUTMD5.txt") + if not os.path.exists(device_md5_file): + print("MISSING RESULT - "+fix_instructions) + exit(1) + else: + with open(device_md5_file, "r", encoding="utf-8") as md5_file: + md5 = md5_file.read() + if ci_manifest[device] != md5: + print("MISMATCH OUTPUT - "+fix_instrucitons) + exit(1) + except KeyError: + print("MISSING DEVICE CACHE - "+fix_instructions) + exit(1) + if device == "zap_commit" and False: + # Disabled for now, ci_manifest above created without include_zap_submod, fails in CI env. + if cached_manifest[device] != ci_manifest[device]: + print("BAD ZAP VERSION - "+fix_instructions) + exit(1) + print("Cached ZAP output is up to date!") + exit(0) + + # + # ZAP bootstrapping + # + + if options.do_bootstrap_zap: + if sys.platform == "linux" or sys.platform == "linux2": + print("Installing ZAP OS package dependencies") + shell.run_cmd( + f"sudo apt-get install sudo apt-get install node node-yargs npm\ + libpixman-1-dev libcairo2-dev libpango1.0-dev node-pre-gyp libjpeg9-dev libgif\ +-dev node-typescript") + if sys.platform == "darwin": + print("Installation of ZAP OS packages not supported on MacOS") + if sys.platform == "win32": + print( + "Installation of ZAP OS packages not supported on Windows") + + print("Running NPM to install ZAP Node.JS dependencies") + shell.run_cmd( + f"cd {_REPO_BASE_PATH}/third_party/zap/repo/ && npm install") + + # + # Populate zzz_generated + # + + if options.generate_zzz: + print(f"Cleaning {_CHEF_ZZZ_ROOT}") + if not os.path.exists(_CHEF_ZZZ_ROOT): + print(f"{_CHEF_ZZZ_ROOT} doesn't exist; creating") + os.mkdir(_CHEF_ZZZ_ROOT) + else: + print(f"Deleting and recreating existing {_CHEF_ZZZ_ROOT}") + shutil.rmtree(_CHEF_ZZZ_ROOT) + os.mkdir(_CHEF_ZZZ_ROOT) + print(f"Generating files in {_CHEF_ZZZ_ROOT} for all devices", flush=True) + for device_dir_item in os.listdir(_CHEF_DEVICES_DIR): + target_file_ext = ".zap" + if device_dir_item.endswith(target_file_ext): # and device_dir_item in chef_util.ci_allowlist: + device_name = device_dir_item[:-len(target_file_ext)] + print(f"Generating files for {device_name}", flush=True) + device_out_dir = os.path.join(_CHEF_ZZZ_ROOT, device_name) + os.mkdir(device_out_dir) + device_out_dir = os.path.join(device_out_dir, "zap-generated") + os.mkdir(device_out_dir) + shell.run_cmd(f"{_REPO_BASE_PATH}/scripts/tools/zap/generate.py\ + {_CHEF_SCRIPT_PATH}/devices/{device_name}.zap -o {device_out_dir}") + shell.run_cmd(f"touch {device_out_dir}/af-gen-event.h") + chef_util.generate_device_manifest(_CHEF_DEVICES_DIR, include_zap_submod=True, write_manifest_file=True, + _CI_MANIFEST_FILE_NAME=_CI_MANIFEST_FILE_NAME, repo_base_path=_REPO_BASE_PATH, _CHEF_ZZZ_ROOT=_CHEF_ZZZ_ROOT) + exit(0) + + # + # CI + # + + if options.ci: + if options.build_target == "nrfconnect": + os.environ['GNUARMEMB_TOOLCHAIN_PATH'] = os.environ['PW_ARM_CIPD_INSTALL_DIR'] + for device_dir_item in os.listdir(_CHEF_DEVICES_DIR): + target_file_ext = ".zap" + if device_dir_item.endswith(target_file_ext) and device_dir_item in chef_util.ci_allowlist: + device_name = device_dir_item[:-len(target_file_ext)] + command = './chef.py -cbr --use_zzz -d {} -t {}'.format(device_name, options.build_target) + subprocess.check_call(command, cwd=_CHEF_SCRIPT_PATH, shell=True) + exit(0) + + # + # Build all + # + + if options.build_all: + print("Building all chef examples", flush=True) + os.environ['GNUARMEMB_TOOLCHAIN_PATH'] = os.environ['PW_ARM_CIPD_INSTALL_DIR'] + archive_prefix = "/workspace/artifacts/" + if not os.path.exists(archive_prefix): + # shutil.rmtree(archive_prefix) + os.mkdir(archive_prefix) + archive_suffix = ".tar.gz" + + cd_platforms_meta = chef_util.cd_platforms_meta + for device in os.listdir(_CHEF_DEVICES_DIR): + target_file_ext = ".zap" + if device.endswith(target_file_ext): + device_name = device[:-len(target_file_ext)] + for platform, platform_meta in cd_platforms_meta.items(): + # shutil.rmitem(configFile) + directory = platform_meta['build_dir'] + label = platform_meta['platform_label'] + output_dir = os.path.join(_CHEF_SCRIPT_PATH, directory) + command = './chef.py -cbr --use_zzz -d {} -t {}'.format(device_name, platform) + print('-' * 64, flush=True) + print(f"Building {command}", flush=True) + print('-' * 64, flush=True) + subprocess.check_call(command, cwd=_CHEF_SCRIPT_PATH, shell=True) + archive_name = f"{label}-chef-{device_name}-wifi-rpc" + archive_full_name = archive_prefix + archive_name + archive_suffix + print(f"Adding build output to archive {archive_full_name}", flush=True) + with tarfile.open(archive_full_name, "w:gz") as tar: + tar.add(output_dir, arcname=".") + exit(0) + # # Platform Folder # @@ -217,25 +374,6 @@ def main(argv: Sequence[str]) -> None: elif options.build_target == "linux": print("Linux toolchain update not supported. Skipping") - # - # ZAP bootstrapping - # - - if options.do_bootstrap_zap: - if sys.platform == "linux" or sys.platform == "linux2": - print("Installing ZAP OS package dependencies") - shell.run_cmd( - f"sudo apt-get install sudo apt-get install node node-yargs npm libpixman-1-dev libcairo2-dev libpango1.0-dev node-pre-gyp libjpeg9-dev libgif-dev node-typescript") - if sys.platform == "darwin": - print("Installation of ZAP OS packages not supported on MacOS") - if sys.platform == "win32": - print( - "Installation of ZAP OS packages not supported on Windows") - - print("Running NPM to install ZAP Node.JS dependencies") - shell.run_cmd( - f"cd {_REPO_BASE_PATH}/third_party/zap/repo/ && npm install") - # # Cluster customization # @@ -247,7 +385,7 @@ def main(argv: Sequence[str]) -> None: f"{_REPO_BASE_PATH}/scripts/tools/zap/run_zaptool.sh {options.sample_device_type_name}.zap") if options.do_run_zap: - print("Running ZAP script to generate artifacts") + print("Running ZAP script to generate artifacts", flush=True) shell.run_cmd(f"mkdir -p {gen_dir}/") shell.run_cmd(f"rm {gen_dir}/*") shell.run_cmd( @@ -276,6 +414,13 @@ def main(argv: Sequence[str]) -> None: # if options.do_build: + if options.use_zzz: + print("Using pre-generated ZAP output", flush=True) + zzz_dir = os.path.join(_CHEF_SCRIPT_PATH, "zzz_generated", options.sample_device_type_name, "zap-generated") + if os.path.exists(gen_dir): + shutil.rmtree(gen_dir) + shutil.copytree(zzz_dir, gen_dir) + print("Building...") if options.do_rpc: print("RPC PW enabled") @@ -331,9 +476,10 @@ def main(argv: Sequence[str]) -> None: elif options.build_target == "linux": shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/linux") with open(f"{_CHEF_SCRIPT_PATH}/linux/args.gni", "w") as f: + args_gni = os.path.join(_REPO_BASE_PATH, "config/standalone/args.gni") f.write(textwrap.dedent(f"""\ import("//build_overrides/chip.gni") - import("\\${{chip_root}}/config/standalone/args.gni") + import("{args_gni}") chip_shell_cmd_server = false target_defines = ["CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID={options.vid}", "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID={options.pid}", "CONFIG_ENABLE_PW_RPC={'1' if options.do_rpc else '0'}"] """)) diff --git a/examples/chef/chef_util.py b/examples/chef/chef_util.py new file mode 100644 index 00000000000000..856207cacbac62 --- /dev/null +++ b/examples/chef/chef_util.py @@ -0,0 +1,66 @@ +import subprocess +import json +import os +import hashlib + + +ci_allowlist = ['lighting-app.zap'] +cd_platforms_meta = { + 'linux': { + 'build_dir': 'linux/out', + 'platform_label': 'linux_x86', + }, + 'esp32': { + 'build_dir': 'esp32/build', + 'platform_label': 'esp32-m5stack', + }, + 'nrfconnect': { + 'build_dir': 'nrfconnect/build', + 'platform_label': 'nrf-nrf52840dk', + }, +} + + +def bundle(platform: str): + if platform == 'linux': + pass + if platform == 'esp32': + pass + if platform == 'nrfconnect': + pass + + +def check_zap_master(repo_base_path: str) -> str: + """Produces hash of ZAP submodule in branch master""" + git_cmd = ["git", "ls-tree", "master", "third_party/zap/repo"] + zap_commit = str(subprocess.check_output(git_cmd, cwd=repo_base_path)) + zap_commit = zap_commit.split(" ")[2] + zap_commit = zap_commit[:zap_commit.index("\\")] + print(f"zap commit: {zap_commit}") + return zap_commit + + +def generate_device_manifest(chef_devices_dir: str, include_zap_submod: bool = False, write_manifest_file: bool = False, ci_manifest_file_name: str = '', repo_base_path: str = '', chef_zzz_root: str = '') -> dict: + """Produces dictionary containing md5 of device dir zap files""" + ci_manifest = {} + for device_dir_item in os.listdir(chef_devices_dir): + target_file_ext = ".zap" + if device_dir_item.endswith(target_file_ext): # and device_dir_item in ci_allowlist: + device_name = device_dir_item[:-len(target_file_ext)] + device_file_path = os.path.join(chef_devices_dir, device_dir_item) + with open(device_file_path, "rb") as device_file: + device_file_data = device_file.read() + device_file_md5 = hashlib.md5(device_file_data).hexdigest() + ci_manifest[device_name] = device_file_md5 + print(f"Manifest for {device_name} : {device_file_md5}") + if write_manifest_file: + device_zzz_dir_root = os.path.join(chef_zzz_root, device_name) + device_zzz_md5_file = os.path.join(device_zzz_dir_root, 'INPUTMD5.txt') + with open(device_zzz_md5_file, "w+", encoding="utf-8") as md5file: + md5file.write(device_file_md5) + if include_zap_submod: + ci_manifest["zap_commit"] = check_zap_master(repo_base_path) + if write_manifest_file: + with open(ci_manifest_file_name, "w+", encoding="utf-8") as ci_manifest_file: + ci_manifest_file.write(json.dumps(ci_manifest, indent=4)+"\n") + return ci_manifest diff --git a/examples/chef/cimanifest.json b/examples/chef/cimanifest.json new file mode 100644 index 00000000000000..318370d55f39b9 --- /dev/null +++ b/examples/chef/cimanifest.json @@ -0,0 +1,4 @@ +{ + "lighting-app": "41c55e72d06a04d193901d6b5487f7fa", + "zap_commit": "6594a9257ce96ee6d852eed052939849b31259fc" +} diff --git a/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt b/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt new file mode 100644 index 00000000000000..1d172fc754ae6e --- /dev/null +++ b/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt @@ -0,0 +1 @@ +41c55e72d06a04d193901d6b5487f7fa \ No newline at end of file diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.h b/examples/chef/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.h new file mode 100644 index 00000000000000..4458f51745a59b --- /dev/null +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.h @@ -0,0 +1,32 @@ +/* + * + * 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// List specific responses diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/CHIPClusters.h b/examples/chef/zzz_generated/lighting-app/zap-generated/CHIPClusters.h new file mode 100644 index 00000000000000..15ec5aca34a215 --- /dev/null +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/CHIPClusters.h @@ -0,0 +1,41 @@ +/* + * + * 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include +#include + +#include +#include +#include + +namespace chip { +namespace Controller { + +class DLL_EXPORT OtaSoftwareUpdateProviderCluster : public ClusterBase +{ +public: + OtaSoftwareUpdateProviderCluster() : ClusterBase(app::Clusters::OtaSoftwareUpdateProvider::Id) {} + ~OtaSoftwareUpdateProviderCluster() {} +}; + +} // namespace Controller +} // namespace chip diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp b/examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp new file mode 100644 index 00000000000000..616fa6db37d561 --- /dev/null +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp @@ -0,0 +1,1227 @@ +/* + * + * 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Currently we need some work to keep compatible with ember lib. +#include + +namespace chip { +namespace app { + +// Cluster specific command parsing + +namespace Clusters { + +namespace AdministratorCommissioning { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::OpenCommissioningWindow::Id: { + Commands::OpenCommissioningWindow::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback(apCommandObj, aCommandPath, + commandData); + } + break; + } + case Commands::OpenBasicCommissioningWindow::Id: { + Commands::OpenBasicCommissioningWindow::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallback( + apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::RevokeCommissioning::Id: { + Commands::RevokeCommissioning::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfAdministratorCommissioningClusterRevokeCommissioningCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace AdministratorCommissioning + +namespace ColorControl { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::MoveToHue::Id: { + Commands::MoveToHue::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterMoveToHueCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::MoveHue::Id: { + Commands::MoveHue::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterMoveHueCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::StepHue::Id: { + Commands::StepHue::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterStepHueCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::MoveToSaturation::Id: { + Commands::MoveToSaturation::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterMoveToSaturationCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::MoveSaturation::Id: { + Commands::MoveSaturation::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterMoveSaturationCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::StepSaturation::Id: { + Commands::StepSaturation::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterStepSaturationCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::MoveToHueAndSaturation::Id: { + Commands::MoveToHueAndSaturation::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterMoveToHueAndSaturationCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::MoveToColor::Id: { + Commands::MoveToColor::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterMoveToColorCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::MoveColor::Id: { + Commands::MoveColor::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterMoveColorCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::StepColor::Id: { + Commands::StepColor::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterStepColorCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::MoveToColorTemperature::Id: { + Commands::MoveToColorTemperature::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterMoveToColorTemperatureCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::EnhancedMoveToHue::Id: { + Commands::EnhancedMoveToHue::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterEnhancedMoveToHueCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::EnhancedMoveHue::Id: { + Commands::EnhancedMoveHue::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterEnhancedMoveHueCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::EnhancedStepHue::Id: { + Commands::EnhancedStepHue::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterEnhancedStepHueCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::EnhancedMoveToHueAndSaturation::Id: { + Commands::EnhancedMoveToHueAndSaturation::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfColorControlClusterEnhancedMoveToHueAndSaturationCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::ColorLoopSet::Id: { + Commands::ColorLoopSet::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterColorLoopSetCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::StopMoveStep::Id: { + Commands::StopMoveStep::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterStopMoveStepCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::MoveColorTemperature::Id: { + Commands::MoveColorTemperature::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterMoveColorTemperatureCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::StepColorTemperature::Id: { + Commands::StepColorTemperature::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfColorControlClusterStepColorTemperatureCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace ColorControl + +namespace DiagnosticLogs { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::RetrieveLogsRequest::Id: { + Commands::RetrieveLogsRequest::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfDiagnosticLogsClusterRetrieveLogsRequestCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace DiagnosticLogs + +namespace EthernetNetworkDiagnostics { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ResetCounts::Id: { + Commands::ResetCounts::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfEthernetNetworkDiagnosticsClusterResetCountsCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace EthernetNetworkDiagnostics + +namespace GeneralCommissioning { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ArmFailSafe::Id: { + Commands::ArmFailSafe::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGeneralCommissioningClusterArmFailSafeCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::SetRegulatoryConfig::Id: { + Commands::SetRegulatoryConfig::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::CommissioningComplete::Id: { + Commands::CommissioningComplete::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfGeneralCommissioningClusterCommissioningCompleteCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace GeneralCommissioning + +namespace GroupKeyManagement { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::KeySetWrite::Id: { + Commands::KeySetWrite::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupKeyManagementClusterKeySetWriteCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::KeySetRead::Id: { + Commands::KeySetRead::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupKeyManagementClusterKeySetReadCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::KeySetRemove::Id: { + Commands::KeySetRemove::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupKeyManagementClusterKeySetRemoveCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::KeySetReadAllIndices::Id: { + Commands::KeySetReadAllIndices::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupKeyManagementClusterKeySetReadAllIndicesCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace GroupKeyManagement + +namespace Groups { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::AddGroup::Id: { + Commands::AddGroup::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupsClusterAddGroupCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::ViewGroup::Id: { + Commands::ViewGroup::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupsClusterViewGroupCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::GetGroupMembership::Id: { + Commands::GetGroupMembership::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupsClusterGetGroupMembershipCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::RemoveGroup::Id: { + Commands::RemoveGroup::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupsClusterRemoveGroupCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::RemoveAllGroups::Id: { + Commands::RemoveAllGroups::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupsClusterRemoveAllGroupsCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::AddGroupIfIdentifying::Id: { + Commands::AddGroupIfIdentifying::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupsClusterAddGroupIfIdentifyingCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace Groups + +namespace Identify { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::Identify::Id: { + Commands::Identify::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfIdentifyClusterIdentifyCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::IdentifyQuery::Id: { + Commands::IdentifyQuery::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfIdentifyClusterIdentifyQueryCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::TriggerEffect::Id: { + Commands::TriggerEffect::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfIdentifyClusterTriggerEffectCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace Identify + +namespace LevelControl { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::MoveToLevel::Id: { + Commands::MoveToLevel::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfLevelControlClusterMoveToLevelCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::Move::Id: { + Commands::Move::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfLevelControlClusterMoveCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::Step::Id: { + Commands::Step::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfLevelControlClusterStepCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::Stop::Id: { + Commands::Stop::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfLevelControlClusterStopCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::MoveToLevelWithOnOff::Id: { + Commands::MoveToLevelWithOnOff::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfLevelControlClusterMoveToLevelWithOnOffCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::MoveWithOnOff::Id: { + Commands::MoveWithOnOff::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfLevelControlClusterMoveWithOnOffCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::StepWithOnOff::Id: { + Commands::StepWithOnOff::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfLevelControlClusterStepWithOnOffCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::StopWithOnOff::Id: { + Commands::StopWithOnOff::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfLevelControlClusterStopWithOnOffCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace LevelControl + +namespace NetworkCommissioning { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ScanNetworks::Id: { + Commands::ScanNetworks::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfNetworkCommissioningClusterScanNetworksCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::AddOrUpdateWiFiNetwork::Id: { + Commands::AddOrUpdateWiFiNetwork::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfNetworkCommissioningClusterAddOrUpdateWiFiNetworkCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::AddOrUpdateThreadNetwork::Id: { + Commands::AddOrUpdateThreadNetwork::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfNetworkCommissioningClusterAddOrUpdateThreadNetworkCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::RemoveNetwork::Id: { + Commands::RemoveNetwork::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfNetworkCommissioningClusterRemoveNetworkCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::ConnectNetwork::Id: { + Commands::ConnectNetwork::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfNetworkCommissioningClusterConnectNetworkCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::ReorderNetwork::Id: { + Commands::ReorderNetwork::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfNetworkCommissioningClusterReorderNetworkCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace NetworkCommissioning + +namespace OtaSoftwareUpdateRequestor { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::AnnounceOtaProvider::Id: { + Commands::AnnounceOtaProvider::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfOtaSoftwareUpdateRequestorClusterAnnounceOtaProviderCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace OtaSoftwareUpdateRequestor + +namespace OnOff { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::Off::Id: { + Commands::Off::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOnOffClusterOffCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::On::Id: { + Commands::On::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOnOffClusterOnCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::Toggle::Id: { + Commands::Toggle::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOnOffClusterToggleCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::OffWithEffect::Id: { + Commands::OffWithEffect::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOnOffClusterOffWithEffectCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::OnWithRecallGlobalScene::Id: { + Commands::OnWithRecallGlobalScene::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOnOffClusterOnWithRecallGlobalSceneCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::OnWithTimedOff::Id: { + Commands::OnWithTimedOff::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOnOffClusterOnWithTimedOffCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace OnOff + +namespace OperationalCredentials { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::AttestationRequest::Id: { + Commands::AttestationRequest::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfOperationalCredentialsClusterAttestationRequestCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::CertificateChainRequest::Id: { + Commands::CertificateChainRequest::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfOperationalCredentialsClusterCertificateChainRequestCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::CSRRequest::Id: { + Commands::CSRRequest::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOperationalCredentialsClusterCSRRequestCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::AddNOC::Id: { + Commands::AddNOC::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOperationalCredentialsClusterAddNOCCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::UpdateNOC::Id: { + Commands::UpdateNOC::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOperationalCredentialsClusterUpdateNOCCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::UpdateFabricLabel::Id: { + Commands::UpdateFabricLabel::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOperationalCredentialsClusterUpdateFabricLabelCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::RemoveFabric::Id: { + Commands::RemoveFabric::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOperationalCredentialsClusterRemoveFabricCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::AddTrustedRootCertificate::Id: { + Commands::AddTrustedRootCertificate::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfOperationalCredentialsClusterAddTrustedRootCertificateCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::RemoveTrustedRootCertificate::Id: { + Commands::RemoveTrustedRootCertificate::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfOperationalCredentialsClusterRemoveTrustedRootCertificateCallback(apCommandObj, aCommandPath, + commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace OperationalCredentials + +namespace SoftwareDiagnostics { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ResetWatermarks::Id: { + Commands::ResetWatermarks::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfSoftwareDiagnosticsClusterResetWatermarksCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace SoftwareDiagnostics + +namespace ThreadNetworkDiagnostics { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ResetCounts::Id: { + Commands::ResetCounts::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfThreadNetworkDiagnosticsClusterResetCountsCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace ThreadNetworkDiagnostics + +namespace WiFiNetworkDiagnostics { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ResetCounts::Id: { + Commands::ResetCounts::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfWiFiNetworkDiagnosticsClusterResetCountsCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace WiFiNetworkDiagnostics + +} // namespace Clusters + +void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) +{ + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); + + switch (aCommandPath.mClusterId) + { + case Clusters::AdministratorCommissioning::Id: + Clusters::AdministratorCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::ColorControl::Id: + Clusters::ColorControl::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::DiagnosticLogs::Id: + Clusters::DiagnosticLogs::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::EthernetNetworkDiagnostics::Id: + Clusters::EthernetNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::GeneralCommissioning::Id: + Clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::GroupKeyManagement::Id: + Clusters::GroupKeyManagement::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::Groups::Id: + Clusters::Groups::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::Identify::Id: + Clusters::Identify::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::LevelControl::Id: + Clusters::LevelControl::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::NetworkCommissioning::Id: + Clusters::NetworkCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::OtaSoftwareUpdateRequestor::Id: + Clusters::OtaSoftwareUpdateRequestor::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::OnOff::Id: + Clusters::OnOff::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::OperationalCredentials::Id: + Clusters::OperationalCredentials::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::SoftwareDiagnostics::Id: + Clusters::SoftwareDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::ThreadNetworkDiagnostics::Id: + Clusters::ThreadNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::WiFiNetworkDiagnostics::Id: + Clusters::WiFiNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + default: + ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); + break; + } + + Compatibility::ResetEmberAfObjects(); +} + +} // namespace app +} // namespace chip diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/PluginApplicationCallbacks.h b/examples/chef/zzz_generated/lighting-app/zap-generated/PluginApplicationCallbacks.h new file mode 100644 index 00000000000000..85154579b68824 --- /dev/null +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/PluginApplicationCallbacks.h @@ -0,0 +1,51 @@ +/* + * + * 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +#pragma once + +#include + +#define MATTER_PLUGINS_INIT \ + MatterAccessControlPluginServerInitCallback(); \ + MatterAdministratorCommissioningPluginServerInitCallback(); \ + MatterBasicPluginServerInitCallback(); \ + MatterColorControlPluginServerInitCallback(); \ + MatterDescriptorPluginServerInitCallback(); \ + MatterDiagnosticLogsPluginServerInitCallback(); \ + MatterEthernetNetworkDiagnosticsPluginServerInitCallback(); \ + MatterFixedLabelPluginServerInitCallback(); \ + MatterGeneralCommissioningPluginServerInitCallback(); \ + MatterGeneralDiagnosticsPluginServerInitCallback(); \ + MatterGroupKeyManagementPluginServerInitCallback(); \ + MatterGroupsPluginServerInitCallback(); \ + MatterIdentifyPluginServerInitCallback(); \ + MatterLevelControlPluginServerInitCallback(); \ + MatterLocalizationConfigurationPluginServerInitCallback(); \ + MatterNetworkCommissioningPluginServerInitCallback(); \ + MatterOtaSoftwareUpdateProviderPluginClientInitCallback(); \ + MatterOtaSoftwareUpdateRequestorPluginServerInitCallback(); \ + MatterOccupancySensingPluginServerInitCallback(); \ + MatterOnOffPluginServerInitCallback(); \ + MatterOperationalCredentialsPluginServerInitCallback(); \ + MatterSoftwareDiagnosticsPluginServerInitCallback(); \ + MatterSwitchPluginServerInitCallback(); \ + MatterThreadNetworkDiagnosticsPluginServerInitCallback(); \ + MatterTimeFormatLocalizationPluginServerInitCallback(); \ + MatterUserLabelPluginServerInitCallback(); \ + MatterWiFiNetworkDiagnosticsPluginServerInitCallback(); diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/access.h b/examples/chef/zzz_generated/lighting-app/zap-generated/access.h new file mode 100644 index 00000000000000..fa259c2d821d6a --- /dev/null +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/access.h @@ -0,0 +1,287 @@ +/* + * + * 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Access Control, Attribute: SubjectsPerAccessControlEntry, Privilege: view */ \ + /* Cluster: Access Control, Attribute: TargetsPerAccessControlEntry, Privilege: view */ \ + /* Cluster: Access Control, Attribute: AccessControlEntriesPerFabric, Privilege: view */ \ + /* Cluster: Basic, Attribute: NodeLabel, Privilege: view */ \ + /* Cluster: Basic, Attribute: Location, Privilege: view */ \ + /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: view */ \ + /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: view */ \ + /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: view */ \ + /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: view */ \ + /* Cluster: Level Control, Attribute: start up current level, Privilege: view */ \ + 49, /* Cluster: Network Commissioning, Attribute: MaxNetworks, Privilege: administer */ \ + 49, /* Cluster: Network Commissioning, Attribute: Networks, Privilege: administer */ \ + /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: view */ \ + 49, /* Cluster: Network Commissioning, Attribute: LastNetworkingStatus, Privilege: administer */ \ + 49, /* Cluster: Network Commissioning, Attribute: LastNetworkID, Privilege: administer */ \ + 49, /* Cluster: Network Commissioning, Attribute: LastConnectErrorValue, Privilege: administer */ \ + /* Cluster: On/Off, Attribute: StartUpOnOff, Privilege: view */ \ + 62, /* Cluster: Operational Credentials, Attribute: NOCs, Privilege: administer */ \ + /* Cluster: User Label, Attribute: label list, Privilege: view */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Access Control, Attribute: SubjectsPerAccessControlEntry, Privilege: view */ \ + /* Cluster: Access Control, Attribute: TargetsPerAccessControlEntry, Privilege: view */ \ + /* Cluster: Access Control, Attribute: AccessControlEntriesPerFabric, Privilege: view */ \ + /* Cluster: Basic, Attribute: NodeLabel, Privilege: view */ \ + /* Cluster: Basic, Attribute: Location, Privilege: view */ \ + /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: view */ \ + /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: view */ \ + /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: view */ \ + /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: view */ \ + /* Cluster: Level Control, Attribute: start up current level, Privilege: view */ \ + 0, /* Cluster: Network Commissioning, Attribute: MaxNetworks, Privilege: administer */ \ + 1, /* Cluster: Network Commissioning, Attribute: Networks, Privilege: administer */ \ + /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: view */ \ + 5, /* Cluster: Network Commissioning, Attribute: LastNetworkingStatus, Privilege: administer */ \ + 6, /* Cluster: Network Commissioning, Attribute: LastNetworkID, Privilege: administer */ \ + 7, /* Cluster: Network Commissioning, Attribute: LastConnectErrorValue, Privilege: administer */ \ + /* Cluster: On/Off, Attribute: StartUpOnOff, Privilege: view */ \ + 0, /* Cluster: Operational Credentials, Attribute: NOCs, Privilege: administer */ \ + /* Cluster: User Label, Attribute: label list, Privilege: view */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Access Control, Attribute: SubjectsPerAccessControlEntry, Privilege: view */ \ + /* Cluster: Access Control, Attribute: TargetsPerAccessControlEntry, Privilege: view */ \ + /* Cluster: Access Control, Attribute: AccessControlEntriesPerFabric, Privilege: view */ \ + /* Cluster: Basic, Attribute: NodeLabel, Privilege: view */ \ + /* Cluster: Basic, Attribute: Location, Privilege: view */ \ + /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: view */ \ + /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: view */ \ + /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: view */ \ + /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: view */ \ + /* Cluster: Level Control, Attribute: start up current level, Privilege: view */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Attribute: MaxNetworks, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Attribute: Networks, Privilege: administer */ \ + /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: view */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Attribute: LastNetworkingStatus, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Attribute: LastNetworkID, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Attribute: LastConnectErrorValue, Privilege: administer */ \ + /* Cluster: On/Off, Attribute: StartUpOnOff, Privilege: view */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Attribute: NOCs, Privilege: administer */ \ + /* Cluster: User Label, Attribute: label list, Privilege: view */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + 40, /* Cluster: Basic, Attribute: NodeLabel, Privilege: manage */ \ + 40, /* Cluster: Basic, Attribute: Location, Privilege: administer */ \ + 40, /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: manage */ \ + 768, /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: manage */ \ + 48, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \ + 63, /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: manage */ \ + 8, /* Cluster: Level Control, Attribute: start up current level, Privilege: manage */ \ + 49, /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: administer */ \ + 6, /* Cluster: On/Off, Attribute: StartUpOnOff, Privilege: manage */ \ + 65, /* Cluster: User Label, Attribute: label list, Privilege: manage */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + 5, /* Cluster: Basic, Attribute: NodeLabel, Privilege: manage */ \ + 6, /* Cluster: Basic, Attribute: Location, Privilege: administer */ \ + 16, /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: manage */ \ + 16400, /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: manage */ \ + 0, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \ + 0, /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: manage */ \ + 16384, /* Cluster: Level Control, Attribute: start up current level, Privilege: manage */ \ + 4, /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: administer */ \ + 16387, /* Cluster: On/Off, Attribute: StartUpOnOff, Privilege: manage */ \ + 0, /* Cluster: User Label, Attribute: label list, Privilege: manage */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + kMatterAccessPrivilegeManage, /* Cluster: Basic, Attribute: NodeLabel, Privilege: manage */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Basic, Attribute: Location, Privilege: administer */ \ + kMatterAccessPrivilegeManage, /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: manage */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \ + kMatterAccessPrivilegeManage, /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Level Control, Attribute: start up current level, Privilege: manage */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: administer */ \ + kMatterAccessPrivilegeManage, /* Cluster: On/Off, Attribute: StartUpOnOff, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: User Label, Attribute: label list, Privilege: manage */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ + 60, /* Cluster: AdministratorCommissioning, Command: OpenCommissioningWindow, Privilege: administer */ \ + 60, /* Cluster: AdministratorCommissioning, Command: OpenBasicCommissioningWindow, Privilege: administer */ \ + 60, /* Cluster: AdministratorCommissioning, Command: RevokeCommissioning, Privilege: administer */ \ + 48, /* Cluster: General Commissioning, Command: ArmFailSafe, Privilege: administer */ \ + 48, /* Cluster: General Commissioning, Command: SetRegulatoryConfig, Privilege: administer */ \ + 48, /* Cluster: General Commissioning, Command: CommissioningComplete, Privilege: administer */ \ + 63, /* Cluster: Group Key Management, Command: KeySetWrite, Privilege: administer */ \ + 63, /* Cluster: Group Key Management, Command: KeySetRead, Privilege: administer */ \ + 63, /* Cluster: Group Key Management, Command: KeySetRemove, Privilege: administer */ \ + 63, /* Cluster: Group Key Management, Command: KeySetReadAllIndices, Privilege: administer */ \ + 4, /* Cluster: Groups, Command: AddGroup, Privilege: manage */ \ + 4, /* Cluster: Groups, Command: RemoveGroup, Privilege: manage */ \ + 4, /* Cluster: Groups, Command: RemoveAllGroups, Privilege: manage */ \ + 4, /* Cluster: Groups, Command: AddGroupIfIdentifying, Privilege: manage */ \ + 3, /* Cluster: Identify, Command: Identify, Privilege: manage */ \ + 3, /* Cluster: Identify, Command: IdentifyQuery, Privilege: manage */ \ + 3, /* Cluster: Identify, Command: TriggerEffect, Privilege: manage */ \ + 49, /* Cluster: Network Commissioning, Command: ScanNetworks, Privilege: administer */ \ + 49, /* Cluster: Network Commissioning, Command: AddOrUpdateWiFiNetwork, Privilege: administer */ \ + 49, /* Cluster: Network Commissioning, Command: AddOrUpdateThreadNetwork, Privilege: administer */ \ + 49, /* Cluster: Network Commissioning, Command: RemoveNetwork, Privilege: administer */ \ + 49, /* Cluster: Network Commissioning, Command: ConnectNetwork, Privilege: administer */ \ + 49, /* Cluster: Network Commissioning, Command: ReorderNetwork, Privilege: administer */ \ + 62, /* Cluster: Operational Credentials, Command: AttestationRequest, Privilege: administer */ \ + 62, /* Cluster: Operational Credentials, Command: CertificateChainRequest, Privilege: administer */ \ + 62, /* Cluster: Operational Credentials, Command: CSRRequest, Privilege: administer */ \ + 62, /* Cluster: Operational Credentials, Command: AddNOC, Privilege: administer */ \ + 62, /* Cluster: Operational Credentials, Command: UpdateNOC, Privilege: administer */ \ + 62, /* Cluster: Operational Credentials, Command: UpdateFabricLabel, Privilege: administer */ \ + 62, /* Cluster: Operational Credentials, Command: RemoveFabric, Privilege: administer */ \ + 62, /* Cluster: Operational Credentials, Command: AddTrustedRootCertificate, Privilege: administer */ \ + 62, /* Cluster: Operational Credentials, Command: RemoveTrustedRootCertificate, Privilege: administer */ \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ + 0, /* Cluster: AdministratorCommissioning, Command: OpenCommissioningWindow, Privilege: administer */ \ + 1, /* Cluster: AdministratorCommissioning, Command: OpenBasicCommissioningWindow, Privilege: administer */ \ + 2, /* Cluster: AdministratorCommissioning, Command: RevokeCommissioning, Privilege: administer */ \ + 0, /* Cluster: General Commissioning, Command: ArmFailSafe, Privilege: administer */ \ + 2, /* Cluster: General Commissioning, Command: SetRegulatoryConfig, Privilege: administer */ \ + 4, /* Cluster: General Commissioning, Command: CommissioningComplete, Privilege: administer */ \ + 0, /* Cluster: Group Key Management, Command: KeySetWrite, Privilege: administer */ \ + 1, /* Cluster: Group Key Management, Command: KeySetRead, Privilege: administer */ \ + 3, /* Cluster: Group Key Management, Command: KeySetRemove, Privilege: administer */ \ + 4, /* Cluster: Group Key Management, Command: KeySetReadAllIndices, Privilege: administer */ \ + 0, /* Cluster: Groups, Command: AddGroup, Privilege: manage */ \ + 3, /* Cluster: Groups, Command: RemoveGroup, Privilege: manage */ \ + 4, /* Cluster: Groups, Command: RemoveAllGroups, Privilege: manage */ \ + 5, /* Cluster: Groups, Command: AddGroupIfIdentifying, Privilege: manage */ \ + 0, /* Cluster: Identify, Command: Identify, Privilege: manage */ \ + 1, /* Cluster: Identify, Command: IdentifyQuery, Privilege: manage */ \ + 64, /* Cluster: Identify, Command: TriggerEffect, Privilege: manage */ \ + 0, /* Cluster: Network Commissioning, Command: ScanNetworks, Privilege: administer */ \ + 2, /* Cluster: Network Commissioning, Command: AddOrUpdateWiFiNetwork, Privilege: administer */ \ + 3, /* Cluster: Network Commissioning, Command: AddOrUpdateThreadNetwork, Privilege: administer */ \ + 4, /* Cluster: Network Commissioning, Command: RemoveNetwork, Privilege: administer */ \ + 6, /* Cluster: Network Commissioning, Command: ConnectNetwork, Privilege: administer */ \ + 8, /* Cluster: Network Commissioning, Command: ReorderNetwork, Privilege: administer */ \ + 0, /* Cluster: Operational Credentials, Command: AttestationRequest, Privilege: administer */ \ + 2, /* Cluster: Operational Credentials, Command: CertificateChainRequest, Privilege: administer */ \ + 4, /* Cluster: Operational Credentials, Command: CSRRequest, Privilege: administer */ \ + 6, /* Cluster: Operational Credentials, Command: AddNOC, Privilege: administer */ \ + 7, /* Cluster: Operational Credentials, Command: UpdateNOC, Privilege: administer */ \ + 9, /* Cluster: Operational Credentials, Command: UpdateFabricLabel, Privilege: administer */ \ + 10, /* Cluster: Operational Credentials, Command: RemoveFabric, Privilege: administer */ \ + 11, /* Cluster: Operational Credentials, Command: AddTrustedRootCertificate, Privilege: administer */ \ + 12, /* Cluster: Operational Credentials, Command: RemoveTrustedRootCertificate, Privilege: administer */ \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: AdministratorCommissioning, Command: OpenCommissioningWindow, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: AdministratorCommissioning, Command: OpenBasicCommissioningWindow, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: AdministratorCommissioning, Command: RevokeCommissioning, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: General Commissioning, Command: ArmFailSafe, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: General Commissioning, Command: SetRegulatoryConfig, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: General Commissioning, Command: CommissioningComplete, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Group Key Management, Command: KeySetWrite, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Group Key Management, Command: KeySetRead, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Group Key Management, Command: KeySetRemove, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Group Key Management, Command: KeySetReadAllIndices, Privilege: administer */ \ + kMatterAccessPrivilegeManage, /* Cluster: Groups, Command: AddGroup, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Groups, Command: RemoveGroup, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Groups, Command: RemoveAllGroups, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Groups, Command: AddGroupIfIdentifying, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Identify, Command: Identify, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Identify, Command: IdentifyQuery, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Identify, Command: TriggerEffect, Privilege: manage */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Command: ScanNetworks, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Command: AddOrUpdateWiFiNetwork, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Command: AddOrUpdateThreadNetwork, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Command: RemoveNetwork, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Command: ConnectNetwork, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Command: ReorderNetwork, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: AttestationRequest, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: CertificateChainRequest, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: CSRRequest, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: AddNOC, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: UpdateNOC, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: UpdateFabricLabel, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: RemoveFabric, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: AddTrustedRootCertificate, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: RemoveTrustedRootCertificate, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/af-gen-event.h b/examples/chef/zzz_generated/lighting-app/zap-generated/af-gen-event.h new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/callback-stub.cpp b/examples/chef/zzz_generated/lighting-app/zap-generated/callback-stub.cpp new file mode 100644 index 00000000000000..20850267856b32 --- /dev/null +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/callback-stub.cpp @@ -0,0 +1,343 @@ +/* + * + * 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include +#include + +using namespace chip; + +// Cluster Init Functions +void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) +{ + switch (clusterId) + { + case ZCL_ACCESS_CONTROL_CLUSTER_ID: + emberAfAccessControlClusterInitCallback(endpoint); + break; + case ZCL_ADMINISTRATOR_COMMISSIONING_CLUSTER_ID: + emberAfAdministratorCommissioningClusterInitCallback(endpoint); + break; + case ZCL_BASIC_CLUSTER_ID: + emberAfBasicClusterInitCallback(endpoint); + break; + case ZCL_COLOR_CONTROL_CLUSTER_ID: + emberAfColorControlClusterInitCallback(endpoint); + break; + case ZCL_DESCRIPTOR_CLUSTER_ID: + emberAfDescriptorClusterInitCallback(endpoint); + break; + case ZCL_DIAGNOSTIC_LOGS_CLUSTER_ID: + emberAfDiagnosticLogsClusterInitCallback(endpoint); + break; + case ZCL_ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER_ID: + emberAfEthernetNetworkDiagnosticsClusterInitCallback(endpoint); + break; + case ZCL_FIXED_LABEL_CLUSTER_ID: + emberAfFixedLabelClusterInitCallback(endpoint); + break; + case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID: + emberAfGeneralCommissioningClusterInitCallback(endpoint); + break; + case ZCL_GENERAL_DIAGNOSTICS_CLUSTER_ID: + emberAfGeneralDiagnosticsClusterInitCallback(endpoint); + break; + case ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID: + emberAfGroupKeyManagementClusterInitCallback(endpoint); + break; + case ZCL_GROUPS_CLUSTER_ID: + emberAfGroupsClusterInitCallback(endpoint); + break; + case ZCL_IDENTIFY_CLUSTER_ID: + emberAfIdentifyClusterInitCallback(endpoint); + break; + case ZCL_LEVEL_CONTROL_CLUSTER_ID: + emberAfLevelControlClusterInitCallback(endpoint); + break; + case ZCL_LOCALIZATION_CONFIGURATION_CLUSTER_ID: + emberAfLocalizationConfigurationClusterInitCallback(endpoint); + break; + case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID: + emberAfNetworkCommissioningClusterInitCallback(endpoint); + break; + case ZCL_OTA_PROVIDER_CLUSTER_ID: + emberAfOtaSoftwareUpdateProviderClusterInitCallback(endpoint); + break; + case ZCL_OTA_REQUESTOR_CLUSTER_ID: + emberAfOtaSoftwareUpdateRequestorClusterInitCallback(endpoint); + break; + case ZCL_OCCUPANCY_SENSING_CLUSTER_ID: + emberAfOccupancySensingClusterInitCallback(endpoint); + break; + case ZCL_ON_OFF_CLUSTER_ID: + emberAfOnOffClusterInitCallback(endpoint); + break; + case ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID: + emberAfOperationalCredentialsClusterInitCallback(endpoint); + break; + case ZCL_SOFTWARE_DIAGNOSTICS_CLUSTER_ID: + emberAfSoftwareDiagnosticsClusterInitCallback(endpoint); + break; + case ZCL_SWITCH_CLUSTER_ID: + emberAfSwitchClusterInitCallback(endpoint); + break; + case ZCL_THREAD_NETWORK_DIAGNOSTICS_CLUSTER_ID: + emberAfThreadNetworkDiagnosticsClusterInitCallback(endpoint); + break; + case ZCL_TIME_FORMAT_LOCALIZATION_CLUSTER_ID: + emberAfTimeFormatLocalizationClusterInitCallback(endpoint); + break; + case ZCL_USER_LABEL_CLUSTER_ID: + emberAfUserLabelClusterInitCallback(endpoint); + break; + case ZCL_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_ID: + emberAfWiFiNetworkDiagnosticsClusterInitCallback(endpoint); + break; + default: + // Unrecognized cluster ID + break; + } +} + +void __attribute__((weak)) emberAfAccessControlClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfAdministratorCommissioningClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfDescriptorClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfDiagnosticLogsClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfEthernetNetworkDiagnosticsClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfFixedLabelClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfGeneralCommissioningClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfGeneralDiagnosticsClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfGroupKeyManagementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfGroupsClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfIdentifyClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfLevelControlClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfLocalizationConfigurationClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfNetworkCommissioningClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfOtaSoftwareUpdateProviderClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfOtaSoftwareUpdateRequestorClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfOccupancySensingClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfOnOffClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfOperationalCredentialsClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfSoftwareDiagnosticsClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfSwitchClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfThreadNetworkDiagnosticsClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfTimeFormatLocalizationClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfUserLabelClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfWiFiNetworkDiagnosticsClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} + +// +// Non-Cluster Related Callbacks +// + +void __attribute__((weak)) emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks) {} + +void __attribute__((weak)) emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks) {} + +EmberAfAttributeWritePermission __attribute__((weak)) +emberAfAllowNetworkWriteAttributeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t * value, + uint8_t type) +{ + return EMBER_ZCL_ATTRIBUTE_WRITE_PERMISSION_ALLOW_WRITE_NORMAL; // Default +} + +bool __attribute__((weak)) emberAfAttributeReadAccessCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId) +{ + return true; +} + +bool __attribute__((weak)) emberAfAttributeWriteAccessCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId) +{ + return true; +} + +bool __attribute__((weak)) emberAfDefaultResponseCallback(ClusterId clusterId, CommandId commandId, EmberAfStatus status) +{ + return false; +} + +bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status) +{ + return false; +} + +bool __attribute__((weak)) emberAfMessageSentCallback(const MessageSendDestination & destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) +{ + return false; +} + +EmberAfStatus __attribute__((weak)) +emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) +{ + return EMBER_ZCL_STATUS_FAILURE; +} + +EmberAfStatus __attribute__((weak)) +emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) +{ + return EMBER_ZCL_STATUS_FAILURE; +} + +uint32_t __attribute__((weak)) emberAfGetCurrentTimeCallback() +{ + return 0; +} + +bool __attribute__((weak)) +emberAfGetEndpointInfoCallback(EndpointId endpoint, uint8_t * returnNetworkIndex, EmberAfEndpointInfoStruct * returnEndpointInfo) +{ + return false; +} + +void __attribute__((weak)) emberAfRegistrationAbortCallback() {} + +EmberStatus __attribute__((weak)) +emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message) +{ + return EMBER_LIBRARY_NOT_PRESENT; +} + +bool __attribute__((weak)) emberAfStartMoveCallback() +{ + return false; +} + +chip::Protocols::InteractionModel::Status __attribute__((weak)) +MatterPreAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, + uint8_t * value) +{ + return chip::Protocols::InteractionModel::Status::Success; +} + +void __attribute__((weak)) MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, + uint16_t size, uint8_t * value) +{} diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h new file mode 100644 index 00000000000000..7cf3433cbd52b3 --- /dev/null +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h @@ -0,0 +1,1125 @@ +/* + * + * 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Default values for the attributes longer than a pointer, +// in a form of a binary blob +// Separate block is generated for big-endian and little-endian cases. +#if BIGENDIAN_CPU +#define GENERATED_DEFAULTS \ + { \ + \ + /* Endpoint: 0, Cluster: Localization Configuration (server), big-endian */ \ + \ + /* 0 - ActiveLocale, */ \ + 5, 'e', 'n', '-', 'U', 'S', \ + \ + /* Endpoint: 0, Cluster: General Commissioning (server), big-endian */ \ + \ + /* 6 - Breadcrumb, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server), big-endian */ \ + \ + /* 14 - NetworkName, */ \ + 0x00, 0x00, \ + \ + /* 16 - ExtendedPanId, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 24 - OverrunCount, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 32 - ActiveTimestamp, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 40 - PendingTimestamp, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 48 - ChannelMask, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + } + +#else // !BIGENDIAN_CPU +#define GENERATED_DEFAULTS \ + { \ + \ + /* Endpoint: 0, Cluster: Localization Configuration (server), little-endian */ \ + \ + /* 0 - ActiveLocale, */ \ + 5, 'e', 'n', '-', 'U', 'S', \ + \ + /* Endpoint: 0, Cluster: General Commissioning (server), little-endian */ \ + \ + /* 6 - Breadcrumb, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server), little-endian */ \ + \ + /* 14 - NetworkName, */ \ + 0x00, 0x00, \ + \ + /* 16 - ExtendedPanId, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 24 - OverrunCount, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 32 - ActiveTimestamp, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 40 - PendingTimestamp, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 48 - ChannelMask, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + } + +#endif // BIGENDIAN_CPU + +#define GENERATED_DEFAULTS_COUNT (8) + +#define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE +#define ZAP_LONG_DEFAULTS_INDEX(index) \ + { \ + &generatedDefaults[index] \ + } +#define ZAP_MIN_MAX_DEFAULTS_INDEX(index) \ + { \ + &minMaxDefaults[index] \ + } +#define ZAP_EMPTY_DEFAULT() \ + { \ + (uint32_t) 0 \ + } +#define ZAP_SIMPLE_DEFAULT(x) \ + { \ + (uint32_t) x \ + } + +// This is an array of EmberAfAttributeMinMaxValue structures. +#define GENERATED_MIN_MAX_DEFAULT_COUNT 4 +#define GENERATED_MIN_MAX_DEFAULTS \ + { \ + \ + /* Endpoint: 0, Cluster: Time Format Localization (server) */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x1 }, /* HourFormat */ \ + \ + /* Endpoint: 1, Cluster: On/Off (server) */ \ + { (uint16_t) 0xFF, (uint16_t) 0x0, (uint16_t) 0x2 }, /* StartUpOnOff */ \ + \ + /* Endpoint: 1, Cluster: Level Control (server) */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x3 }, /* options */ \ + \ + /* Endpoint: 1, Cluster: Color Control (server) */ \ + { \ + (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xFEFF \ + } /* start up color temperature mireds */ \ + } + +#define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask +// This is an array of EmberAfAttributeMetadata structures. +#define GENERATED_ATTRIBUTE_COUNT 247 +#define GENERATED_ATTRIBUTES \ + { \ + \ + /* Endpoint: 0, Cluster: Groups (server) */ \ + { 0x00000000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* name support */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Descriptor (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* device list */ \ + { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* server list */ \ + { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* client list */ \ + { 0x00000003, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* parts list */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Access Control (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* ACL */ \ + { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* Extension */ \ + { 0x00000002, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* SubjectsPerAccessControlEntry */ \ + { 0x00000003, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TargetsPerAccessControlEntry */ \ + { 0x00000004, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* AccessControlEntriesPerFabric */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Basic (server) */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ + { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ + { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* VendorID */ \ + { 0x00000003, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ProductName */ \ + { 0x00000004, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ProductID */ \ + { 0x00000005, ZAP_TYPE(CHAR_STRING), 33, \ + ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* NodeLabel */ \ + { 0x00000006, ZAP_TYPE(CHAR_STRING), 0, \ + ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* Location */ \ + { 0x00000007, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* HardwareVersion */ \ + { 0x00000008, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* HardwareVersionString */ \ + { 0x00000009, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* SoftwareVersion */ \ + { 0x0000000A, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* SoftwareVersionString */ \ + { 0x0000000B, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ManufacturingDate */ \ + { 0x0000000C, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* PartNumber */ \ + { 0x0000000D, ZAP_TYPE(LONG_CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ProductURL */ \ + { 0x0000000E, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ProductLabel */ \ + { 0x0000000F, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* SerialNumber */ \ + { 0x00000010, ZAP_TYPE(BOOLEAN), 1, \ + ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* LocalConfigDisabled */ \ + { 0x00000011, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(1) }, /* Reachable */ \ + { 0x00000012, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* UniqueID */ \ + { 0x00000013, ZAP_TYPE(STRUCT), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CapabilityMinima */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* DefaultOtaProviders */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* UpdatePossible */ \ + { 0x00000002, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* UpdateState */ \ + { 0x00000003, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0) }, /* UpdateStateProgress */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Localization Configuration (server) */ \ + { 0x00000000, ZAP_TYPE(CHAR_STRING), 36, ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_LONG_DEFAULTS_INDEX(0) }, /* ActiveLocale */ \ + { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedLocales */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Time Format Localization (server) */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 1, \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(0) }, /* HourFormat */ \ + { 0x00000001, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* ActiveCalendarType */ \ + { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* SupportedCalendarTypes */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: General Commissioning (server) */ \ + { 0x00000000, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(6) }, /* Breadcrumb */ \ + { 0x00000001, ZAP_TYPE(STRUCT), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* BasicCommissioningInfo */ \ + { 0x00000002, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RegulatoryConfig */ \ + { 0x00000003, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* LocationCapability */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(6) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ + { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* MaxNetworks */ \ + { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* Networks */ \ + { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* ScanMaxTimeSeconds */ \ + { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* ConnectMaxTimeSeconds */ \ + { 0x00000004, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* InterfaceEnabled */ \ + { 0x00000005, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* LastNetworkingStatus */ \ + { 0x00000006, ZAP_TYPE(OCTET_STRING), 33, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* LastNetworkID */ \ + { 0x00000007, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* LastConnectErrorValue */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(2) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* NetworkInterfaces */ \ + { 0x00000001, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RebootCount */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* UpTime */ \ + { 0x00000003, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TotalOperationalHours */ \ + { 0x00000004, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* BootReasons */ \ + { 0x00000005, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* ActiveHardwareFaults */ \ + { 0x00000006, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ActiveRadioFaults */ \ + { 0x00000007, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* ActiveNetworkFaults */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ThreadMetrics */ \ + { 0x00000001, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CurrentHeapFree */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CurrentHeapUsed */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* CurrentHeapHighWatermark */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(1) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ + { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* channel */ \ + { 0x00000001, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* RoutingRole */ \ + { 0x00000002, ZAP_TYPE(CHAR_STRING), 17, ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_LONG_DEFAULTS_INDEX(14) }, /* NetworkName */ \ + { 0x00000003, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* PanId */ \ + { 0x00000004, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(16) }, /* ExtendedPanId */ \ + { 0x00000005, ZAP_TYPE(OCTET_STRING), 18, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* MeshLocalPrefix */ \ + { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(24) }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* NeighborTableList */ \ + { 0x00000008, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RouteTableList */ \ + { 0x00000009, ZAP_TYPE(INT32U), 4, 0, ZAP_EMPTY_DEFAULT() }, /* PartitionId */ \ + { 0x0000000A, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* weighting */ \ + { 0x0000000B, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* DataVersion */ \ + { 0x0000000C, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* StableDataVersion */ \ + { 0x0000000D, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* LeaderRouterId */ \ + { 0x0000000E, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* DetachedRoleCount */ \ + { 0x0000000F, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* ChildRoleCount */ \ + { 0x00000010, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RouterRoleCount */ \ + { 0x00000011, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* LeaderRoleCount */ \ + { 0x00000012, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* AttachAttemptCount */ \ + { 0x00000013, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* PartitionIdChangeCount */ \ + { 0x00000014, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* BetterPartitionAttachAttemptCount */ \ + { 0x00000015, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* ParentChangeCount */ \ + { 0x00000016, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxTotalCount */ \ + { 0x00000017, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxUnicastCount */ \ + { 0x00000018, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxBroadcastCount */ \ + { 0x00000019, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxAckRequestedCount */ \ + { 0x0000001A, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxAckedCount */ \ + { 0x0000001B, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxNoAckRequestedCount */ \ + { 0x0000001C, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxDataCount */ \ + { 0x0000001D, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxDataPollCount */ \ + { 0x0000001E, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxBeaconCount */ \ + { 0x0000001F, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxBeaconRequestCount */ \ + { 0x00000020, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxOtherCount */ \ + { 0x00000021, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxRetryCount */ \ + { 0x00000022, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxDirectMaxRetryExpiryCount */ \ + { 0x00000023, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxIndirectMaxRetryExpiryCount */ \ + { 0x00000024, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxErrCcaCount */ \ + { 0x00000025, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxErrAbortCount */ \ + { 0x00000026, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxErrBusyChannelCount */ \ + { 0x00000027, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxTotalCount */ \ + { 0x00000028, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxUnicastCount */ \ + { 0x00000029, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxBroadcastCount */ \ + { 0x0000002A, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxDataCount */ \ + { 0x0000002B, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxDataPollCount */ \ + { 0x0000002C, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxBeaconCount */ \ + { 0x0000002D, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxBeaconRequestCount */ \ + { 0x0000002E, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxOtherCount */ \ + { 0x0000002F, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxAddressFilteredCount */ \ + { 0x00000030, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxDestAddrFilteredCount */ \ + { 0x00000031, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxDuplicatedCount */ \ + { 0x00000032, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrNoFrameCount */ \ + { 0x00000033, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrUnknownNeighborCount */ \ + { 0x00000034, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrInvalidSrcAddrCount */ \ + { 0x00000035, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrSecCount */ \ + { 0x00000036, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrFcsCount */ \ + { 0x00000037, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrOtherCount */ \ + { 0x00000038, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(32) }, /* ActiveTimestamp */ \ + { 0x00000039, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* PendingTimestamp */ \ + { 0x0000003A, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* delay */ \ + { 0x0000003B, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SecurityPolicy */ \ + { 0x0000003C, ZAP_TYPE(OCTET_STRING), 5, 0, ZAP_LONG_DEFAULTS_INDEX(48) }, /* ChannelMask */ \ + { 0x0000003D, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* OperationalDatasetComponents */ \ + { 0x0000003E, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* ActiveNetworkFaultsList */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0x000F) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + { 0x00000000, ZAP_TYPE(OCTET_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* bssid */ \ + { 0x00000001, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* SecurityType */ \ + { 0x00000002, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* WiFiVersion */ \ + { 0x00000003, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* ChannelNumber */ \ + { 0x00000004, ZAP_TYPE(INT8S), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* Rssi */ \ + { 0x00000005, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* BeaconLostCount */ \ + { 0x00000006, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* BeaconRxCount */ \ + { 0x00000007, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* PacketMulticastRxCount */ \ + { 0x00000008, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* PacketMulticastTxCount */ \ + { 0x00000009, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* PacketUnicastRxCount */ \ + { 0x0000000A, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* PacketUnicastTxCount */ \ + { 0x0000000B, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CurrentMaxRate */ \ + { 0x0000000C, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(3) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(3) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ + { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ + { 0x00000001, ZAP_TYPE(FABRIC_IDX), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* AdminFabricIndex */ \ + { 0x00000002, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AdminVendorId */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* NOCs */ \ + { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* Fabrics */ \ + { 0x00000002, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedFabrics */ \ + { 0x00000003, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* CommissionedFabrics */ \ + { 0x00000004, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TrustedRootCertificates */ \ + { 0x00000005, ZAP_TYPE(FABRIC_IDX), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* CurrentFabricIndex */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Group Key Management (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* GroupKeyMap */ \ + { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* GroupTable */ \ + { 0x00000002, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* MaxGroupsPerFabric */ \ + { 0x00000003, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* MaxGroupKeysPerFabric */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: Fixed Label (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* label list */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: User Label (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* label list */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ + /* Endpoint: 1, Cluster: Identify (server) */ \ + { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* identify time */ \ + { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* identify type */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ + \ + /* Endpoint: 1, Cluster: Groups (server) */ \ + { 0x00000000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* name support */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ + \ + /* Endpoint: 1, Cluster: On/Off (server) */ \ + { 0x00000000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE), ZAP_SIMPLE_DEFAULT(0x00) }, /* OnOff */ \ + { 0x00004000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* GlobalSceneControl */ \ + { 0x00004001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OnTime */ \ + { 0x00004002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OffWaitTime */ \ + { 0x00004003, ZAP_TYPE(ENUM8), 1, \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ + ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* StartUpOnOff */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(1) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ + \ + /* Endpoint: 1, Cluster: Level Control (server) */ \ + { 0x00000000, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE), ZAP_SIMPLE_DEFAULT(0x01) }, /* current level */ \ + { 0x00000001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* remaining time */ \ + { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* min level */ \ + { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xFE) }, /* max level */ \ + { 0x00000004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* current frequency */ \ + { 0x00000005, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* min frequency */ \ + { 0x00000006, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* max frequency */ \ + { 0x0000000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* options */ \ + { 0x00000010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_SIMPLE_DEFAULT(0x0000) }, /* on off transition time */ \ + { 0x00000011, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0xFF) }, /* on level */ \ + { 0x00000012, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* on transition time */ \ + { 0x00000013, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* off transition time */ \ + { 0x00000014, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* default move rate */ \ + { 0x00004000, ZAP_TYPE(INT8U), 1, \ + ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(255) }, /* start up current level */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(3) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ + \ + /* Endpoint: 1, Cluster: Descriptor (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* device list */ \ + { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* server list */ \ + { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* client list */ \ + { 0x00000003, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* parts list */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ClusterRevision */ \ + \ + /* Endpoint: 1, Cluster: Color Control (server) */ \ + { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current hue */ \ + { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current saturation */ \ + { 0x00000002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* remaining time */ \ + { 0x00000003, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x616B) }, /* current x */ \ + { 0x00000004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x607D) }, /* current y */ \ + { 0x00000007, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x00FA) }, /* color temperature */ \ + { 0x00000008, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* color mode */ \ + { 0x0000000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_SIMPLE_DEFAULT(0x00) }, /* color control options */ \ + { 0x00000010, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* number of primaries */ \ + { 0x00004000, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* enhanced current hue */ \ + { 0x00004001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* enhanced color mode */ \ + { 0x00004002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* color loop active */ \ + { 0x00004003, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* color loop direction */ \ + { 0x00004004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0019) }, /* color loop time */ \ + { 0x00004005, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x2300) }, /* color loop start enhanced hue */ \ + { 0x00004006, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color loop stored enhanced hue */ \ + { 0x0000400A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color capabilities */ \ + { 0x0000400B, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color temp physical min */ \ + { 0x0000400C, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFEFF) }, /* color temp physical max */ \ + { 0x0000400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \ + { 0x00004010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* start up color temperature mireds */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ + \ + /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ + { 0x00000000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* occupancy */ \ + { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* occupancy sensor type */ \ + { 0x00000002, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* occupancy sensor type bitmap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ + } + +// This is an array of EmberAfCluster structures. +#define ZAP_ATTRIBUTE_INDEX(index) (&generatedAttributes[index]) + +#define ZAP_GENERATED_COMMANDS_INDEX(index) ((chip::CommandId *) (&generatedCommands[index])) + +// Cluster function static arrays +#define GENERATED_FUNCTION_ARRAYS \ + const EmberAfGenericClusterFunction chipFuncArrayGroupsServer[] = { \ + (EmberAfGenericClusterFunction) emberAfGroupsClusterServerInitCallback, \ + }; \ + const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \ + (EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \ + }; \ + const EmberAfGenericClusterFunction chipFuncArrayLocalizationConfigurationServer[] = { \ + (EmberAfGenericClusterFunction) emberAfLocalizationConfigurationClusterServerInitCallback, \ + (EmberAfGenericClusterFunction) MatterLocalizationConfigurationClusterServerPreAttributeChangedCallback, \ + }; \ + const EmberAfGenericClusterFunction chipFuncArrayTimeFormatLocalizationServer[] = { \ + (EmberAfGenericClusterFunction) emberAfTimeFormatLocalizationClusterServerInitCallback, \ + (EmberAfGenericClusterFunction) MatterTimeFormatLocalizationClusterServerPreAttributeChangedCallback, \ + }; \ + const EmberAfGenericClusterFunction chipFuncArrayIdentifyServer[] = { \ + (EmberAfGenericClusterFunction) emberAfIdentifyClusterServerInitCallback, \ + (EmberAfGenericClusterFunction) MatterIdentifyClusterServerAttributeChangedCallback, \ + }; \ + const EmberAfGenericClusterFunction chipFuncArrayOnOffServer[] = { \ + (EmberAfGenericClusterFunction) emberAfOnOffClusterServerInitCallback, \ + }; \ + const EmberAfGenericClusterFunction chipFuncArrayLevelControlServer[] = { \ + (EmberAfGenericClusterFunction) emberAfLevelControlClusterServerInitCallback, \ + }; \ + const EmberAfGenericClusterFunction chipFuncArrayColorControlServer[] = { \ + (EmberAfGenericClusterFunction) emberAfColorControlClusterServerInitCallback, \ + }; \ + const EmberAfGenericClusterFunction chipFuncArrayOccupancySensingServer[] = { \ + (EmberAfGenericClusterFunction) emberAfOccupancySensingClusterServerInitCallback, \ + }; + +// clang-format off +#define GENERATED_COMMANDS { \ + /* Endpoint: 0, Cluster: Groups (server) */\ + /* AcceptedCommandList (index=0) */ \ + 0x00000000 /* AddGroup */, \ + 0x00000001 /* ViewGroup */, \ + 0x00000002 /* GetGroupMembership */, \ + 0x00000003 /* RemoveGroup */, \ + 0x00000004 /* RemoveAllGroups */, \ + 0x00000005 /* AddGroupIfIdentifying */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=7)*/ \ + 0x00000000 /* AddGroupResponse */, \ + 0x00000001 /* ViewGroupResponse */, \ + 0x00000002 /* GetGroupMembershipResponse */, \ + 0x00000003 /* RemoveGroupResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */\ + /* AcceptedCommandList (index=12) */ \ + 0x00000000 /* AnnounceOtaProvider */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: General Commissioning (server) */\ + /* AcceptedCommandList (index=14) */ \ + 0x00000000 /* ArmFailSafe */, \ + 0x00000002 /* SetRegulatoryConfig */, \ + 0x00000004 /* CommissioningComplete */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=18)*/ \ + 0x00000001 /* ArmFailSafeResponse */, \ + 0x00000003 /* SetRegulatoryConfigResponse */, \ + 0x00000005 /* CommissioningCompleteResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Network Commissioning (server) */\ + /* AcceptedCommandList (index=22) */ \ + 0x00000000 /* ScanNetworks */, \ + 0x00000002 /* AddOrUpdateWiFiNetwork */, \ + 0x00000003 /* AddOrUpdateThreadNetwork */, \ + 0x00000004 /* RemoveNetwork */, \ + 0x00000006 /* ConnectNetwork */, \ + 0x00000008 /* ReorderNetwork */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=29)*/ \ + 0x00000001 /* ScanNetworksResponse */, \ + 0x00000005 /* NetworkConfigResponse */, \ + 0x00000007 /* ConnectNetworkResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Diagnostic Logs (server) */\ + /* AcceptedCommandList (index=33) */ \ + 0x00000000 /* RetrieveLogsRequest */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=35)*/ \ + 0x00000001 /* RetrieveLogsResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Software Diagnostics (server) */\ + /* AcceptedCommandList (index=37) */ \ + 0x00000000 /* ResetWatermarks */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */\ + /* AcceptedCommandList (index=39) */ \ + 0x00000000 /* ResetCounts */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */\ + /* AcceptedCommandList (index=41) */ \ + 0x00000000 /* ResetCounts */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */\ + /* AcceptedCommandList (index=43) */ \ + 0x00000000 /* ResetCounts */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */\ + /* AcceptedCommandList (index=45) */ \ + 0x00000000 /* OpenCommissioningWindow */, \ + 0x00000001 /* OpenBasicCommissioningWindow */, \ + 0x00000002 /* RevokeCommissioning */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Operational Credentials (server) */\ + /* AcceptedCommandList (index=49) */ \ + 0x00000000 /* AttestationRequest */, \ + 0x00000002 /* CertificateChainRequest */, \ + 0x00000004 /* CSRRequest */, \ + 0x00000006 /* AddNOC */, \ + 0x00000007 /* UpdateNOC */, \ + 0x00000009 /* UpdateFabricLabel */, \ + 0x0000000A /* RemoveFabric */, \ + 0x0000000B /* AddTrustedRootCertificate */, \ + 0x0000000C /* RemoveTrustedRootCertificate */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=59)*/ \ + 0x00000001 /* AttestationResponse */, \ + 0x00000003 /* CertificateChainResponse */, \ + 0x00000005 /* CSRResponse */, \ + 0x00000008 /* NOCResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Group Key Management (server) */\ + /* AcceptedCommandList (index=64) */ \ + 0x00000000 /* KeySetWrite */, \ + 0x00000001 /* KeySetRead */, \ + 0x00000003 /* KeySetRemove */, \ + 0x00000004 /* KeySetReadAllIndices */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=69)*/ \ + 0x00000002 /* KeySetReadResponse */, \ + 0x00000005 /* KeySetReadAllIndicesResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 1, Cluster: Identify (server) */\ + /* AcceptedCommandList (index=72) */ \ + 0x00000000 /* Identify */, \ + 0x00000001 /* IdentifyQuery */, \ + 0x00000040 /* TriggerEffect */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=76)*/ \ + 0x00000000 /* IdentifyQueryResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 1, Cluster: Groups (server) */\ + /* AcceptedCommandList (index=78) */ \ + 0x00000000 /* AddGroup */, \ + 0x00000001 /* ViewGroup */, \ + 0x00000002 /* GetGroupMembership */, \ + 0x00000003 /* RemoveGroup */, \ + 0x00000004 /* RemoveAllGroups */, \ + 0x00000005 /* AddGroupIfIdentifying */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=85)*/ \ + 0x00000000 /* AddGroupResponse */, \ + 0x00000001 /* ViewGroupResponse */, \ + 0x00000002 /* GetGroupMembershipResponse */, \ + 0x00000003 /* RemoveGroupResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 1, Cluster: On/Off (server) */\ + /* AcceptedCommandList (index=90) */ \ + 0x00000000 /* Off */, \ + 0x00000001 /* On */, \ + 0x00000002 /* Toggle */, \ + 0x00000040 /* OffWithEffect */, \ + 0x00000041 /* OnWithRecallGlobalScene */, \ + 0x00000042 /* OnWithTimedOff */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 1, Cluster: Level Control (server) */\ + /* AcceptedCommandList (index=97) */ \ + 0x00000000 /* MoveToLevel */, \ + 0x00000001 /* Move */, \ + 0x00000002 /* Step */, \ + 0x00000003 /* Stop */, \ + 0x00000004 /* MoveToLevelWithOnOff */, \ + 0x00000005 /* MoveWithOnOff */, \ + 0x00000006 /* StepWithOnOff */, \ + 0x00000007 /* StopWithOnOff */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 1, Cluster: Color Control (server) */\ + /* AcceptedCommandList (index=106) */ \ + 0x00000000 /* MoveToHue */, \ + 0x00000001 /* MoveHue */, \ + 0x00000002 /* StepHue */, \ + 0x00000003 /* MoveToSaturation */, \ + 0x00000004 /* MoveSaturation */, \ + 0x00000005 /* StepSaturation */, \ + 0x00000006 /* MoveToHueAndSaturation */, \ + 0x00000007 /* MoveToColor */, \ + 0x00000008 /* MoveColor */, \ + 0x00000009 /* StepColor */, \ + 0x0000000A /* MoveToColorTemperature */, \ + 0x00000040 /* EnhancedMoveToHue */, \ + 0x00000041 /* EnhancedMoveHue */, \ + 0x00000042 /* EnhancedStepHue */, \ + 0x00000043 /* EnhancedMoveToHueAndSaturation */, \ + 0x00000044 /* ColorLoopSet */, \ + 0x00000047 /* StopMoveStep */, \ + 0x0000004B /* MoveColorTemperature */, \ + 0x0000004C /* StepColorTemperature */, \ + chip::kInvalidCommandId /* end of list */, \ +} + +// clang-format on + +#define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask +#define GENERATED_CLUSTER_COUNT 29 + +// clang-format off +#define GENERATED_CLUSTERS { \ + { \ + /* Endpoint: 0, Cluster: Groups (server) */ \ + .clusterId = 0x00000004, \ + .attributes = ZAP_ATTRIBUTE_INDEX(0), \ + .attributeCount = 2, \ + .clusterSize = 3, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayGroupsServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 0 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 7 ) ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Descriptor (server) */ \ + .clusterId = 0x0000001D, \ + .attributes = ZAP_ATTRIBUTE_INDEX(2), \ + .attributeCount = 5, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Access Control (server) */ \ + .clusterId = 0x0000001F, \ + .attributes = ZAP_ATTRIBUTE_INDEX(7), \ + .attributeCount = 6, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Basic (server) */ \ + .clusterId = 0x00000028, \ + .attributes = ZAP_ATTRIBUTE_INDEX(13), \ + .attributeCount = 21, \ + .clusterSize = 37, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayBasicServer, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ + .clusterId = 0x00000029, \ + .attributes = ZAP_ATTRIBUTE_INDEX(34), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */ \ + .clusterId = 0x0000002A, \ + .attributes = ZAP_ATTRIBUTE_INDEX(34), \ + .attributeCount = 5, \ + .clusterSize = 5, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 12 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Localization Configuration (server) */ \ + .clusterId = 0x0000002B, \ + .attributes = ZAP_ATTRIBUTE_INDEX(39), \ + .attributeCount = 3, \ + .clusterSize = 38, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayLocalizationConfigurationServer, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Time Format Localization (server) */ \ + .clusterId = 0x0000002C, \ + .attributes = ZAP_ATTRIBUTE_INDEX(42), \ + .attributeCount = 4, \ + .clusterSize = 4, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayTimeFormatLocalizationServer, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: General Commissioning (server) */ \ + .clusterId = 0x00000030, \ + .attributes = ZAP_ATTRIBUTE_INDEX(46), \ + .attributeCount = 6, \ + .clusterSize = 14, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 14 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 18 ) ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ + .clusterId = 0x00000031, \ + .attributes = ZAP_ATTRIBUTE_INDEX(52), \ + .attributeCount = 10, \ + .clusterSize = 48, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 22 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 29 ) ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Diagnostic Logs (server) */ \ + .clusterId = 0x00000032, \ + .attributes = ZAP_ATTRIBUTE_INDEX(62), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 33 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 35 ) ,\ + },\ + { \ + /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ + .clusterId = 0x00000033, \ + .attributes = ZAP_ATTRIBUTE_INDEX(62), \ + .attributeCount = 9, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ + .clusterId = 0x00000034, \ + .attributes = ZAP_ATTRIBUTE_INDEX(71), \ + .attributeCount = 6, \ + .clusterSize = 6, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 37 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ + .clusterId = 0x00000035, \ + .attributes = ZAP_ATTRIBUTE_INDEX(77), \ + .attributeCount = 65, \ + .clusterSize = 247, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 39 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + .clusterId = 0x00000036, \ + .attributes = ZAP_ATTRIBUTE_INDEX(142), \ + .attributeCount = 15, \ + .clusterSize = 6, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 41 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ + .clusterId = 0x00000037, \ + .attributes = ZAP_ATTRIBUTE_INDEX(157), \ + .attributeCount = 11, \ + .clusterSize = 6, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 43 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Switch (server) */ \ + .clusterId = 0x0000003B, \ + .attributes = ZAP_ATTRIBUTE_INDEX(168), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ + .clusterId = 0x0000003C, \ + .attributes = ZAP_ATTRIBUTE_INDEX(168), \ + .attributeCount = 4, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 45 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ + .clusterId = 0x0000003E, \ + .attributes = ZAP_ATTRIBUTE_INDEX(172), \ + .attributeCount = 7, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 49 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 59 ) ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Group Key Management (server) */ \ + .clusterId = 0x0000003F, \ + .attributes = ZAP_ATTRIBUTE_INDEX(179), \ + .attributeCount = 5, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 64 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 69 ) ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Fixed Label (server) */ \ + .clusterId = 0x00000040, \ + .attributes = ZAP_ATTRIBUTE_INDEX(184), \ + .attributeCount = 2, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: User Label (server) */ \ + .clusterId = 0x00000041, \ + .attributes = ZAP_ATTRIBUTE_INDEX(186), \ + .attributeCount = 2, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Identify (server) */ \ + .clusterId = 0x00000003, \ + .attributes = ZAP_ATTRIBUTE_INDEX(188), \ + .attributeCount = 3, \ + .clusterSize = 5, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayIdentifyServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 72 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 76 ) ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Groups (server) */ \ + .clusterId = 0x00000004, \ + .attributes = ZAP_ATTRIBUTE_INDEX(191), \ + .attributeCount = 2, \ + .clusterSize = 3, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayGroupsServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 78 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 85 ) ,\ + },\ + { \ + /* Endpoint: 1, Cluster: On/Off (server) */ \ + .clusterId = 0x00000006, \ + .attributes = ZAP_ATTRIBUTE_INDEX(193), \ + .attributeCount = 7, \ + .clusterSize = 13, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayOnOffServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 90 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Level Control (server) */ \ + .clusterId = 0x00000008, \ + .attributes = ZAP_ATTRIBUTE_INDEX(200), \ + .attributeCount = 16, \ + .clusterSize = 27, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayLevelControlServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 97 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Descriptor (server) */ \ + .clusterId = 0x0000001D, \ + .attributes = ZAP_ATTRIBUTE_INDEX(216), \ + .attributeCount = 5, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Color Control (server) */ \ + .clusterId = 0x00000300, \ + .attributes = ZAP_ATTRIBUTE_INDEX(221), \ + .attributeCount = 22, \ + .clusterSize = 36, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayColorControlServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 106 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ + .clusterId = 0x00000406, \ + .attributes = ZAP_ATTRIBUTE_INDEX(243), \ + .attributeCount = 4, \ + .clusterSize = 5, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayOccupancySensingServer, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ +} + +// clang-format on + +#define ZAP_CLUSTER_INDEX(index) (&generatedClusters[index]) + +#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 28 + +// This is an array of EmberAfEndpointType structures. +#define GENERATED_ENDPOINT_TYPES \ + { \ + { ZAP_CLUSTER_INDEX(0), 22, 428 }, { ZAP_CLUSTER_INDEX(22), 7, 89 }, \ + } + +// Largest attribute size is needed for various buffers +#define ATTRIBUTE_LARGEST (259) + +static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); + +// Total size of singleton attributes +#define ATTRIBUTE_SINGLETONS_SIZE (37) + +// Total size of attribute storage +#define ATTRIBUTE_MAX_SIZE (517) + +// Number of fixed endpoints +#define FIXED_ENDPOINT_COUNT (2) + +// Array of endpoints that are supported, the data inside +// the array is the endpoint number. +#define FIXED_ENDPOINT_ARRAY \ + { \ + 0x0000, 0x0001 \ + } + +// Array of profile ids +#define FIXED_PROFILE_IDS \ + { \ + 0x0103, 0x0103 \ + } + +// Array of device types +#define FIXED_DEVICE_TYPES \ + { \ + { 0x0016, 1 }, { 0x0101, 1 } \ + } + +// Array of device type offsets +#define FIXED_DEVICE_TYPE_OFFSETS \ + { \ + 0, 1 \ + } + +// Array of device type lengths +#define FIXED_DEVICE_TYPE_LENGTHS \ + { \ + 1, 1 \ + } + +// Array of endpoint types supported on each endpoint +#define FIXED_ENDPOINT_TYPES \ + { \ + 0, 1 \ + } + +// Array of networks supported on each endpoint +#define FIXED_NETWORKS \ + { \ + 0, 0 \ + } diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/gen_config.h b/examples/chef/zzz_generated/lighting-app/zap-generated/gen_config.h new file mode 100644 index 00000000000000..efc7a77b3d5c58 --- /dev/null +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/gen_config.h @@ -0,0 +1,202 @@ +/* + * + * 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +// User options for plugin Binding Table Library +#define EMBER_BINDING_TABLE_SIZE 10 + +/**** Network Section ****/ +#define EMBER_SUPPORTED_NETWORKS (1) + +#define EMBER_APS_UNICAST_MESSAGE_COUNT 10 + +/**** Cluster endpoint counts ****/ +#define EMBER_AF_ACCESS_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_ADMINISTRATOR_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_DESCRIPTOR_CLUSTER_SERVER_ENDPOINT_COUNT (2) +#define EMBER_AF_DIAGNOSTIC_LOGS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_FIXED_LABEL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_GENERAL_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_GROUPS_CLUSTER_SERVER_ENDPOINT_COUNT (2) +#define EMBER_AF_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_LOCALIZATION_CONFIGURATION_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_OTA_PROVIDER_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_OTA_REQUESTOR_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_OCCUPANCY_SENSING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_SOFTWARE_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_THREAD_NETWORK_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_TIME_FORMAT_LOCALIZATION_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_USER_LABEL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) + +/**** Cluster Plugins ****/ + +// Use this macro to check if the server side of the Access Control cluster is included +#define ZCL_USING_ACCESS_CONTROL_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_ACCESS_CONTROL_SERVER +#define EMBER_AF_PLUGIN_ACCESS_CONTROL + +// Use this macro to check if the server side of the AdministratorCommissioning cluster is included +#define ZCL_USING_ADMINISTRATOR_COMMISSIONING_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_ADMINISTRATOR_COMMISSIONING_SERVER +#define EMBER_AF_PLUGIN_ADMINISTRATOR_COMMISSIONING + +// Use this macro to check if the server side of the Basic cluster is included +#define ZCL_USING_BASIC_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_BASIC_SERVER +#define EMBER_AF_PLUGIN_BASIC + +// Use this macro to check if the server side of the Color Control cluster is included +#define ZCL_USING_COLOR_CONTROL_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER +#define EMBER_AF_PLUGIN_COLOR_CONTROL +// User options for server plugin Color Control +#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_XY +#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP +#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_HSV + +// Use this macro to check if the server side of the Descriptor cluster is included +#define ZCL_USING_DESCRIPTOR_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_DESCRIPTOR_SERVER +#define EMBER_AF_PLUGIN_DESCRIPTOR + +// Use this macro to check if the server side of the Diagnostic Logs cluster is included +#define ZCL_USING_DIAGNOSTIC_LOGS_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_DIAGNOSTIC_LOGS_SERVER +#define EMBER_AF_PLUGIN_DIAGNOSTIC_LOGS + +// Use this macro to check if the server side of the Ethernet Network Diagnostics cluster is included +#define ZCL_USING_ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_ETHERNET_NETWORK_DIAGNOSTICS_SERVER +#define EMBER_AF_PLUGIN_ETHERNET_NETWORK_DIAGNOSTICS + +// Use this macro to check if the server side of the Fixed Label cluster is included +#define ZCL_USING_FIXED_LABEL_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_FIXED_LABEL_SERVER +#define EMBER_AF_PLUGIN_FIXED_LABEL + +// Use this macro to check if the server side of the General Commissioning cluster is included +#define ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING_SERVER +#define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING + +// Use this macro to check if the server side of the General Diagnostics cluster is included +#define ZCL_USING_GENERAL_DIAGNOSTICS_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_GENERAL_DIAGNOSTICS_SERVER +#define EMBER_AF_PLUGIN_GENERAL_DIAGNOSTICS + +// Use this macro to check if the server side of the Group Key Management cluster is included +#define ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_GROUP_KEY_MANAGEMENT_SERVER +#define EMBER_AF_PLUGIN_GROUP_KEY_MANAGEMENT + +// Use this macro to check if the server side of the Groups cluster is included +#define ZCL_USING_GROUPS_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_GROUPS_SERVER +#define EMBER_AF_PLUGIN_GROUPS + +// Use this macro to check if the server side of the Identify cluster is included +#define ZCL_USING_IDENTIFY_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_IDENTIFY_SERVER +#define EMBER_AF_PLUGIN_IDENTIFY + +// Use this macro to check if the server side of the Level Control cluster is included +#define ZCL_USING_LEVEL_CONTROL_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_LEVEL_CONTROL_SERVER +#define EMBER_AF_PLUGIN_LEVEL_CONTROL +// User options for server plugin Level Control +#define EMBER_AF_PLUGIN_LEVEL_CONTROL_MAXIMUM_LEVEL 254 +#define EMBER_AF_PLUGIN_LEVEL_CONTROL_MINIMUM_LEVEL 0 +#define EMBER_AF_PLUGIN_LEVEL_CONTROL_RATE 0 + +// Use this macro to check if the server side of the Localization Configuration cluster is included +#define ZCL_USING_LOCALIZATION_CONFIGURATION_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_LOCALIZATION_CONFIGURATION_SERVER +#define EMBER_AF_PLUGIN_LOCALIZATION_CONFIGURATION + +// Use this macro to check if the server side of the Network Commissioning cluster is included +#define ZCL_USING_NETWORK_COMMISSIONING_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING_SERVER +#define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING + +// Use this macro to check if the client side of the OTA Software Update Provider cluster is included +#define ZCL_USING_OTA_PROVIDER_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_OTA_SOFTWARE_UPDATE_PROVIDER_CLIENT + +// Use this macro to check if the server side of the OTA Software Update Requestor cluster is included +#define ZCL_USING_OTA_REQUESTOR_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_OTA_SOFTWARE_UPDATE_REQUESTOR_SERVER +#define EMBER_AF_PLUGIN_OTA_SOFTWARE_UPDATE_REQUESTOR + +// Use this macro to check if the server side of the Occupancy Sensing cluster is included +#define ZCL_USING_OCCUPANCY_SENSING_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_OCCUPANCY_SENSING_SERVER +#define EMBER_AF_PLUGIN_OCCUPANCY_SENSING + +// Use this macro to check if the server side of the On/Off cluster is included +#define ZCL_USING_ON_OFF_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_ON_OFF_SERVER +#define EMBER_AF_PLUGIN_ON_OFF + +// Use this macro to check if the server side of the Operational Credentials cluster is included +#define ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_OPERATIONAL_CREDENTIALS_SERVER +#define EMBER_AF_PLUGIN_OPERATIONAL_CREDENTIALS + +// Use this macro to check if the server side of the Software Diagnostics cluster is included +#define ZCL_USING_SOFTWARE_DIAGNOSTICS_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_SOFTWARE_DIAGNOSTICS_SERVER +#define EMBER_AF_PLUGIN_SOFTWARE_DIAGNOSTICS + +// Use this macro to check if the server side of the Switch cluster is included +#define ZCL_USING_SWITCH_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_SWITCH_SERVER +#define EMBER_AF_PLUGIN_SWITCH + +// Use this macro to check if the server side of the Thread Network Diagnostics cluster is included +#define ZCL_USING_THREAD_NETWORK_DIAGNOSTICS_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_THREAD_NETWORK_DIAGNOSTICS_SERVER +#define EMBER_AF_PLUGIN_THREAD_NETWORK_DIAGNOSTICS + +// Use this macro to check if the server side of the Time Format Localization cluster is included +#define ZCL_USING_TIME_FORMAT_LOCALIZATION_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_TIME_FORMAT_LOCALIZATION_SERVER +#define EMBER_AF_PLUGIN_TIME_FORMAT_LOCALIZATION + +// Use this macro to check if the server side of the User Label cluster is included +#define ZCL_USING_USER_LABEL_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_USER_LABEL_SERVER +#define EMBER_AF_PLUGIN_USER_LABEL + +// Use this macro to check if the server side of the WiFi Network Diagnostics cluster is included +#define ZCL_USING_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS_SERVER +#define EMBER_AF_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/gen_tokens.h b/examples/chef/zzz_generated/lighting-app/zap-generated/gen_tokens.h new file mode 100644 index 00000000000000..dcc229f5b2c306 --- /dev/null +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/gen_tokens.h @@ -0,0 +1,45 @@ +/* + * + * 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +// This file contains the tokens for attributes stored in flash + +// Identifier tags for tokens + +// Types for the tokens +#ifdef DEFINETYPES +#endif // DEFINETYPES + +// Actual token definitions +#ifdef DEFINETOKENS +#endif // DEFINETOKENS + +// Macro snippet that loads all the attributes from tokens +#define GENERATED_TOKEN_LOADER(endpoint) \ + do \ + { \ + } while (false) + +// Macro snippet that saves the attribute to token +#define GENERATED_TOKEN_SAVER \ + do \ + { \ + } while (false) diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml new file mode 100644 index 00000000000000..37d01efc3e8616 --- /dev/null +++ b/integrations/cloudbuild/chef.yaml @@ -0,0 +1,42 @@ +steps: + - name: "connectedhomeip/chip-build-vscode:0.5.75" + env: + - PW_ENVIRONMENT_ROOT=/pwenv + args: + - "-c" + - source ./scripts/bootstrap.sh + id: Bootstrap + entrypoint: /usr/bin/bash + volumes: + - name: pwenv + path: /pwenv + timeout: 900s + + - name: "connectedhomeip/chip-build-vscode:0.5.75" + env: + - PW_ENVIRONMENT_ROOT=/pwenv + args: + - >- + ./examples/chef/chef.py --build_all + id: CompileAll + waitFor: + - Bootstrap + entrypoint: ./scripts/run_in_build_env.sh + volumes: + - name: pwenv + path: /pwenv + +logsBucket: matter-build-automation-build-logs + +# Global timeout for all steps +timeout: 14400s + +artifacts: + objects: + location: "gs://matter-build-automation-artifacts/$PROJECT_ID/$COMMIT_SHA/" + paths: ["/workspace/artifacts/*.tar.gz"] +# Using higher CPU machines generally speeds up builds, except bootstrap is always +# slow. +# options: +# machineType: "E2_HIGHCPU_32" +# diskSizeGb: 200 From 75d59525e7ba6f83c89a28879cc6548ea29dd566 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Thu, 26 May 2022 20:52:19 +0000 Subject: [PATCH 02/22] Regen zzz after merge; job WAI --- examples/chef/chef.py | 2 +- examples/chef/cimanifest.json | 2 +- .../zzz_generated/lighting-app/INPUTMD5.txt | 2 +- .../zap-generated/IMClusterCommandHandler.cpp | 9 - .../lighting-app/zap-generated/access.h | 15 +- .../zap-generated/endpoint_config.h | 281 ++++++++++-------- 6 files changed, 160 insertions(+), 151 deletions(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 90fa678028dcf7..e34b8b52c1cd7b 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -273,7 +273,7 @@ def main(argv: Sequence[str]) -> None: {_CHEF_SCRIPT_PATH}/devices/{device_name}.zap -o {device_out_dir}") shell.run_cmd(f"touch {device_out_dir}/af-gen-event.h") chef_util.generate_device_manifest(_CHEF_DEVICES_DIR, include_zap_submod=True, write_manifest_file=True, - _CI_MANIFEST_FILE_NAME=_CI_MANIFEST_FILE_NAME, repo_base_path=_REPO_BASE_PATH, _CHEF_ZZZ_ROOT=_CHEF_ZZZ_ROOT) + ci_manifest_file_name=_CI_MANIFEST_FILE_NAME, repo_base_path=_REPO_BASE_PATH, chef_zzz_root=_CHEF_ZZZ_ROOT) exit(0) # diff --git a/examples/chef/cimanifest.json b/examples/chef/cimanifest.json index 318370d55f39b9..c1ee0ed009737c 100644 --- a/examples/chef/cimanifest.json +++ b/examples/chef/cimanifest.json @@ -1,4 +1,4 @@ { - "lighting-app": "41c55e72d06a04d193901d6b5487f7fa", + "lighting-app": "81a1262e611fab1a71ac4129b91cec0f", "zap_commit": "6594a9257ce96ee6d852eed052939849b31259fc" } diff --git a/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt b/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt index 1d172fc754ae6e..35888789fc11c3 100644 --- a/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt +++ b/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt @@ -1 +1 @@ -41c55e72d06a04d193901d6b5487f7fa \ No newline at end of file +81a1262e611fab1a71ac4129b91cec0f \ No newline at end of file diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp b/examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp index 616fa6db37d561..7fb7a6d52d8f47 100644 --- a/examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp @@ -593,15 +593,6 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } break; } - case Commands::IdentifyQuery::Id: { - Commands::IdentifyQuery::DecodableType commandData; - TLVError = DataModel::Decode(aDataTlv, commandData); - if (TLVError == CHIP_NO_ERROR) - { - wasHandled = emberAfIdentifyClusterIdentifyQueryCallback(apCommandObj, aCommandPath, commandData); - } - break; - } case Commands::TriggerEffect::Id: { Commands::TriggerEffect::DecodableType commandData; TLVError = DataModel::Decode(aDataTlv, commandData); diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/access.h b/examples/chef/zzz_generated/lighting-app/zap-generated/access.h index fa259c2d821d6a..a3d3005357c0f0 100644 --- a/examples/chef/zzz_generated/lighting-app/zap-generated/access.h +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/access.h @@ -37,7 +37,7 @@ /* Cluster: Basic, Attribute: NodeLabel, Privilege: view */ \ /* Cluster: Basic, Attribute: Location, Privilege: view */ \ /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: view */ \ - /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: view */ \ + /* Cluster: Color Control, Attribute: StartUpColorTemperatureMireds, Privilege: view */ \ /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: view */ \ /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: view */ \ /* Cluster: Level Control, Attribute: start up current level, Privilege: view */ \ @@ -62,7 +62,7 @@ /* Cluster: Basic, Attribute: NodeLabel, Privilege: view */ \ /* Cluster: Basic, Attribute: Location, Privilege: view */ \ /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: view */ \ - /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: view */ \ + /* Cluster: Color Control, Attribute: StartUpColorTemperatureMireds, Privilege: view */ \ /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: view */ \ /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: view */ \ /* Cluster: Level Control, Attribute: start up current level, Privilege: view */ \ @@ -87,7 +87,7 @@ /* Cluster: Basic, Attribute: NodeLabel, Privilege: view */ \ /* Cluster: Basic, Attribute: Location, Privilege: view */ \ /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: view */ \ - /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: view */ \ + /* Cluster: Color Control, Attribute: StartUpColorTemperatureMireds, Privilege: view */ \ /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: view */ \ /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: view */ \ /* Cluster: Level Control, Attribute: start up current level, Privilege: view */ \ @@ -111,7 +111,7 @@ 40, /* Cluster: Basic, Attribute: NodeLabel, Privilege: manage */ \ 40, /* Cluster: Basic, Attribute: Location, Privilege: administer */ \ 40, /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: manage */ \ - 768, /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: manage */ \ + 768, /* Cluster: Color Control, Attribute: StartUpColorTemperatureMireds, Privilege: manage */ \ 48, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \ 63, /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: manage */ \ 8, /* Cluster: Level Control, Attribute: start up current level, Privilege: manage */ \ @@ -127,7 +127,7 @@ 5, /* Cluster: Basic, Attribute: NodeLabel, Privilege: manage */ \ 6, /* Cluster: Basic, Attribute: Location, Privilege: administer */ \ 16, /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: manage */ \ - 16400, /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: manage */ \ + 16400, /* Cluster: Color Control, Attribute: StartUpColorTemperatureMireds, Privilege: manage */ \ 0, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \ 0, /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: manage */ \ 16384, /* Cluster: Level Control, Attribute: start up current level, Privilege: manage */ \ @@ -143,7 +143,7 @@ kMatterAccessPrivilegeManage, /* Cluster: Basic, Attribute: NodeLabel, Privilege: manage */ \ kMatterAccessPrivilegeAdminister, /* Cluster: Basic, Attribute: Location, Privilege: administer */ \ kMatterAccessPrivilegeManage, /* Cluster: Basic, Attribute: LocalConfigDisabled, Privilege: manage */ \ - kMatterAccessPrivilegeManage, /* Cluster: Color Control, Attribute: start up color temperature mireds, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Color Control, Attribute: StartUpColorTemperatureMireds, Privilege: manage */ \ kMatterAccessPrivilegeAdminister, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \ kMatterAccessPrivilegeManage, /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: manage */ \ kMatterAccessPrivilegeManage, /* Cluster: Level Control, Attribute: start up current level, Privilege: manage */ \ @@ -171,7 +171,6 @@ 4, /* Cluster: Groups, Command: RemoveAllGroups, Privilege: manage */ \ 4, /* Cluster: Groups, Command: AddGroupIfIdentifying, Privilege: manage */ \ 3, /* Cluster: Identify, Command: Identify, Privilege: manage */ \ - 3, /* Cluster: Identify, Command: IdentifyQuery, Privilege: manage */ \ 3, /* Cluster: Identify, Command: TriggerEffect, Privilege: manage */ \ 49, /* Cluster: Network Commissioning, Command: ScanNetworks, Privilege: administer */ \ 49, /* Cluster: Network Commissioning, Command: AddOrUpdateWiFiNetwork, Privilege: administer */ \ @@ -207,7 +206,6 @@ 4, /* Cluster: Groups, Command: RemoveAllGroups, Privilege: manage */ \ 5, /* Cluster: Groups, Command: AddGroupIfIdentifying, Privilege: manage */ \ 0, /* Cluster: Identify, Command: Identify, Privilege: manage */ \ - 1, /* Cluster: Identify, Command: IdentifyQuery, Privilege: manage */ \ 64, /* Cluster: Identify, Command: TriggerEffect, Privilege: manage */ \ 0, /* Cluster: Network Commissioning, Command: ScanNetworks, Privilege: administer */ \ 2, /* Cluster: Network Commissioning, Command: AddOrUpdateWiFiNetwork, Privilege: administer */ \ @@ -243,7 +241,6 @@ kMatterAccessPrivilegeManage, /* Cluster: Groups, Command: RemoveAllGroups, Privilege: manage */ \ kMatterAccessPrivilegeManage, /* Cluster: Groups, Command: AddGroupIfIdentifying, Privilege: manage */ \ kMatterAccessPrivilegeManage, /* Cluster: Identify, Command: Identify, Privilege: manage */ \ - kMatterAccessPrivilegeManage, /* Cluster: Identify, Command: IdentifyQuery, Privilege: manage */ \ kMatterAccessPrivilegeManage, /* Cluster: Identify, Command: TriggerEffect, Privilege: manage */ \ kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Command: ScanNetworks, Privilege: administer */ \ kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Command: AddOrUpdateWiFiNetwork, Privilege: administer */ \ diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h index 7cf3433cbd52b3..66901394b64b71 100644 --- a/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h @@ -134,24 +134,26 @@ /* Endpoint: 1, Cluster: Color Control (server) */ \ { \ (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xFEFF \ - } /* start up color temperature mireds */ \ + } /* StartUpColorTemperatureMireds */ \ } #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 247 +#define GENERATED_ATTRIBUTE_COUNT 269 #define GENERATED_ATTRIBUTES \ { \ \ /* Endpoint: 0, Cluster: Groups (server) */ \ - { 0x00000000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* name support */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* name support */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Descriptor (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* device list */ \ { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* server list */ \ { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* client list */ \ { 0x00000003, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* parts list */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Access Control (server) */ \ @@ -164,8 +166,9 @@ { 0x00000003, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ ZAP_EMPTY_DEFAULT() }, /* TargetsPerAccessControlEntry */ \ { 0x00000004, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ - ZAP_EMPTY_DEFAULT() }, /* AccessControlEntriesPerFabric */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + ZAP_EMPTY_DEFAULT() }, /* AccessControlEntriesPerFabric */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -209,6 +212,7 @@ { 0x00000012, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* UniqueID */ \ { 0x00000013, ZAP_TYPE(STRUCT), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CapabilityMinima */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */ \ @@ -217,12 +221,14 @@ { 0x00000001, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* UpdatePossible */ \ { 0x00000002, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* UpdateState */ \ { 0x00000003, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0) }, /* UpdateStateProgress */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Localization Configuration (server) */ \ { 0x00000000, ZAP_TYPE(CHAR_STRING), 36, ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_LONG_DEFAULTS_INDEX(0) }, /* ActiveLocale */ \ { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedLocales */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Time Format Localization (server) */ \ @@ -232,8 +238,9 @@ { 0x00000001, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* ActiveCalendarType */ \ { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ - ZAP_EMPTY_DEFAULT() }, /* SupportedCalendarTypes */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + ZAP_EMPTY_DEFAULT() }, /* SupportedCalendarTypes */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: General Commissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(6) }, /* Breadcrumb */ \ @@ -257,6 +264,10 @@ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(2) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Diagnostic Logs (server) */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* NetworkInterfaces */ \ { 0x00000001, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RebootCount */ \ @@ -268,8 +279,9 @@ ZAP_EMPTY_DEFAULT() }, /* ActiveHardwareFaults */ \ { 0x00000006, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ActiveRadioFaults */ \ { 0x00000007, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ - ZAP_EMPTY_DEFAULT() }, /* ActiveNetworkFaults */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + ZAP_EMPTY_DEFAULT() }, /* ActiveNetworkFaults */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ThreadMetrics */ \ @@ -392,11 +404,16 @@ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(3) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Switch (server) */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ { 0x00000001, ZAP_TYPE(FABRIC_IDX), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ ZAP_EMPTY_DEFAULT() }, /* AdminFabricIndex */ \ { 0x00000002, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AdminVendorId */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ @@ -408,8 +425,9 @@ { 0x00000004, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ ZAP_EMPTY_DEFAULT() }, /* TrustedRootCertificates */ \ { 0x00000005, ZAP_TYPE(FABRIC_IDX), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ - ZAP_EMPTY_DEFAULT() }, /* CurrentFabricIndex */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + ZAP_EMPTY_DEFAULT() }, /* CurrentFabricIndex */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Group Key Management (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ @@ -418,26 +436,31 @@ { 0x00000002, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ ZAP_EMPTY_DEFAULT() }, /* MaxGroupsPerFabric */ \ { 0x00000003, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ - ZAP_EMPTY_DEFAULT() }, /* MaxGroupKeysPerFabric */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + ZAP_EMPTY_DEFAULT() }, /* MaxGroupKeysPerFabric */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* label list */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: User Label (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_EMPTY_DEFAULT() }, /* label list */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + ZAP_EMPTY_DEFAULT() }, /* label list */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Identify (server) */ \ { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* identify time */ \ { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* identify type */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Groups (server) */ \ - { 0x00000000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* name support */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* name support */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: On/Off (server) */ \ { 0x00000000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE), ZAP_SIMPLE_DEFAULT(0x00) }, /* OnOff */ \ @@ -482,39 +505,41 @@ { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* server list */ \ { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* client list */ \ { 0x00000003, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* parts list */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Color Control (server) */ \ - { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current hue */ \ - { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current saturation */ \ - { 0x00000002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* remaining time */ \ - { 0x00000003, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x616B) }, /* current x */ \ - { 0x00000004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x607D) }, /* current y */ \ - { 0x00000007, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x00FA) }, /* color temperature */ \ - { 0x00000008, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* color mode */ \ - { 0x0000000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_SIMPLE_DEFAULT(0x00) }, /* color control options */ \ - { 0x00000010, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* number of primaries */ \ - { 0x00004000, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* enhanced current hue */ \ - { 0x00004001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* enhanced color mode */ \ - { 0x00004002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* color loop active */ \ - { 0x00004003, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* color loop direction */ \ - { 0x00004004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0019) }, /* color loop time */ \ - { 0x00004005, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x2300) }, /* color loop start enhanced hue */ \ - { 0x00004006, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color loop stored enhanced hue */ \ - { 0x0000400A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color capabilities */ \ - { 0x0000400B, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color temp physical min */ \ - { 0x0000400C, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFEFF) }, /* color temp physical max */ \ - { 0x0000400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \ + { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* CurrentHue */ \ + { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* CurrentSaturation */ \ + { 0x00000002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RemainingTime */ \ + { 0x00000003, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x616B) }, /* CurrentX */ \ + { 0x00000004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x607D) }, /* CurrentY */ \ + { 0x00000007, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x00FA) }, /* ColorTemperature */ \ + { 0x00000008, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* ColorMode */ \ + { 0x0000000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* Options */ \ + { 0x00000010, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* NumberOfPrimaries */ \ + { 0x00004000, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* EnhancedCurrentHue */ \ + { 0x00004001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* EnhancedColorMode */ \ + { 0x00004002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* ColorLoopActive */ \ + { 0x00004003, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* ColorLoopDirection */ \ + { 0x00004004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0019) }, /* ColorLoopTime */ \ + { 0x00004005, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x2300) }, /* ColorLoopStartEnhancedHue */ \ + { 0x00004006, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* ColorLoopStoredEnhancedHue */ \ + { 0x0000400A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* ColorCapabilities */ \ + { 0x0000400B, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* ColorTempPhysicalMinMireds */ \ + { 0x0000400C, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFEFF) }, /* ColorTempPhysicalMaxMireds */ \ + { 0x0000400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* CoupleColorTempToLevelMinMireds */ \ { 0x00004010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* start up color temperature mireds */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* StartUpColorTemperatureMireds */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ - { 0x00000000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* occupancy */ \ - { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* occupancy sensor type */ \ - { 0x00000002, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* occupancy sensor type bitmap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* occupancy */ \ + { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* occupancy sensor type */ \ + { 0x00000002, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* occupancy sensor type bitmap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ } // This is an array of EmberAfCluster structures. @@ -662,14 +687,10 @@ /* Endpoint: 1, Cluster: Identify (server) */\ /* AcceptedCommandList (index=72) */ \ 0x00000000 /* Identify */, \ - 0x00000001 /* IdentifyQuery */, \ 0x00000040 /* TriggerEffect */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=76)*/ \ - 0x00000000 /* IdentifyQueryResponse */, \ - chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Groups (server) */\ - /* AcceptedCommandList (index=78) */ \ + /* AcceptedCommandList (index=75) */ \ 0x00000000 /* AddGroup */, \ 0x00000001 /* ViewGroup */, \ 0x00000002 /* GetGroupMembership */, \ @@ -677,14 +698,14 @@ 0x00000004 /* RemoveAllGroups */, \ 0x00000005 /* AddGroupIfIdentifying */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=85)*/ \ + /* GeneratedCommandList (index=82)*/ \ 0x00000000 /* AddGroupResponse */, \ 0x00000001 /* ViewGroupResponse */, \ 0x00000002 /* GetGroupMembershipResponse */, \ 0x00000003 /* RemoveGroupResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: On/Off (server) */\ - /* AcceptedCommandList (index=90) */ \ + /* AcceptedCommandList (index=87) */ \ 0x00000000 /* Off */, \ 0x00000001 /* On */, \ 0x00000002 /* Toggle */, \ @@ -693,7 +714,7 @@ 0x00000042 /* OnWithTimedOff */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Level Control (server) */\ - /* AcceptedCommandList (index=97) */ \ + /* AcceptedCommandList (index=94) */ \ 0x00000000 /* MoveToLevel */, \ 0x00000001 /* Move */, \ 0x00000002 /* Step */, \ @@ -704,7 +725,7 @@ 0x00000007 /* StopWithOnOff */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Color Control (server) */\ - /* AcceptedCommandList (index=106) */ \ + /* AcceptedCommandList (index=103) */ \ 0x00000000 /* MoveToHue */, \ 0x00000001 /* MoveHue */, \ 0x00000002 /* StepHue */, \ @@ -738,8 +759,8 @@ /* Endpoint: 0, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ .attributes = ZAP_ATTRIBUTE_INDEX(0), \ - .attributeCount = 2, \ - .clusterSize = 3, \ + .attributeCount = 3, \ + .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 0 ) ,\ @@ -748,9 +769,9 @@ { \ /* Endpoint: 0, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(2), \ - .attributeCount = 5, \ - .clusterSize = 0, \ + .attributes = ZAP_ATTRIBUTE_INDEX(3), \ + .attributeCount = 6, \ + .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = nullptr ,\ @@ -759,9 +780,9 @@ { \ /* Endpoint: 0, Cluster: Access Control (server) */ \ .clusterId = 0x0000001F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(7), \ - .attributeCount = 6, \ - .clusterSize = 2, \ + .attributes = ZAP_ATTRIBUTE_INDEX(9), \ + .attributeCount = 7, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = nullptr ,\ @@ -770,9 +791,9 @@ { \ /* Endpoint: 0, Cluster: Basic (server) */ \ .clusterId = 0x00000028, \ - .attributes = ZAP_ATTRIBUTE_INDEX(13), \ - .attributeCount = 21, \ - .clusterSize = 37, \ + .attributes = ZAP_ATTRIBUTE_INDEX(16), \ + .attributeCount = 22, \ + .clusterSize = 41, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -781,7 +802,7 @@ { \ /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ .clusterId = 0x00000029, \ - .attributes = ZAP_ATTRIBUTE_INDEX(34), \ + .attributes = ZAP_ATTRIBUTE_INDEX(38), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -792,9 +813,9 @@ { \ /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */ \ .clusterId = 0x0000002A, \ - .attributes = ZAP_ATTRIBUTE_INDEX(34), \ - .attributeCount = 5, \ - .clusterSize = 5, \ + .attributes = ZAP_ATTRIBUTE_INDEX(38), \ + .attributeCount = 6, \ + .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 12 ) ,\ @@ -803,9 +824,9 @@ { \ /* Endpoint: 0, Cluster: Localization Configuration (server) */ \ .clusterId = 0x0000002B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(39), \ - .attributeCount = 3, \ - .clusterSize = 38, \ + .attributes = ZAP_ATTRIBUTE_INDEX(44), \ + .attributeCount = 4, \ + .clusterSize = 42, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayLocalizationConfigurationServer, \ .acceptedCommandList = nullptr ,\ @@ -814,9 +835,9 @@ { \ /* Endpoint: 0, Cluster: Time Format Localization (server) */ \ .clusterId = 0x0000002C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(42), \ - .attributeCount = 4, \ - .clusterSize = 4, \ + .attributes = ZAP_ATTRIBUTE_INDEX(48), \ + .attributeCount = 5, \ + .clusterSize = 8, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayTimeFormatLocalizationServer, \ .acceptedCommandList = nullptr ,\ @@ -825,7 +846,7 @@ { \ /* Endpoint: 0, Cluster: General Commissioning (server) */ \ .clusterId = 0x00000030, \ - .attributes = ZAP_ATTRIBUTE_INDEX(46), \ + .attributes = ZAP_ATTRIBUTE_INDEX(53), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -836,7 +857,7 @@ { \ /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ .clusterId = 0x00000031, \ - .attributes = ZAP_ATTRIBUTE_INDEX(52), \ + .attributes = ZAP_ATTRIBUTE_INDEX(59), \ .attributeCount = 10, \ .clusterSize = 48, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -847,9 +868,9 @@ { \ /* Endpoint: 0, Cluster: Diagnostic Logs (server) */ \ .clusterId = 0x00000032, \ - .attributes = ZAP_ATTRIBUTE_INDEX(62), \ - .attributeCount = 0, \ - .clusterSize = 0, \ + .attributes = ZAP_ATTRIBUTE_INDEX(69), \ + .attributeCount = 2, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 33 ) ,\ @@ -858,9 +879,9 @@ { \ /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ .clusterId = 0x00000033, \ - .attributes = ZAP_ATTRIBUTE_INDEX(62), \ - .attributeCount = 9, \ - .clusterSize = 2, \ + .attributes = ZAP_ATTRIBUTE_INDEX(71), \ + .attributeCount = 10, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = nullptr ,\ @@ -869,7 +890,7 @@ { \ /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ .clusterId = 0x00000034, \ - .attributes = ZAP_ATTRIBUTE_INDEX(71), \ + .attributes = ZAP_ATTRIBUTE_INDEX(81), \ .attributeCount = 6, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -880,7 +901,7 @@ { \ /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ .clusterId = 0x00000035, \ - .attributes = ZAP_ATTRIBUTE_INDEX(77), \ + .attributes = ZAP_ATTRIBUTE_INDEX(87), \ .attributeCount = 65, \ .clusterSize = 247, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -891,7 +912,7 @@ { \ /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ .clusterId = 0x00000036, \ - .attributes = ZAP_ATTRIBUTE_INDEX(142), \ + .attributes = ZAP_ATTRIBUTE_INDEX(152), \ .attributeCount = 15, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -902,7 +923,7 @@ { \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ .clusterId = 0x00000037, \ - .attributes = ZAP_ATTRIBUTE_INDEX(157), \ + .attributes = ZAP_ATTRIBUTE_INDEX(167), \ .attributeCount = 11, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -913,9 +934,9 @@ { \ /* Endpoint: 0, Cluster: Switch (server) */ \ .clusterId = 0x0000003B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(168), \ - .attributeCount = 0, \ - .clusterSize = 0, \ + .attributes = ZAP_ATTRIBUTE_INDEX(178), \ + .attributeCount = 2, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = nullptr ,\ @@ -924,9 +945,9 @@ { \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ .clusterId = 0x0000003C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(168), \ - .attributeCount = 4, \ - .clusterSize = 2, \ + .attributes = ZAP_ATTRIBUTE_INDEX(180), \ + .attributeCount = 5, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 45 ) ,\ @@ -935,9 +956,9 @@ { \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ .clusterId = 0x0000003E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(172), \ - .attributeCount = 7, \ - .clusterSize = 2, \ + .attributes = ZAP_ATTRIBUTE_INDEX(185), \ + .attributeCount = 8, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 49 ) ,\ @@ -946,9 +967,9 @@ { \ /* Endpoint: 0, Cluster: Group Key Management (server) */ \ .clusterId = 0x0000003F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(179), \ - .attributeCount = 5, \ - .clusterSize = 2, \ + .attributes = ZAP_ATTRIBUTE_INDEX(193), \ + .attributeCount = 6, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 64 ) ,\ @@ -957,9 +978,9 @@ { \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ .clusterId = 0x00000040, \ - .attributes = ZAP_ATTRIBUTE_INDEX(184), \ - .attributeCount = 2, \ - .clusterSize = 2, \ + .attributes = ZAP_ATTRIBUTE_INDEX(199), \ + .attributeCount = 3, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = nullptr ,\ @@ -968,9 +989,9 @@ { \ /* Endpoint: 0, Cluster: User Label (server) */ \ .clusterId = 0x00000041, \ - .attributes = ZAP_ATTRIBUTE_INDEX(186), \ - .attributeCount = 2, \ - .clusterSize = 2, \ + .attributes = ZAP_ATTRIBUTE_INDEX(202), \ + .attributeCount = 3, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = nullptr ,\ @@ -979,53 +1000,53 @@ { \ /* Endpoint: 1, Cluster: Identify (server) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(188), \ - .attributeCount = 3, \ - .clusterSize = 5, \ + .attributes = ZAP_ATTRIBUTE_INDEX(205), \ + .attributeCount = 4, \ + .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayIdentifyServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 72 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 76 ) ,\ + .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(191), \ - .attributeCount = 2, \ - .clusterSize = 3, \ + .attributes = ZAP_ATTRIBUTE_INDEX(209), \ + .attributeCount = 3, \ + .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 78 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 85 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 75 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 82 ) ,\ },\ { \ /* Endpoint: 1, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(193), \ + .attributes = ZAP_ATTRIBUTE_INDEX(212), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 90 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 87 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Level Control (server) */ \ .clusterId = 0x00000008, \ - .attributes = ZAP_ATTRIBUTE_INDEX(200), \ + .attributes = ZAP_ATTRIBUTE_INDEX(219), \ .attributeCount = 16, \ .clusterSize = 27, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayLevelControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 97 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 94 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(216), \ - .attributeCount = 5, \ - .clusterSize = 0, \ + .attributes = ZAP_ATTRIBUTE_INDEX(235), \ + .attributeCount = 6, \ + .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = nullptr ,\ @@ -1034,20 +1055,20 @@ { \ /* Endpoint: 1, Cluster: Color Control (server) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(221), \ - .attributeCount = 22, \ - .clusterSize = 36, \ + .attributes = ZAP_ATTRIBUTE_INDEX(241), \ + .attributeCount = 23, \ + .clusterSize = 40, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayColorControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 106 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 103 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(243), \ - .attributeCount = 4, \ - .clusterSize = 5, \ + .attributes = ZAP_ATTRIBUTE_INDEX(264), \ + .attributeCount = 5, \ + .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOccupancySensingServer, \ .acceptedCommandList = nullptr ,\ @@ -1064,7 +1085,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 22, 428 }, { ZAP_CLUSTER_INDEX(22), 7, 89 }, \ + { ZAP_CLUSTER_INDEX(0), 22, 492 }, { ZAP_CLUSTER_INDEX(22), 7, 109 }, \ } // Largest attribute size is needed for various buffers @@ -1076,7 +1097,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (517) +#define ATTRIBUTE_MAX_SIZE (601) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) From 828a29e6e0fff8af28c210396015cf91cca50c37 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Thu, 26 May 2022 21:11:19 +0000 Subject: [PATCH 03/22] Lic --- examples/chef/chef_util.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/examples/chef/chef_util.py b/examples/chef/chef_util.py index 856207cacbac62..3b7836ef42182a 100644 --- a/examples/chef/chef_util.py +++ b/examples/chef/chef_util.py @@ -1,3 +1,17 @@ +# 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. + import subprocess import json import os From 54eca479c00ef7d1c1384e1f29eed9d317eabef1 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Sat, 28 May 2022 01:32:25 +0000 Subject: [PATCH 04/22] Squashed commit of the following: commit 733c61de426ca583400fae9648440bd2d2896a99 Author: Austin Bozowski Date: Sat May 28 01:29:36 2022 +0000 Repair workflows for merge commit 281c051e1073f3dae62da3b45801583458fe77a0 Author: Austin Bozowski Date: Sat May 28 01:25:12 2022 +0000 Fix build all but no test commit 3e2ed8e5f8fe1f8c1ad1f7df69d35af3c028561f Author: Austin Bozowski Date: Sat May 28 01:05:03 2022 +0000 Re run generate_zzz and disable git check commit 9cdf59030a5adc9fa677cbca3d942184505dd3b3 Author: Austin Bozowski Date: Sat May 28 00:55:03 2022 +0000 Fix dedent commit d5bf603a294c8303e92767771e9368fe7fe1cccb Author: Austin Bozowski Date: Fri May 27 23:07:06 2022 +0000 Run restyle commit 43ed4538c268e5541c12f53b0838d086ebb06327 Author: Austin Bozowski Date: Fri May 27 22:58:10 2022 +0000 Style commit 8ec4bd82d100e16eec6e872cb241205f6b4d803e Author: Austin Bozowski Date: Fri May 27 22:44:20 2022 +0000 Stateful shell commit 29700a51288bda592d50a138d4d7de999103b078 Author: Austin Bozowski Date: Fri May 27 22:24:00 2022 +0000 stateful shell commit 2443fb3fc6ae9e37514908a1be5bdbc7f02ad6ea Author: Austin Bozowski Date: Fri May 27 22:07:10 2022 +0000 Fix find and replace commit 07db659efc08af241d64769ad009daac20dd5068 Author: Austin Bozowski Date: Fri May 27 21:59:16 2022 +0000 Test stateful shell commit ecd2d00bfb73a7b9ef1ffc6d39e2998618e5c8d1 Author: Austin Bozowski Date: Fri May 27 21:49:16 2022 +0000 Restyle commit 4ff29bbfdbfe6fe35ad669489ae0f905747c2791 Author: Austin Bozowski Date: Fri May 27 21:46:02 2022 +0000 Important comment commit ab9e2ed21a8e60d7b8b1c9dd54a7d9a60ca22712 Author: Austin Bozowski Date: Fri May 27 21:39:14 2022 +0000 isort commit 321cfcadbb7b7f5b85e6aefe0ec5a325157bbb6a Author: Austin Bozowski Date: Fri May 27 21:38:32 2022 +0000 Flush print commit 5d2fa9d3bf16b146c3a6e79f8200c5f93a965541 Author: Austin Bozowski Date: Fri May 27 21:31:11 2022 +0000 Reference and new print commit 04990257220592b24ba1b1345e8e7d79cc04bc2a Author: Austin Bozowski Date: Fri May 27 21:27:24 2022 +0000 Ref commit f1ad0215045cb38243185c59d572681cbaffc589 Author: Austin Bozowski Date: Fri May 27 21:25:36 2022 +0000 Suffix commit 2ef6d3e978809eb2720d6ad139d7ceb948fc4df4 Author: Austin Bozowski Date: Fri May 27 21:21:42 2022 +0000 Refactor commit 88b852a63a8ccc41d66614e462e955696fda8104 Author: Austin Bozowski Date: Fri May 27 20:56:58 2022 +0000 OK commit 37f91b18597b77da06a8f0836d12c0425af0b283 Author: Austin Bozowski Date: Fri May 27 20:24:26 2022 +0000 Ref commit 0216a73cb5c85ec21f97e936f641844fb759fb02 Author: Austin Bozowski Date: Fri May 27 20:10:37 2022 +0000 Group commit 7299fd7c90b85b159e6559d0bd180484479606fb Author: Austin Bozowski Date: Fri May 27 20:07:36 2022 +0000 Reference commit 997124e09f40808b75b581e1e672b6a2768d6e84 Author: Austin Bozowski Date: Fri May 27 19:59:14 2022 +0000 JSON commit d7f26cb24e1b1ae1c5a72f7dd0288a376a300f6f Author: Austin Bozowski Date: Fri May 27 19:40:01 2022 +0000 Temp delete workflows commit 9421c27d912909fd67e5f45e22847822d1f00e7f Author: Austin Bozowski Date: Fri May 27 19:35:13 2022 +0000 Refactor commit 7264515a244290a9057e5275813a2d26b3761445 Author: Austin Bozowski Date: Fri May 27 19:30:57 2022 +0000 More refactor commit 3f826ff28c41944d8895f0c7cc7a886d37b82263 Author: Austin Bozowski Date: Fri May 27 19:07:38 2022 +0000 Begin refactor commit b73ddd5fa8cafa05b47dde75fb6f0fc02236c307 Author: Austin Bozowski Date: Fri May 27 18:30:32 2022 +0000 Comment commit 161e92b4c2c418137658c31c273306e2d94fde56 Author: Austin Bozowski Date: Fri May 27 18:25:21 2022 +0000 Comment, dedent, comment, fstring commit 89ce50e7564bc573c048a7ff464b703c4aa8c757 Author: Austin Bozowski Date: Fri May 27 17:24:35 2022 +0000 dedent and remove bundle placeholder commit d3c7d9834f3df1f8c8934ad81b7a0020d56f5819 Author: Austin Bozowski Date: Fri May 27 17:17:40 2022 +0000 Sort imports --- examples/chef/chef.py | 349 ++++++++++++++++++++-------------- examples/chef/chef_util.py | 80 -------- examples/chef/cicd_meta.json | 14 ++ examples/chef/cimanifest.json | 2 +- 4 files changed, 225 insertions(+), 220 deletions(-) delete mode 100644 examples/chef/chef_util.py create mode 100644 examples/chef/cicd_meta.json diff --git a/examples/chef/chef.py b/examples/chef/chef.py index e34b8b52c1cd7b..c425df57cdeae5 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -14,23 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys +import hashlib +import json import optparse import os +import shutil import sys +import tarfile import textwrap -import shutil +from typing import Any, Dict, Sequence + import yaml -import hashlib -import json -import tarfile -import subprocess import constants import stateful_shell -import chef_util - -from typing import Sequence TermColors = constants.TermColors @@ -42,7 +39,9 @@ _DEVICE_LIST = [file[:-4] for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap")] _CHEF_ZZZ_ROOT = os.path.join(_CHEF_SCRIPT_PATH, "zzz_generated") _CI_MANIFEST_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cimanifest.json") -_CHEF_DEVICES_DIR = os.path.join(_CHEF_SCRIPT_PATH, "devices") +_CI_DEVICE_MANIFEST_NAME = "INPUTMD5.txt" +_CICD_CONFIG_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cicd_meta.json") +_CI_ALLOW_LIST = ["lighting-app"] gen_dir = "" # Filled in after sample app type is read from args. @@ -58,7 +57,7 @@ def splash() -> None: | `----.| | | | | |____ | | \\______||__| |__| |_______||__|{TermColors.STRRESET} """) - print(splashText, flush=True) + flush_print(splashText) def load_config() -> None: @@ -72,9 +71,9 @@ def load_config() -> None: config = yaml.load(configStream, Loader=yaml.SafeLoader) configStream.close() else: - print("Running for the first time and configuring config.yaml. " + - "Change this configuration file to include correct configuration " + - "for the vendor's SDK", flush=True) + flush_print("Running for the first time and configuring config.yaml. " + + "Change this configuration file to include correct configuration " + + "for the vendor's SDK") configStream = open(configFile, 'w') config["nrfconnect"]["ZEPHYR_BASE"] = os.environ.get('ZEPHYR_BASE') config["nrfconnect"]["TTY"] = None @@ -84,7 +83,7 @@ def load_config() -> None: config["silabs-thread"]["TTY"] = None config["silabs-thread"]["CU"] = None - print(yaml.dump(config), flush=True) + flush_print(yaml.dump(config)) yaml.dump(config, configStream) configStream.close() @@ -93,21 +92,86 @@ def load_config() -> None: def check_python_version() -> None: if sys.version_info[0] < 3: - print('Must use Python 3. Current version is ' + - str(sys.version_info[0])) + flush_print('Must use Python 3. Current version is ' + + str(sys.version_info[0])) exit(1) +def check_zap_master() -> str: + """Produces hash of ZAP submodule in branch master + This will need to be replaced with stateful shell once it supports output + The branch should be taken as a parameter + Old code to show intent: + # git_cmd = ["git", "ls-tree", "master", "third_party/zap/repo"] + # zap_commit = str(subprocess.check_output(git_cmd, cwd=_REPO_BASE_PATH)) + # zap_commit = zap_commit.split(" ")[2] + # zap_commit = zap_commit[:zap_commit.index("\\")] + """ + zap_commit = 'TEMP DISABLED' + flush_print(f"zap commit: {zap_commit}") + return zap_commit + + +def generate_device_manifest( + include_zap_submod: bool = False, + write_manifest_file: bool = False) -> Dict[str, Any]: + """Produces dictionary containing md5 of device dir zap files. + + Args: + include_zap_submod: Include ZAP commit in manifest + write_manifest_file: Serialize manifest in file and tree + Returns: + Dict containing MD5 of device dir zap files. + """ + ci_manifest = {} + for device_name in _DEVICE_LIST: + device_file_path = os.path.join(_DEVICE_FOLDER, device_name + ".zap") + with open(device_file_path, "rb") as device_file: + device_file_data = device_file.read() + device_file_md5 = hashlib.md5(device_file_data).hexdigest() + ci_manifest[device_name] = device_file_md5 + flush_print(f"Manifest for {device_name} : {device_file_md5}") + if write_manifest_file: + device_zzz_dir_root = os.path.join(_CHEF_ZZZ_ROOT, device_name) + device_zzz_md5_file = os.path.join(device_zzz_dir_root, _CI_DEVICE_MANIFEST_NAME) + with open(device_zzz_md5_file, "w+", encoding="utf-8") as md5file: + md5file.write(device_file_md5) + if include_zap_submod: + ci_manifest["zap_commit"] = check_zap_master() + if write_manifest_file: + with open(_CI_MANIFEST_FILE_NAME, "w+", encoding="utf-8") as ci_manifest_file: + ci_manifest_file.write(json.dumps(ci_manifest, indent=4)+"\n") + return ci_manifest + + +def load_cicd_config() -> Dict[str, Any]: + with open(_CICD_CONFIG_FILE_NAME, "r", encoding="utf-8") as config_file: + config = json.loads(config_file.read()) + for platform_name, platform_config in config.items(): + has_build_dir = "build_dir" in platform_config + has_plat_label = "platform_label" in platform_config + if not has_build_dir or not has_plat_label: + flush_print(f"{platform_name} CICD config missing build_dir or platform_label") + exit(1) + return config + + +def flush_print(to_print: str) -> None: + """Prints and flushes stdout buffer""" + print(to_print, flush=True) + + def main(argv: Sequence[str]) -> None: check_python_version() config = load_config() + cicd_config = load_cicd_config() # # Build environment switches # if sys.platform == "win32": - print('Windows is currently not supported. Use Linux or MacOS platforms') + flush_print('Windows is currently not supported. Use Linux or MacOS platforms') exit(1) # @@ -181,7 +245,7 @@ def main(argv: Sequence[str]) -> None: parser.add_option("", "--build_all", help="For use in CD only. Builds and bundles all chef examples for the specified platform. Uses --use_zzz. Chef exits after completion.", dest="build_all", action="store_true") parser.add_option( - "", "--ci", help="Builds Chef examples defined in chef_util.ci_allowlist. Uses --use_zzz. Uses specified target from -t. Chef exits after completion.", dest="ci", action="store_true") + "", "--ci", help="Builds Chef examples defined in _CI_ALLOW_LIST. Uses --use_zzz. Uses specified target from -t. Chef exits after completion.", dest="ci", action="store_true") options, _ = parser.parse_args(argv) @@ -192,37 +256,45 @@ def main(argv: Sequence[str]) -> None: # if options.validate_zzz: - fix_instructions = "Cached files out of date. Please bootstrap, activate, install zap, run chef with the flag --generate_zzz and commit /examples/chef/zzz_generated and /examples/chef/cimanifes.json" - ci_manifest = chef_util.generate_device_manifest(_CHEF_DEVICES_DIR) + fix_instructions = """Cached files out of date! + Please: + bootstrap, activate, and install zap + run chef with the flag --generate_zzz + git add examples/chef/zzz_generated + git add examples/chef/cimanifes.json + Ensure you are running with the latest version of ZAP from master!""" + ci_manifest = generate_device_manifest() with open(_CI_MANIFEST_FILE_NAME, "r", encoding="utf-8") as ci_manifest_file: cached_manifest = json.loads(ci_manifest_file.read()) - for device in ci_manifest: - if device != "zap_commit": - try: - if cached_manifest[device] != ci_manifest[device]: - print("MISMATCH INPUT - "+fix_instructions) - exit(1) - else: - zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device) - device_md5_file = os.path.join(zzz_dir, "INPUTMD5.txt") - if not os.path.exists(device_md5_file): - print("MISSING RESULT - "+fix_instructions) - exit(1) - else: - with open(device_md5_file, "r", encoding="utf-8") as md5_file: - md5 = md5_file.read() - if ci_manifest[device] != md5: - print("MISMATCH OUTPUT - "+fix_instrucitons) - exit(1) - except KeyError: - print("MISSING DEVICE CACHE - "+fix_instructions) - exit(1) - if device == "zap_commit" and False: - # Disabled for now, ci_manifest above created without include_zap_submod, fails in CI env. + for device in ci_manifest: + if device != "zap_commit": + try: if cached_manifest[device] != ci_manifest[device]: - print("BAD ZAP VERSION - "+fix_instructions) + flush_print("MISMATCH INPUT - "+fix_instructions) exit(1) - print("Cached ZAP output is up to date!") + else: + zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device) + device_md5_file = os.path.join(zzz_dir, _CI_DEVICE_MANIFEST_NAME) + if not os.path.exists(device_md5_file): + flush_print("MISSING RESULT - "+fix_instructions) + exit(1) + else: + with open(device_md5_file, "r", encoding="utf-8") as md5_file: + md5 = md5_file.read() + if ci_manifest[device] != md5: + flush_print("MISMATCH OUTPUT - "+fix_instrucitons) + exit(1) + except KeyError: + flush_print("MISSING DEVICE CACHE - "+fix_instructions) + exit(1) + if device == "zap_commit" and False: + # Disabled; should check: + # Current branch when writing manifest + # Master in CI + if cached_manifest[device] != ci_manifest[device]: + flush_print("BAD ZAP VERSION - "+fix_instructions) + exit(1) + flush_print("Cached ZAP output is up to date!") exit(0) # @@ -231,18 +303,19 @@ def main(argv: Sequence[str]) -> None: if options.do_bootstrap_zap: if sys.platform == "linux" or sys.platform == "linux2": - print("Installing ZAP OS package dependencies") + flush_print("Installing ZAP OS package dependencies") shell.run_cmd( - f"sudo apt-get install sudo apt-get install node node-yargs npm\ - libpixman-1-dev libcairo2-dev libpango1.0-dev node-pre-gyp libjpeg9-dev libgif\ --dev node-typescript") + textwrap.dedent(""" \ + sudo apt-get install sudo apt-get install node node-yargs npm \ + libpixman-1-dev libcairo2-dev libpango1.0-dev node-pre-gyp \ + libjpeg9-dev libgif-dev node-typescript \"""")) if sys.platform == "darwin": - print("Installation of ZAP OS packages not supported on MacOS") + flush_print("Installation of ZAP OS packages not supported on MacOS") if sys.platform == "win32": - print( + flush_print( "Installation of ZAP OS packages not supported on Windows") - print("Running NPM to install ZAP Node.JS dependencies") + flush_print("Running NPM to install ZAP Node.JS dependencies") shell.run_cmd( f"cd {_REPO_BASE_PATH}/third_party/zap/repo/ && npm install") @@ -251,29 +324,27 @@ def main(argv: Sequence[str]) -> None: # if options.generate_zzz: - print(f"Cleaning {_CHEF_ZZZ_ROOT}") + flush_print(f"Cleaning {_CHEF_ZZZ_ROOT}") if not os.path.exists(_CHEF_ZZZ_ROOT): - print(f"{_CHEF_ZZZ_ROOT} doesn't exist; creating") + flush_print(f"{_CHEF_ZZZ_ROOT} doesn't exist; creating") os.mkdir(_CHEF_ZZZ_ROOT) else: - print(f"Deleting and recreating existing {_CHEF_ZZZ_ROOT}") + flush_print(f"Deleting and recreating existing {_CHEF_ZZZ_ROOT}") shutil.rmtree(_CHEF_ZZZ_ROOT) os.mkdir(_CHEF_ZZZ_ROOT) - print(f"Generating files in {_CHEF_ZZZ_ROOT} for all devices", flush=True) - for device_dir_item in os.listdir(_CHEF_DEVICES_DIR): - target_file_ext = ".zap" - if device_dir_item.endswith(target_file_ext): # and device_dir_item in chef_util.ci_allowlist: - device_name = device_dir_item[:-len(target_file_ext)] - print(f"Generating files for {device_name}", flush=True) - device_out_dir = os.path.join(_CHEF_ZZZ_ROOT, device_name) - os.mkdir(device_out_dir) - device_out_dir = os.path.join(device_out_dir, "zap-generated") - os.mkdir(device_out_dir) - shell.run_cmd(f"{_REPO_BASE_PATH}/scripts/tools/zap/generate.py\ - {_CHEF_SCRIPT_PATH}/devices/{device_name}.zap -o {device_out_dir}") - shell.run_cmd(f"touch {device_out_dir}/af-gen-event.h") - chef_util.generate_device_manifest(_CHEF_DEVICES_DIR, include_zap_submod=True, write_manifest_file=True, - ci_manifest_file_name=_CI_MANIFEST_FILE_NAME, repo_base_path=_REPO_BASE_PATH, chef_zzz_root=_CHEF_ZZZ_ROOT) + flush_print(f"Generating files in {_CHEF_ZZZ_ROOT} for all devices") + for device_name in _DEVICE_LIST: + flush_print(f"Generating files for {device_name}") + device_out_dir = os.path.join(_CHEF_ZZZ_ROOT, device_name) + os.mkdir(device_out_dir) + device_out_dir = os.path.join(device_out_dir, "zap-generated") + os.mkdir(device_out_dir) + shell.run_cmd(textwrap.dedent(f"""\ + {_REPO_BASE_PATH}/scripts/tools/zap/generate.py \ + {_CHEF_SCRIPT_PATH}/devices/{device_name}.zap -o {device_out_dir}""")) + shell.run_cmd(f"touch {device_out_dir}/af-gen-event.h") + generate_device_manifest(include_zap_submod=True, + write_manifest_file=True) exit(0) # @@ -281,14 +352,11 @@ def main(argv: Sequence[str]) -> None: # if options.ci: - if options.build_target == "nrfconnect": - os.environ['GNUARMEMB_TOOLCHAIN_PATH'] = os.environ['PW_ARM_CIPD_INSTALL_DIR'] - for device_dir_item in os.listdir(_CHEF_DEVICES_DIR): - target_file_ext = ".zap" - if device_dir_item.endswith(target_file_ext) and device_dir_item in chef_util.ci_allowlist: - device_name = device_dir_item[:-len(target_file_ext)] - command = './chef.py -cbr --use_zzz -d {} -t {}'.format(device_name, options.build_target) - subprocess.check_call(command, cwd=_CHEF_SCRIPT_PATH, shell=True) + for device_name in [d for d in _DEVICE_LIST if d in _CI_ALLOW_LIST]: + if options.build_target == "nrfconnect": + shell.run_cmd("export GNUARMEMB_TOOLCHAIN_PATH=\"$PW_ARM_CIPD_INSTALL_DIR\"") + shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}") + shell.run_cmd(f"./chef.py -cbr --use_zzz -d {device_name} -t {options.build_target}") exit(0) # @@ -296,55 +364,52 @@ def main(argv: Sequence[str]) -> None: # if options.build_all: - print("Building all chef examples", flush=True) - os.environ['GNUARMEMB_TOOLCHAIN_PATH'] = os.environ['PW_ARM_CIPD_INSTALL_DIR'] + # Needs testing after refactor + # Needs to call per-platform bundle function + flush_print("Build all disabled") + exit(1) + flush_print("Building all chef examples") archive_prefix = "/workspace/artifacts/" - if not os.path.exists(archive_prefix): - # shutil.rmtree(archive_prefix) - os.mkdir(archive_prefix) archive_suffix = ".tar.gz" - - cd_platforms_meta = chef_util.cd_platforms_meta - for device in os.listdir(_CHEF_DEVICES_DIR): - target_file_ext = ".zap" - if device.endswith(target_file_ext): - device_name = device[:-len(target_file_ext)] - for platform, platform_meta in cd_platforms_meta.items(): - # shutil.rmitem(configFile) - directory = platform_meta['build_dir'] - label = platform_meta['platform_label'] - output_dir = os.path.join(_CHEF_SCRIPT_PATH, directory) - command = './chef.py -cbr --use_zzz -d {} -t {}'.format(device_name, platform) - print('-' * 64, flush=True) - print(f"Building {command}", flush=True) - print('-' * 64, flush=True) - subprocess.check_call(command, cwd=_CHEF_SCRIPT_PATH, shell=True) - archive_name = f"{label}-chef-{device_name}-wifi-rpc" - archive_full_name = archive_prefix + archive_name + archive_suffix - print(f"Adding build output to archive {archive_full_name}", flush=True) - with tarfile.open(archive_full_name, "w:gz") as tar: - tar.add(output_dir, arcname=".") + os.makedirs(archive_prefix, exist_ok=True) + for device_name in _DEVICE_LIST: + for platform, platform_meta in cicd_config.items(): + directory = platform_meta['build_dir'] + label = platform_meta['platform_label'] + output_dir = os.path.join(_CHEF_SCRIPT_PATH, directory) + command = f"./chef.py -cbr --use_zzz -d {device_name} -t {platform}" + flush_print("-" * 64) + flush_print(f"Building {command}") + flush_print("-" * 64) + shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}") + shell.run_cmd("export GNUARMEMB_TOOLCHAIN_PATH=\"$PW_ARM_CIPD_INSTALL_DIR\"") + shell.run_cmd(command) + archive_name = f"{label}-chef-{device_name}-wifi-rpc" + archive_full_name = archive_prefix + archive_name + archive_suffix + flush_print(f"Adding build output to archive {archive_full_name}") + with tarfile.open(archive_full_name, "w:gz") as tar: + tar.add(output_dir, arcname=".") exit(0) # # Platform Folder # - print(f"Target is set to {options.sample_device_type_name}") + flush_print(f"Target is set to {options.sample_device_type_name}") global gen_dir gen_dir = ( f"{_CHEF_SCRIPT_PATH}/out/{options.sample_device_type_name}/zap-generated/") - print("Setting up environment...") + flush_print("Setting up environment...") if options.build_target == "esp32": if config['esp32']['IDF_PATH'] is None: - print('Path for esp32 SDK was not found. Make sure esp32.IDF_PATH is set on your config.yaml file') + flush_print('Path for esp32 SDK was not found. Make sure esp32.IDF_PATH is set on your config.yaml file') exit(1) plat_folder = os.path.normpath(f"{_CHEF_SCRIPT_PATH}/esp32") shell.run_cmd(f'source {config["esp32"]["IDF_PATH"]}/export.sh') elif options.build_target == "nrfconnect": if config['nrfconnect']['ZEPHYR_BASE'] is None: - print('Path for nrfconnect SDK was not found. Make sure nrfconnect.ZEPHYR_BASE is set on your config.yaml file') + flush_print('Path for nrfconnect SDK was not found. Make sure nrfconnect.ZEPHYR_BASE is set on your config.yaml file') exit(1) plat_folder = os.path.normpath(f"{_CHEF_SCRIPT_PATH}/nrfconnect") shell.run_cmd(f'source {config["nrfconnect"]["ZEPHYR_BASE"]}/zephyr-env.sh') @@ -352,9 +417,9 @@ def main(argv: Sequence[str]) -> None: elif options.build_target == "linux": pass elif options.build_target == "silabs-thread": - print('Path to gecko sdk is configured within Matter.') + flush_print('Path to gecko sdk is configured within Matter.') else: - print(f"Target {options.build_target} not supported") + flush_print(f"Target {options.build_target} not supported") shell.run_cmd(f"source {_REPO_BASE_PATH}/scripts/activate.sh") @@ -364,28 +429,28 @@ def main(argv: Sequence[str]) -> None: if options.do_update_toolchain: if options.build_target == "esp32": - print("ESP32 toolchain update not supported. Skipping") + flush_print("ESP32 toolchain update not supported. Skipping") elif options.build_target == "nrfconnect": - print("Updating toolchain") + flush_print("Updating toolchain") shell.run_cmd( f"cd {_REPO_BASE_PATH} && python3 scripts/setup/nrfconnect/update_ncs.py --update") elif options.build_target == "silabs-thread": - print("Silabs-thread toolchain not supported. Skipping") + flush_print("Silabs-thread toolchain not supported. Skipping") elif options.build_target == "linux": - print("Linux toolchain update not supported. Skipping") + flush_print("Linux toolchain update not supported. Skipping") # # Cluster customization # if options.do_run_gui: - print("Starting ZAP GUI editor") + flush_print("Starting ZAP GUI editor") shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/devices") shell.run_cmd( f"{_REPO_BASE_PATH}/scripts/tools/zap/run_zaptool.sh {options.sample_device_type_name}.zap") if options.do_run_zap: - print("Running ZAP script to generate artifacts", flush=True) + flush_print("Running ZAP script to generate artifacts") shell.run_cmd(f"mkdir -p {gen_dir}/") shell.run_cmd(f"rm {gen_dir}/*") shell.run_cmd( @@ -405,9 +470,9 @@ def main(argv: Sequence[str]) -> None: shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/nrfconnect") shell.run_cmd("west build -t menuconfig") elif (options.build_target == "silabs-thread") or (options.build_target == "silabs-wifi"): - print("Menuconfig not available on Silabs-thread target. Skipping") + flush_print("Menuconfig not available on Silabs-thread target. Skipping") elif options.build_target == "linux": - print("Menuconfig not available on Linux target. Skipping") + flush_print("Menuconfig not available on Linux target. Skipping") # # Build @@ -415,28 +480,30 @@ def main(argv: Sequence[str]) -> None: if options.do_build: if options.use_zzz: - print("Using pre-generated ZAP output", flush=True) - zzz_dir = os.path.join(_CHEF_SCRIPT_PATH, "zzz_generated", options.sample_device_type_name, "zap-generated") - if os.path.exists(gen_dir): - shutil.rmtree(gen_dir) + flush_print("Using pre-generated ZAP output") + zzz_dir = os.path.join(_CHEF_SCRIPT_PATH, + "zzz_generated", + options.sample_device_type_name, + "zap-generated") + shutil.rmtree(gen_dir, ignore_errors=True) shutil.copytree(zzz_dir, gen_dir) - print("Building...") + flush_print("Building...") if options.do_rpc: - print("RPC PW enabled") + flush_print("RPC PW enabled") if options.build_target == "esp32": shell.run_cmd( f"export SDKCONFIG_DEFAULTS={_CHEF_SCRIPT_PATH}/esp32/sdkconfig_rpc.defaults") else: - print(f"RPC PW on {options.build_target} not supported") + flush_print(f"RPC PW on {options.build_target} not supported") else: - print("RPC PW disabled") + flush_print("RPC PW disabled") if (options.build_target == "esp32"): shell.run_cmd( f"export SDKCONFIG_DEFAULTS={_CHEF_SCRIPT_PATH}/esp32/sdkconfig.defaults") - print( + flush_print( f"Product ID 0x{options.pid:02X} / Vendor ID 0x{options.vid:02X}") shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}") @@ -476,7 +543,8 @@ def main(argv: Sequence[str]) -> None: elif options.build_target == "linux": shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/linux") with open(f"{_CHEF_SCRIPT_PATH}/linux/args.gni", "w") as f: - args_gni = os.path.join(_REPO_BASE_PATH, "config/standalone/args.gni") + args_gni = os.path.join( + _REPO_BASE_PATH, "config/standalone/args.gni") f.write(textwrap.dedent(f"""\ import("//build_overrides/chip.gni") import("{args_gni}") @@ -502,10 +570,10 @@ def main(argv: Sequence[str]) -> None: # if options.do_flash: - print("Flashing target") + flush_print("Flashing target") if options.build_target == "esp32": if config['esp32']['TTY'] is None: - print('The path for the serial enumeration for esp32 is not set. Make sure esp32.TTY is set on your config.yaml file') + flush_print('The path for the serial enumeration for esp32 is not set. Make sure esp32.TTY is set on your config.yaml file') exit(1) shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/esp32") if options.do_erase: @@ -529,28 +597,29 @@ def main(argv: Sequence[str]) -> None: # if options.do_interact: - print("Starting terminal...") + flush_print("Starting terminal...") if options.build_target == "esp32": if config['esp32']['TTY'] is None: - print('The path for the serial enumeration for esp32 is not set. Make sure esp32.TTY is set on your config.yaml file') + flush_print('The path for the serial enumeration for esp32 is not set. Make sure esp32.TTY is set on your config.yaml file') exit(1) shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/esp32") shell.run_cmd(f"idf.py -p {config['esp32']['TTY']} monitor") elif options.build_target == "nrfconnect": if config['nrfconnect']['TTY'] is None: - print('The path for the serial enumeration for nordic is not set. Make sure nrfconnect.TTY is set on your config.yaml file') + flush_print('The path for the serial enumeration for nordic is not set. Make sure nrfconnect.TTY is set on your config.yaml file') exit(1) shell.run_cmd("killall screen") shell.run_cmd(f"screen {config['nrfconnect']['TTY']} 115200") elif (options.build_target == "silabs-thread"): if config['silabs-thread']['TTY'] is None: - print('The path for the serial enumeration for silabs-thread is not set. Make sure silabs-thread.TTY is set on your config.yaml file') + flush_print( + 'The path for the serial enumeration for silabs-thread is not set. Make sure silabs-thread.TTY is set on your config.yaml file') exit(1) shell.run_cmd("killall screen") shell.run_cmd(f"screen {config['silabs-thread']['TTY']} 115200 8-N-1") elif options.build_target == "linux": - print( + flush_print( f"{_CHEF_SCRIPT_PATH}/linux/out/{options.sample_device_type_name}") shell.run_cmd( f"{_CHEF_SCRIPT_PATH}/linux/out/{options.sample_device_type_name}") @@ -565,16 +634,18 @@ def main(argv: Sequence[str]) -> None: elif (options.build_target == "silabs-thread"): if (sys.platform == "linux") or (sys.platform == "linux2"): if(config['silabs-thread']['TTY'] is None): - print('The path for the serial enumeration for silabs-thread is not set. Make sure silabs-thread.TTY is set on your config.yaml file') + flush_print( + 'The path for the serial enumeration for silabs-thread is not set. Make sure silabs-thread.TTY is set on your config.yaml file') exit(1) shell.run_cmd(f"python3 -m chip_rpc.console --device {config['silabs-thread']['TTY']} -b 115200") elif sys.platform == "darwin": if(config['silabs-thread']['CU'] is None): - print('The path for the serial enumeration for silabs-thread is not set. Make sure silabs-thread.CU is set on your config.yaml file') + flush_print( + 'The path for the serial enumeration for silabs-thread is not set. Make sure silabs-thread.CU is set on your config.yaml file') exit(1) shell.run_cmd(f"python3 -m chip_rpc.console --device {config['silabs-thread']['CU']} -b 115200") - print("Done") + flush_print("Done") if __name__ == '__main__': diff --git a/examples/chef/chef_util.py b/examples/chef/chef_util.py deleted file mode 100644 index 3b7836ef42182a..00000000000000 --- a/examples/chef/chef_util.py +++ /dev/null @@ -1,80 +0,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. - -import subprocess -import json -import os -import hashlib - - -ci_allowlist = ['lighting-app.zap'] -cd_platforms_meta = { - 'linux': { - 'build_dir': 'linux/out', - 'platform_label': 'linux_x86', - }, - 'esp32': { - 'build_dir': 'esp32/build', - 'platform_label': 'esp32-m5stack', - }, - 'nrfconnect': { - 'build_dir': 'nrfconnect/build', - 'platform_label': 'nrf-nrf52840dk', - }, -} - - -def bundle(platform: str): - if platform == 'linux': - pass - if platform == 'esp32': - pass - if platform == 'nrfconnect': - pass - - -def check_zap_master(repo_base_path: str) -> str: - """Produces hash of ZAP submodule in branch master""" - git_cmd = ["git", "ls-tree", "master", "third_party/zap/repo"] - zap_commit = str(subprocess.check_output(git_cmd, cwd=repo_base_path)) - zap_commit = zap_commit.split(" ")[2] - zap_commit = zap_commit[:zap_commit.index("\\")] - print(f"zap commit: {zap_commit}") - return zap_commit - - -def generate_device_manifest(chef_devices_dir: str, include_zap_submod: bool = False, write_manifest_file: bool = False, ci_manifest_file_name: str = '', repo_base_path: str = '', chef_zzz_root: str = '') -> dict: - """Produces dictionary containing md5 of device dir zap files""" - ci_manifest = {} - for device_dir_item in os.listdir(chef_devices_dir): - target_file_ext = ".zap" - if device_dir_item.endswith(target_file_ext): # and device_dir_item in ci_allowlist: - device_name = device_dir_item[:-len(target_file_ext)] - device_file_path = os.path.join(chef_devices_dir, device_dir_item) - with open(device_file_path, "rb") as device_file: - device_file_data = device_file.read() - device_file_md5 = hashlib.md5(device_file_data).hexdigest() - ci_manifest[device_name] = device_file_md5 - print(f"Manifest for {device_name} : {device_file_md5}") - if write_manifest_file: - device_zzz_dir_root = os.path.join(chef_zzz_root, device_name) - device_zzz_md5_file = os.path.join(device_zzz_dir_root, 'INPUTMD5.txt') - with open(device_zzz_md5_file, "w+", encoding="utf-8") as md5file: - md5file.write(device_file_md5) - if include_zap_submod: - ci_manifest["zap_commit"] = check_zap_master(repo_base_path) - if write_manifest_file: - with open(ci_manifest_file_name, "w+", encoding="utf-8") as ci_manifest_file: - ci_manifest_file.write(json.dumps(ci_manifest, indent=4)+"\n") - return ci_manifest diff --git a/examples/chef/cicd_meta.json b/examples/chef/cicd_meta.json new file mode 100644 index 00000000000000..34cabcb530a302 --- /dev/null +++ b/examples/chef/cicd_meta.json @@ -0,0 +1,14 @@ +{ + "linux": { + "build_dir": "linux/out", + "platform_label": "linux_x86" + }, + "esp32": { + "build_dir": "esp32/build", + "platform_label": "esp32-m5stack" + }, + "nrfconnect": { + "build_dir": "nrfconnect/build", + "platform_label": "nrf-nrf52840dk" + } +} diff --git a/examples/chef/cimanifest.json b/examples/chef/cimanifest.json index c1ee0ed009737c..ca576bba65b1a7 100644 --- a/examples/chef/cimanifest.json +++ b/examples/chef/cimanifest.json @@ -1,4 +1,4 @@ { "lighting-app": "81a1262e611fab1a71ac4129b91cec0f", - "zap_commit": "6594a9257ce96ee6d852eed052939849b31259fc" + "zap_commit": "TEMP DISABLED" } From c8ce60f2ea2808d4786eb45456f485a0ec3fb643 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Sat, 28 May 2022 01:38:43 +0000 Subject: [PATCH 05/22] Fix indent --- examples/chef/chef.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index c425df57cdeae5..b13c53207e355c 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -287,13 +287,13 @@ def main(argv: Sequence[str]) -> None: except KeyError: flush_print("MISSING DEVICE CACHE - "+fix_instructions) exit(1) - if device == "zap_commit" and False: - # Disabled; should check: - # Current branch when writing manifest - # Master in CI - if cached_manifest[device] != ci_manifest[device]: - flush_print("BAD ZAP VERSION - "+fix_instructions) - exit(1) + if device == "zap_commit" and False: + # Disabled; should check: + # Current branch when writing manifest + # Master in CI + if cached_manifest[device] != ci_manifest[device]: + flush_print("BAD ZAP VERSION - "+fix_instructions) + exit(1) flush_print("Cached ZAP output is up to date!") exit(0) From b634c91da25ec00b78d5ce5a6e1929e942529895 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Tue, 31 May 2022 07:52:59 +0000 Subject: [PATCH 06/22] Squashed commit of the following: commit 76f74140bfcd6fdca577d7a8225708e4d0c39f27 Author: Austin Bozowski Date: Tue May 31 07:48:51 2022 +0000 remove subproc commit e66e06438a1920962ef91466a6196c15089f6756 Author: Austin Bozowski Date: Tue May 31 07:38:41 2022 +0000 Restore workflows commit f1f308fc1eff3c9e6dae2dcc6daf190871967d19 Author: Austin Bozowski Date: Tue May 31 07:32:39 2022 +0000 Restyle and test commit bddb57672dcdd000c47b0a58e892ea337a23e9f3 Author: Austin Bozowski Date: Tue May 31 07:21:24 2022 +0000 Style commit 77f334e96b9388a728c266f375c67cb8c3c0333c Author: Austin Bozowski Date: Tue May 31 07:16:09 2022 +0000 MD5 memory commit dd59f1e73dc11ffa95ed362b058112b3ef4765fd Author: Austin Bozowski Date: Tue May 31 07:04:36 2022 +0000 Rename manifest commit 1f570d4e24032176d9627001e2a87eb965575a07 Author: Austin Bozowski Date: Tue May 31 06:59:55 2022 +0000 Minor commit 869234166d150dd4b3d804df53b4f93d0c614070 Author: Austin Bozowski Date: Tue May 31 06:52:11 2022 +0000 clean commit 27656a52a2e4b52e6a7271b39fc90fca72edd3a8 Author: Austin Bozowski Date: Tue May 31 06:34:53 2022 +0000 Style commit e31e668703db4d115f084795929bec0f5987b1ed Author: Austin Bozowski Date: Tue May 31 06:34:17 2022 +0000 Format commit 6dbd4f37a8ca6ad1ee42fa9edb244a594c6da395 Author: Austin Bozowski Date: Tue May 31 06:23:25 2022 +0000 Make validate better commit c4a99f09d83718a48acf96f73740f5bf1b68ab0d Author: Austin Bozowski Date: Tue May 31 05:44:42 2022 +0000 Restructure manifest commit f6358a7273b6a2ce7550f1ab0019cd59f40db75d Author: Austin Bozowski Date: Tue May 31 05:20:49 2022 +0000 Pull only chef changes from update2 --- examples/chef/chef.py | 130 ++++++++++++++++++++------------- examples/chef/ci_manifest.json | 6 ++ examples/chef/cimanifest.json | 4 - 3 files changed, 87 insertions(+), 53 deletions(-) create mode 100644 examples/chef/ci_manifest.json delete mode 100644 examples/chef/cimanifest.json diff --git a/examples/chef/chef.py b/examples/chef/chef.py index b13c53207e355c..5e9c7bb1cec542 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -38,7 +38,7 @@ _DEVICE_FOLDER = os.path.join(_CHEF_SCRIPT_PATH, "devices") _DEVICE_LIST = [file[:-4] for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap")] _CHEF_ZZZ_ROOT = os.path.join(_CHEF_SCRIPT_PATH, "zzz_generated") -_CI_MANIFEST_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cimanifest.json") +_CI_MANIFEST_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "ci_manifest.json") _CI_DEVICE_MANIFEST_NAME = "INPUTMD5.txt" _CICD_CONFIG_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cicd_meta.json") _CI_ALLOW_LIST = ["lighting-app"] @@ -107,6 +107,7 @@ def check_zap_master() -> str: # zap_commit = zap_commit.split(" ")[2] # zap_commit = zap_commit[:zap_commit.index("\\")] """ + # TODO zap_commit = 'TEMP DISABLED' flush_print(f"zap commit: {zap_commit}") return zap_commit @@ -123,14 +124,17 @@ def generate_device_manifest( Returns: Dict containing MD5 of device dir zap files. """ - ci_manifest = {} + ci_manifest = {"devices": {}} + devices_manifest = ci_manifest["devices"] for device_name in _DEVICE_LIST: device_file_path = os.path.join(_DEVICE_FOLDER, device_name + ".zap") with open(device_file_path, "rb") as device_file: - device_file_data = device_file.read() - device_file_md5 = hashlib.md5(device_file_data).hexdigest() - ci_manifest[device_name] = device_file_md5 - flush_print(f"Manifest for {device_name} : {device_file_md5}") + file_md5 = hashlib.md5() + while data := device_file.read(128 * 32): + file_md5.update(data) + device_file_md5 = file_md5.hexdigest() + devices_manifest[device_name] = device_file_md5 + flush_print(f"Current digest for {device_name} : {device_file_md5}") if write_manifest_file: device_zzz_dir_root = os.path.join(_CHEF_ZZZ_ROOT, device_name) device_zzz_md5_file = os.path.join(device_zzz_dir_root, _CI_DEVICE_MANIFEST_NAME) @@ -156,8 +160,20 @@ def load_cicd_config() -> Dict[str, Any]: return config -def flush_print(to_print: str) -> None: - """Prints and flushes stdout buffer""" +def flush_print( + to_print: str, + with_border: bool = False) -> None: + """Prints and flushes stdout buffer + + Args: + to_print: The string to print + with_border: Add boarder above and below to_print + Returns: + None + """ + if with_border: + border = ('-' * 64) + '\n' + to_print = f"{border}{to_print}\n{border}" print(to_print, flush=True) @@ -256,44 +272,49 @@ def main(argv: Sequence[str]) -> None: # if options.validate_zzz: - fix_instructions = """Cached files out of date! + flush_print(f"Validating\n{_CI_MANIFEST_FILE_NAME}\n{_CHEF_ZZZ_ROOT}\n", + with_border=True) + fix_instructions = f""" + + Cached files out of date! Please: - bootstrap, activate, and install zap - run chef with the flag --generate_zzz - git add examples/chef/zzz_generated - git add examples/chef/cimanifes.json + ./scripts/bootstrap.sh + source ./scripts/activate.sh + cd ./third_party/zap/repo + npm install + cd ../../.. + ./examples/chef/chef.py --generate_zzz + git add {_CHEF_ZZZ_ROOT} + git add {_CI_MANIFEST_FILE_NAME} Ensure you are running with the latest version of ZAP from master!""" ci_manifest = generate_device_manifest() with open(_CI_MANIFEST_FILE_NAME, "r", encoding="utf-8") as ci_manifest_file: cached_manifest = json.loads(ci_manifest_file.read()) - for device in ci_manifest: - if device != "zap_commit": - try: - if cached_manifest[device] != ci_manifest[device]: - flush_print("MISMATCH INPUT - "+fix_instructions) - exit(1) - else: - zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device) - device_md5_file = os.path.join(zzz_dir, _CI_DEVICE_MANIFEST_NAME) - if not os.path.exists(device_md5_file): - flush_print("MISSING RESULT - "+fix_instructions) - exit(1) - else: - with open(device_md5_file, "r", encoding="utf-8") as md5_file: - md5 = md5_file.read() - if ci_manifest[device] != md5: - flush_print("MISMATCH OUTPUT - "+fix_instrucitons) - exit(1) - except KeyError: - flush_print("MISSING DEVICE CACHE - "+fix_instructions) - exit(1) - if device == "zap_commit" and False: - # Disabled; should check: - # Current branch when writing manifest - # Master in CI - if cached_manifest[device] != ci_manifest[device]: - flush_print("BAD ZAP VERSION - "+fix_instructions) + cached_device_manifest = cached_manifest["devices"] + for device, device_md5 in ci_manifest["devices"].items(): + zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device) + device_md5_file = os.path.join(zzz_dir, _CI_DEVICE_MANIFEST_NAME) + if device not in cached_device_manifest: + flush_print(f"MANIFEST MISSING {device}: {fix_instructions}") + elif cached_device_manifest[device] != device_md5: + flush_print(f"MANIFEST MISMATCH {device}: {fix_instructions}") + exit(1) + elif not os.path.exists(device_md5_file): + flush_print(f"OUTPUT MISSING {device}: {fix_instructions}") + exit(1) + else: + with open(device_md5_file, "r", encoding="utf-8") as md5_file: + output_cached_md5 = md5_file.read() + if output_cached_md5 != device_md5: + flush_print(f"OUTPUT MISMATCH {device}: {fix_instrucitons}") exit(1) + if False: + # TODO + # Disabled; should check: + # Current branch when writing manifest + # Master in CI + flush_print("BAD ZAP VERSION: "+fix_instructions) + # should only warn in output and not stop builds flush_print("Cached ZAP output is up to date!") exit(0) @@ -335,10 +356,10 @@ def main(argv: Sequence[str]) -> None: flush_print(f"Generating files in {_CHEF_ZZZ_ROOT} for all devices") for device_name in _DEVICE_LIST: flush_print(f"Generating files for {device_name}") - device_out_dir = os.path.join(_CHEF_ZZZ_ROOT, device_name) - os.mkdir(device_out_dir) - device_out_dir = os.path.join(device_out_dir, "zap-generated") - os.mkdir(device_out_dir) + device_out_dir = os.path.join(_CHEF_ZZZ_ROOT, + device_name, + "zap-generated") + os.makedirs(device_out_dir) shell.run_cmd(textwrap.dedent(f"""\ {_REPO_BASE_PATH}/scripts/tools/zap/generate.py \ {_CHEF_SCRIPT_PATH}/devices/{device_name}.zap -o {device_out_dir}""")) @@ -356,7 +377,9 @@ def main(argv: Sequence[str]) -> None: if options.build_target == "nrfconnect": shell.run_cmd("export GNUARMEMB_TOOLCHAIN_PATH=\"$PW_ARM_CIPD_INSTALL_DIR\"") shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}") - shell.run_cmd(f"./chef.py -cbr --use_zzz -d {device_name} -t {options.build_target}") + command = f"./chef.py -cbr --use_zzz -d {device_name} -t {options.build_target}" + flush_print(f"Building {command}", with_border=True) + shell.run_cmd(command) exit(0) # @@ -364,6 +387,7 @@ def main(argv: Sequence[str]) -> None: # if options.build_all: + # TODO # Needs testing after refactor # Needs to call per-platform bundle function flush_print("Build all disabled") @@ -378,9 +402,7 @@ def main(argv: Sequence[str]) -> None: label = platform_meta['platform_label'] output_dir = os.path.join(_CHEF_SCRIPT_PATH, directory) command = f"./chef.py -cbr --use_zzz -d {device_name} -t {platform}" - flush_print("-" * 64) - flush_print(f"Building {command}") - flush_print("-" * 64) + flush_print(f"Building {command}", with_border=True) shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}") shell.run_cmd("export GNUARMEMB_TOOLCHAIN_PATH=\"$PW_ARM_CIPD_INSTALL_DIR\"") shell.run_cmd(command) @@ -485,9 +507,19 @@ def main(argv: Sequence[str]) -> None: "zzz_generated", options.sample_device_type_name, "zap-generated") + if not os.path.exists(zzz_dir): + flush_print(f""" + You have specified --use_zzz + for device {options.sample_device_type_name} + which does not exist in the cached ZAP output. + To cache ZAP output for this device: + ensure {options.sample_device_type_name}.zap + is placed in {_DEVICE_FOLDER} + run chef with the option --generate_zzz + """) + exit(1) shutil.rmtree(gen_dir, ignore_errors=True) shutil.copytree(zzz_dir, gen_dir) - flush_print("Building...") if options.do_rpc: flush_print("RPC PW enabled") diff --git a/examples/chef/ci_manifest.json b/examples/chef/ci_manifest.json new file mode 100644 index 00000000000000..4392775765dc48 --- /dev/null +++ b/examples/chef/ci_manifest.json @@ -0,0 +1,6 @@ +{ + "devices": { + "lighting-app": "81a1262e611fab1a71ac4129b91cec0f" + }, + "zap_commit": "TEMP DISABLED" +} diff --git a/examples/chef/cimanifest.json b/examples/chef/cimanifest.json deleted file mode 100644 index ca576bba65b1a7..00000000000000 --- a/examples/chef/cimanifest.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "lighting-app": "81a1262e611fab1a71ac4129b91cec0f", - "zap_commit": "TEMP DISABLED" -} From c12ba277350629912970c02d9f6d3f8bb52a74fd Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Wed, 1 Jun 2022 19:48:47 +0000 Subject: [PATCH 07/22] Squashed commit of the following: commit c1f494830792eeeff91e305833a0a2df5b7e2d67 Author: Austin Bozowski Date: Wed Jun 1 19:46:50 2022 +0000 Restore workflows commit 239b61cc08e887d7ac7fc7fdf34838bede987a9a Author: Austin Bozowski Date: Wed Jun 1 19:42:00 2022 +0000 Output commit 0602dc1ecc2ba4e4f8eae6163ab0fa8912f4f5dc Author: Austin Bozowski Date: Wed Jun 1 19:34:09 2022 +0000 Test commit f92534c276b1e708c767f2dd0694d85dac90bad9 Author: Austin Bozowski Date: Wed Jun 1 19:31:52 2022 +0000 Refs` commit ccc65644a4fe840e4569664039e8bb5f051a1fd3 Author: Austin Bozowski Date: Wed Jun 1 19:25:25 2022 +0000 Helpful output commit 0a1de0a68e76d9b7e3989410a4904df4331c59f4 Author: Austin Bozowski Date: Wed Jun 1 18:41:07 2022 +0000 Fix git commit cac8616059cd57d636dd48912ada3a0a238b6f29 Author: Austin Bozowski Date: Wed Jun 1 18:38:57 2022 +0000 Finish git commit 23ca7847b23d435441a9bff245c28fc75a3628fd Author: Austin Bozowski Date: Wed Jun 1 18:21:11 2022 +0000 Untested git commit d8bb5b34e851fac5cb45f6eff023df6cf456e08b Author: Austin Bozowski Date: Wed Jun 1 08:31:24 2022 +0000 Save command commit beb3b7759416a1b1cdf45196711400fead4dc737 Author: Austin Bozowski Date: Wed Jun 1 08:17:48 2022 +0000 Repair commit 5aadacfb883859c94d962d931a6ee1e70f1a3480 Author: Austin Bozowski Date: Wed Jun 1 08:15:50 2022 +0000 test commit 7bb9a173af85ef19f28ceed2942aa38163d3ce5a Author: Austin Bozowski Date: Wed Jun 1 08:08:53 2022 +0000 Format commit 04a966e1d57c76711fb1a1417aa3871b1fcf1689 Author: Austin Bozowski Date: Wed Jun 1 07:56:02 2022 +0000 RM workflows commit 5474f72c98a1cc701b220ff594c2bc22f419f4a8 Author: Austin Bozowski Date: Wed Jun 1 07:54:41 2022 +0000 Shell commit ede604cfc55a18d5f3a776805a554f126afe1cc3 Author: Austin Bozowski Date: Wed Jun 1 07:35:53 2022 +0000 Merge from pull/19006 --- examples/chef/chef.py | 70 +++--- examples/chef/ci_manifest.json | 2 +- examples/chef/stateful_shell.py | 42 +++- .../zap-generated/endpoint_config.h | 203 +++++++++--------- 4 files changed, 175 insertions(+), 142 deletions(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 7bfc506e0e55e3..86332df04c4b5c 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -97,25 +97,36 @@ def check_python_version() -> None: exit(1) -def check_zap_master() -> str: - """Produces hash of ZAP submodule in branch master - This will need to be replaced with stateful shell once it supports output - The branch should be taken as a parameter - Old code to show intent: - # git_cmd = ["git", "ls-tree", "master", "third_party/zap/repo"] - # zap_commit = str(subprocess.check_output(git_cmd, cwd=_REPO_BASE_PATH)) - # zap_commit = zap_commit.split(" ")[2] - # zap_commit = zap_commit[:zap_commit.index("\\")] +def check_zap(master=False) -> str: + """Produces hash of ZAP submodule + + Args: + master: check branch master instead of current branch + Returns: + SHA of zap submodule """ - # TODO - zap_commit = 'TEMP DISABLED' + shell.run_cmd(f"cd {_REPO_BASE_PATH}") + if master: + flush_print("Fetching master") + command = "git fetch origin master --depth=1 --recurse-submodules" + shell.run_cmd(command) + branch = "origin/master" + else: + branch = shell.run_cmd("git rev-parse --abbrev-ref HEAD", + return_cmd_output=True).replace("\n", "") + command = f"git ls-tree {branch} third_party/zap/repo" + zap_commit = shell.run_cmd(command, return_cmd_output=True) + flush_print(f"Raw zap commit {zap_commit}") + zap_commit = zap_commit.split(" ")[2] + zap_commit = zap_commit[:zap_commit.index("\t")] flush_print(f"zap commit: {zap_commit}") return zap_commit def generate_device_manifest( include_zap_submod: bool = False, - write_manifest_file: bool = False) -> Dict[str, Any]: + write_manifest_file: bool = False, + zap_check_master: bool = False) -> Dict[str, Any]: """Produces dictionary containing md5 of device dir zap files. Args: @@ -128,20 +139,21 @@ def generate_device_manifest( devices_manifest = ci_manifest["devices"] for device_name in _DEVICE_LIST: device_file_path = os.path.join(_DEVICE_FOLDER, device_name + ".zap") + file_md5 = hashlib.md5() with open(device_file_path, "rb") as device_file: - file_md5 = hashlib.md5() while data := device_file.read(128 * 32): file_md5.update(data) - device_file_md5 = file_md5.hexdigest() - devices_manifest[device_name] = device_file_md5 - flush_print(f"Current digest for {device_name} : {device_file_md5}") + device_file_md5 = file_md5.hexdigest() + devices_manifest[device_name] = device_file_md5 + flush_print(f"Current digest for {device_name} : {device_file_md5}") if write_manifest_file: - device_zzz_dir_root = os.path.join(_CHEF_ZZZ_ROOT, device_name) - device_zzz_md5_file = os.path.join(device_zzz_dir_root, _CI_DEVICE_MANIFEST_NAME) + device_zzz_md5_file = os.path.join(_CHEF_ZZZ_ROOT, + device_name, + _CI_DEVICE_MANIFEST_NAME) with open(device_zzz_md5_file, "w+", encoding="utf-8") as md5file: md5file.write(device_file_md5) if include_zap_submod: - ci_manifest["zap_commit"] = check_zap_master() + ci_manifest["zap_commit"] = check_zap(master=zap_check_master) if write_manifest_file: with open(_CI_MANIFEST_FILE_NAME, "w+", encoding="utf-8") as ci_manifest_file: ci_manifest_file.write(json.dumps(ci_manifest, indent=4)+"\n") @@ -274,7 +286,7 @@ def main(argv: Sequence[str]) -> None: if options.validate_zzz: flush_print(f"Validating\n{_CI_MANIFEST_FILE_NAME}\n{_CHEF_ZZZ_ROOT}\n", with_border=True) - fix_instructions = f""" + fix_instructions = textwrap.dedent(f""" Cached files out of date! Please: @@ -286,8 +298,9 @@ def main(argv: Sequence[str]) -> None: ./examples/chef/chef.py --generate_zzz git add {_CHEF_ZZZ_ROOT} git add {_CI_MANIFEST_FILE_NAME} - Ensure you are running with the latest version of ZAP from master!""" - ci_manifest = generate_device_manifest() + Ensure you are running with the latest version of ZAP from master!""") + ci_manifest = generate_device_manifest(include_zap_submod=True, + zap_check_master=True) with open(_CI_MANIFEST_FILE_NAME, "r", encoding="utf-8") as ci_manifest_file: cached_manifest = json.loads(ci_manifest_file.read()) cached_device_manifest = cached_manifest["devices"] @@ -308,13 +321,12 @@ def main(argv: Sequence[str]) -> None: if output_cached_md5 != device_md5: flush_print(f"OUTPUT MISMATCH {device}: {fix_instrucitons}") exit(1) - if False: - # TODO - # Disabled; should check: - # Current branch when writing manifest - # Master in CI - flush_print("BAD ZAP VERSION: "+fix_instructions) - # should only warn in output and not stop builds + current_zap = ci_manifest["zap_commit"] + cached_zap = cached_manifest["zap_commit"] + flush_print(f"currnt zap commit {current_zap}") + flush_print(f"cached zap commit {cached_zap}") + if current_zap != cached_zap: + flush_print(f"BAD ZAP VERSION: {fix_instructions}") flush_print("Cached ZAP output is up to date!") exit(0) diff --git a/examples/chef/ci_manifest.json b/examples/chef/ci_manifest.json index 4392775765dc48..e540624ea3eb60 100644 --- a/examples/chef/ci_manifest.json +++ b/examples/chef/ci_manifest.json @@ -2,5 +2,5 @@ "devices": { "lighting-app": "81a1262e611fab1a71ac4129b91cec0f" }, - "zap_commit": "TEMP DISABLED" + "zap_commit": "6594a9257ce96ee6d852eed052939849b31259fc" } diff --git a/examples/chef/stateful_shell.py b/examples/chef/stateful_shell.py index 56ba52bf493464..54faed206b7e80 100644 --- a/examples/chef/stateful_shell.py +++ b/examples/chef/stateful_shell.py @@ -16,11 +16,13 @@ import shlex import subprocess import sys -import tempfile -from typing import Dict +from typing import Dict, Optional import constants +_ENV_FILENAME = ".shell_env" +_OUTPUT_FILENAME = ".shell_output" +_HERE = os.path.dirname(os.path.abspath(__file__)) TermColors = constants.TermColors @@ -42,7 +44,8 @@ def __init__(self) -> None: # This file holds the env after running a command. This is a better approach # than writing to stdout because commands could redirect the stdout. - self.envfile_path: str = os.path.join(tempfile.gettempdir(), "envfile") + self.envfile_path: str = os.path.join(_HERE, _ENV_FILENAME) + self.cmd_output_path: str = os.path.join(_HERE, _OUTPUT_FILENAME) def print_env(self) -> None: """Print environment variables in commandline friendly format for export. @@ -56,21 +59,41 @@ def print_env(self) -> None: if env_var: print(f"export {env_var}={quoted_value}") - def run_cmd(self, cmd: str, *, raise_on_returncode=False) -> None: + def run_cmd( + self, cmd: str, *, + raise_on_returncode=True, + return_cmd_output=False, + ) -> Optional[str]: """Runs a command and updates environment. Args: cmd: Command to execute. + This does not support commands that run in the background e.g. ` &` raise_on_returncode: Whether to raise an error if the return code is nonzero. + return_cmd_output: Whether to return the command output. + If enabled, the text piped to screen won't be colorized due to output + being passed through `tee`. Raises: RuntimeError: If raise_on_returncode is set and nonzero return code is given. + + Returns: + Output of command if return_cmd_output set to True. """ env_dict = {} - # Set OLDPWD at beginning because opening the shell clears this. This handles 'cd -'. # env -0 prints the env variables separated by null characters for easy parsing. - command_with_state = f"OLDPWD={self.env.get('OLDPWD', '')}; {cmd}; env -0 > {self.envfile_path}" + + if return_cmd_output: + # Piping won't work here because piping will affect how environment variables + # are propagated. This solution uses tee without piping to preserve env variables. + redirect = f" > >(tee \"{self.cmd_output_path}\") 2>&1 " # include stderr + else: + redirect = "" + + command_with_state = ( + f"OLDPWD={self.env.get('OLDPWD', '')}; {cmd} {redirect};" + f" env -0 > {self.envfile_path}") with subprocess.Popen( [command_with_state], env=self.env, cwd=self.cwd, @@ -79,7 +102,7 @@ def run_cmd(self, cmd: str, *, raise_on_returncode=False) -> None: returncode = proc.wait() # Load env state from envfile. - with open(self.envfile_path) as f: + with open(self.envfile_path, encoding="latin1") as f: # Split on null char because we use env -0. env_entries = f.read().split("\0") for entry in env_entries: @@ -92,3 +115,8 @@ def run_cmd(self, cmd: str, *, raise_on_returncode=False) -> None: if raise_on_returncode and returncode != 0: raise RuntimeError( f"Error. Return code is not 0. It is: {returncode}") + + if return_cmd_output: + with open(self.cmd_output_path, encoding="latin1") as f: + output = f.read() + return output diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h index 66901394b64b71..2f5eb83f6cc22e 100644 --- a/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h @@ -38,26 +38,6 @@ \ /* 6 - Breadcrumb, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* Endpoint: 0, Cluster: Thread Network Diagnostics (server), big-endian */ \ - \ - /* 14 - NetworkName, */ \ - 0x00, 0x00, \ - \ - /* 16 - ExtendedPanId, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 24 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 32 - ActiveTimestamp, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 40 - PendingTimestamp, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 48 - ChannelMask, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ } #else // !BIGENDIAN_CPU @@ -73,31 +53,11 @@ \ /* 6 - Breadcrumb, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* Endpoint: 0, Cluster: Thread Network Diagnostics (server), little-endian */ \ - \ - /* 14 - NetworkName, */ \ - 0x00, 0x00, \ - \ - /* 16 - ExtendedPanId, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 24 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 32 - ActiveTimestamp, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 40 - PendingTimestamp, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 48 - ChannelMask, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (8) +#define GENERATED_DEFAULTS_COUNT (2) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -293,69 +253,102 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* channel */ \ - { 0x00000001, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* RoutingRole */ \ - { 0x00000002, ZAP_TYPE(CHAR_STRING), 17, ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(14) }, /* NetworkName */ \ - { 0x00000003, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* PanId */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(16) }, /* ExtendedPanId */ \ - { 0x00000005, ZAP_TYPE(OCTET_STRING), 18, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* MeshLocalPrefix */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(24) }, /* OverrunCount */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* channel */ \ + { 0x00000001, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* RoutingRole */ \ + { 0x00000002, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* NetworkName */ \ + { 0x00000003, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PanId */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* ExtendedPanId */ \ + { 0x00000005, ZAP_TYPE(OCTET_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* MeshLocalPrefix */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ { 0x00000007, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* NeighborTableList */ \ { 0x00000008, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RouteTableList */ \ - { 0x00000009, ZAP_TYPE(INT32U), 4, 0, ZAP_EMPTY_DEFAULT() }, /* PartitionId */ \ - { 0x0000000A, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* weighting */ \ - { 0x0000000B, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* DataVersion */ \ - { 0x0000000C, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* StableDataVersion */ \ - { 0x0000000D, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* LeaderRouterId */ \ - { 0x0000000E, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* DetachedRoleCount */ \ - { 0x0000000F, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* ChildRoleCount */ \ - { 0x00000010, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RouterRoleCount */ \ - { 0x00000011, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* LeaderRoleCount */ \ - { 0x00000012, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* AttachAttemptCount */ \ - { 0x00000013, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* PartitionIdChangeCount */ \ - { 0x00000014, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* BetterPartitionAttachAttemptCount */ \ - { 0x00000015, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* ParentChangeCount */ \ - { 0x00000016, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxTotalCount */ \ - { 0x00000017, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxUnicastCount */ \ - { 0x00000018, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxBroadcastCount */ \ - { 0x00000019, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxAckRequestedCount */ \ - { 0x0000001A, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxAckedCount */ \ - { 0x0000001B, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxNoAckRequestedCount */ \ - { 0x0000001C, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxDataCount */ \ - { 0x0000001D, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxDataPollCount */ \ - { 0x0000001E, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxBeaconCount */ \ - { 0x0000001F, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxBeaconRequestCount */ \ - { 0x00000020, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxOtherCount */ \ - { 0x00000021, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxRetryCount */ \ - { 0x00000022, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxDirectMaxRetryExpiryCount */ \ - { 0x00000023, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxIndirectMaxRetryExpiryCount */ \ - { 0x00000024, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxErrCcaCount */ \ - { 0x00000025, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxErrAbortCount */ \ - { 0x00000026, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* TxErrBusyChannelCount */ \ - { 0x00000027, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxTotalCount */ \ - { 0x00000028, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxUnicastCount */ \ - { 0x00000029, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxBroadcastCount */ \ - { 0x0000002A, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxDataCount */ \ - { 0x0000002B, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxDataPollCount */ \ - { 0x0000002C, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxBeaconCount */ \ - { 0x0000002D, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxBeaconRequestCount */ \ - { 0x0000002E, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxOtherCount */ \ - { 0x0000002F, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxAddressFilteredCount */ \ - { 0x00000030, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxDestAddrFilteredCount */ \ - { 0x00000031, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxDuplicatedCount */ \ - { 0x00000032, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrNoFrameCount */ \ - { 0x00000033, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrUnknownNeighborCount */ \ - { 0x00000034, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrInvalidSrcAddrCount */ \ - { 0x00000035, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrSecCount */ \ - { 0x00000036, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrFcsCount */ \ - { 0x00000037, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RxErrOtherCount */ \ - { 0x00000038, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(32) }, /* ActiveTimestamp */ \ - { 0x00000039, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* PendingTimestamp */ \ - { 0x0000003A, ZAP_TYPE(INT32U), 4, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* delay */ \ - { 0x0000003B, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SecurityPolicy */ \ - { 0x0000003C, ZAP_TYPE(OCTET_STRING), 5, 0, ZAP_LONG_DEFAULTS_INDEX(48) }, /* ChannelMask */ \ - { 0x0000003D, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + { 0x00000009, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PartitionId */ \ + { 0x0000000A, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* weighting */ \ + { 0x0000000B, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* DataVersion */ \ + { 0x0000000C, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* StableDataVersion */ \ + { 0x0000000D, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* LeaderRouterId */ \ + { 0x0000000E, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* DetachedRoleCount */ \ + { 0x0000000F, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ChildRoleCount */ \ + { 0x00000010, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RouterRoleCount */ \ + { 0x00000011, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* LeaderRoleCount */ \ + { 0x00000012, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* AttachAttemptCount */ \ + { 0x00000013, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* PartitionIdChangeCount */ \ + { 0x00000014, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* BetterPartitionAttachAttemptCount */ \ + { 0x00000015, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* ParentChangeCount */ \ + { 0x00000016, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxTotalCount */ \ + { 0x00000017, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxUnicastCount */ \ + { 0x00000018, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxBroadcastCount */ \ + { 0x00000019, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TxAckRequestedCount */ \ + { 0x0000001A, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxAckedCount */ \ + { 0x0000001B, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TxNoAckRequestedCount */ \ + { 0x0000001C, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxDataCount */ \ + { 0x0000001D, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxDataPollCount */ \ + { 0x0000001E, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxBeaconCount */ \ + { 0x0000001F, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TxBeaconRequestCount */ \ + { 0x00000020, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxOtherCount */ \ + { 0x00000021, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxRetryCount */ \ + { 0x00000022, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TxDirectMaxRetryExpiryCount */ \ + { 0x00000023, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TxIndirectMaxRetryExpiryCount */ \ + { 0x00000024, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCcaCount */ \ + { 0x00000025, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrAbortCount */ \ + { 0x00000026, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TxErrBusyChannelCount */ \ + { 0x00000027, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RxTotalCount */ \ + { 0x00000028, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RxUnicastCount */ \ + { 0x00000029, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RxBroadcastCount */ \ + { 0x0000002A, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RxDataCount */ \ + { 0x0000002B, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RxDataPollCount */ \ + { 0x0000002C, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RxBeaconCount */ \ + { 0x0000002D, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* RxBeaconRequestCount */ \ + { 0x0000002E, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RxOtherCount */ \ + { 0x0000002F, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* RxAddressFilteredCount */ \ + { 0x00000030, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* RxDestAddrFilteredCount */ \ + { 0x00000031, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* RxDuplicatedCount */ \ + { 0x00000032, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* RxErrNoFrameCount */ \ + { 0x00000033, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* RxErrUnknownNeighborCount */ \ + { 0x00000034, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* RxErrInvalidSrcAddrCount */ \ + { 0x00000035, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RxErrSecCount */ \ + { 0x00000036, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RxErrFcsCount */ \ + { 0x00000037, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RxErrOtherCount */ \ + { 0x00000038, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* ActiveTimestamp */ \ + { 0x00000039, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PendingTimestamp */ \ + { 0x0000003A, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* delay */ \ + { 0x0000003B, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* SecurityPolicy */ \ + { 0x0000003C, ZAP_TYPE(OCTET_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* ChannelMask */ \ + { 0x0000003D, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* OperationalDatasetComponents */ \ { 0x0000003E, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ ZAP_EMPTY_DEFAULT() }, /* ActiveNetworkFaultsList */ \ @@ -903,7 +896,7 @@ .clusterId = 0x00000035, \ .attributes = ZAP_ATTRIBUTE_INDEX(87), \ .attributeCount = 65, \ - .clusterSize = 247, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 39 ) ,\ @@ -1085,7 +1078,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 22, 492 }, { ZAP_CLUSTER_INDEX(22), 7, 109 }, \ + { ZAP_CLUSTER_INDEX(0), 22, 251 }, { ZAP_CLUSTER_INDEX(22), 7, 109 }, \ } // Largest attribute size is needed for various buffers @@ -1097,7 +1090,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (601) +#define ATTRIBUTE_MAX_SIZE (360) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) From ca7f2eb50cfef2eb7b42b5268a53f1cbbe2ba363 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Wed, 1 Jun 2022 20:00:13 +0000 Subject: [PATCH 08/22] chef generate_zzz --- examples/chef/ci_manifest.json | 2 +- .../zzz_generated/lighting-app/INPUTMD5.txt | 2 +- .../zap-generated/IMClusterCommandHandler.cpp | 50 ++++++-- .../lighting-app/zap-generated/access.h | 3 - .../zap-generated/endpoint_config.h | 113 +++++++++--------- 5 files changed, 101 insertions(+), 69 deletions(-) diff --git a/examples/chef/ci_manifest.json b/examples/chef/ci_manifest.json index e540624ea3eb60..d3ba4ad9e3e552 100644 --- a/examples/chef/ci_manifest.json +++ b/examples/chef/ci_manifest.json @@ -1,6 +1,6 @@ { "devices": { - "lighting-app": "81a1262e611fab1a71ac4129b91cec0f" + "lighting-app": "cf5e2008cd0ef3cd8ba066eb35012254" }, "zap_commit": "6594a9257ce96ee6d852eed052939849b31259fc" } diff --git a/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt b/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt index 35888789fc11c3..d1c4ae871e98ac 100644 --- a/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt +++ b/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt @@ -1 +1 @@ -81a1262e611fab1a71ac4129b91cec0f \ No newline at end of file +cf5e2008cd0ef3cd8ba066eb35012254 \ No newline at end of file diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp b/examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp index 7fb7a6d52d8f47..adf2da73d06244 100644 --- a/examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp @@ -429,6 +429,43 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } // namespace GeneralCommissioning +namespace GeneralDiagnostics { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::TestEventTrigger::Id: { + Commands::TestEventTrigger::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGeneralDiagnosticsClusterTestEventTriggerCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace GeneralDiagnostics + namespace GroupKeyManagement { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) @@ -1009,16 +1046,6 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } break; } - case Commands::RemoveTrustedRootCertificate::Id: { - Commands::RemoveTrustedRootCertificate::DecodableType commandData; - TLVError = DataModel::Decode(aDataTlv, commandData); - if (TLVError == CHIP_NO_ERROR) - { - wasHandled = emberAfOperationalCredentialsClusterRemoveTrustedRootCertificateCallback(apCommandObj, aCommandPath, - commandData); - } - break; - } default: { // Unrecognized command ID, error status will apply. apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); @@ -1172,6 +1199,9 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: case Clusters::GeneralCommissioning::Id: Clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; + case Clusters::GeneralDiagnostics::Id: + Clusters::GeneralDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; case Clusters::GroupKeyManagement::Id: Clusters::GroupKeyManagement::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/access.h b/examples/chef/zzz_generated/lighting-app/zap-generated/access.h index a3d3005357c0f0..2806b8d11356f8 100644 --- a/examples/chef/zzz_generated/lighting-app/zap-generated/access.h +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/access.h @@ -186,7 +186,6 @@ 62, /* Cluster: Operational Credentials, Command: UpdateFabricLabel, Privilege: administer */ \ 62, /* Cluster: Operational Credentials, Command: RemoveFabric, Privilege: administer */ \ 62, /* Cluster: Operational Credentials, Command: AddTrustedRootCertificate, Privilege: administer */ \ - 62, /* Cluster: Operational Credentials, Command: RemoveTrustedRootCertificate, Privilege: administer */ \ } // Parallel array data (cluster, *command*, privilege) for invoke command @@ -221,7 +220,6 @@ 9, /* Cluster: Operational Credentials, Command: UpdateFabricLabel, Privilege: administer */ \ 10, /* Cluster: Operational Credentials, Command: RemoveFabric, Privilege: administer */ \ 11, /* Cluster: Operational Credentials, Command: AddTrustedRootCertificate, Privilege: administer */ \ - 12, /* Cluster: Operational Credentials, Command: RemoveTrustedRootCertificate, Privilege: administer */ \ } // Parallel array data (cluster, command, *privilege*) for invoke command @@ -256,7 +254,6 @@ kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: UpdateFabricLabel, Privilege: administer */ \ kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: RemoveFabric, Privilege: administer */ \ kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: AddTrustedRootCertificate, Privilege: administer */ \ - kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Command: RemoveTrustedRootCertificate, Privilege: administer */ \ } //////////////////////////////////////////////////////////////////////////////// diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h index 2f5eb83f6cc22e..8b813e7a4bfc6a 100644 --- a/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h @@ -99,7 +99,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 269 +#define GENERATED_ATTRIBUTE_COUNT 270 #define GENERATED_ATTRIBUTES \ { \ \ @@ -239,7 +239,9 @@ ZAP_EMPTY_DEFAULT() }, /* ActiveHardwareFaults */ \ { 0x00000006, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ActiveRadioFaults */ \ { 0x00000007, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ - ZAP_EMPTY_DEFAULT() }, /* ActiveNetworkFaults */ \ + ZAP_EMPTY_DEFAULT() }, /* ActiveNetworkFaults */ \ + { 0x00000008, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TestEventTriggersEnabled */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ @@ -344,11 +346,11 @@ ZAP_EMPTY_DEFAULT() }, /* PendingTimestamp */ \ { 0x0000003A, ZAP_TYPE(INT32U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* delay */ \ - { 0x0000003B, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x0000003B, ZAP_TYPE(STRUCT), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* SecurityPolicy */ \ { 0x0000003C, ZAP_TYPE(OCTET_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* ChannelMask */ \ - { 0x0000003D, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x0000003D, ZAP_TYPE(STRUCT), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* OperationalDatasetComponents */ \ { 0x0000003E, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ ZAP_EMPTY_DEFAULT() }, /* ActiveNetworkFaultsList */ \ @@ -626,30 +628,34 @@ /* GeneratedCommandList (index=35)*/ \ 0x00000001 /* RetrieveLogsResponse */, \ chip::kInvalidCommandId /* end of list */, \ - /* Endpoint: 0, Cluster: Software Diagnostics (server) */\ + /* Endpoint: 0, Cluster: General Diagnostics (server) */\ /* AcceptedCommandList (index=37) */ \ + 0x00000000 /* TestEventTrigger */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Software Diagnostics (server) */\ + /* AcceptedCommandList (index=39) */ \ 0x00000000 /* ResetWatermarks */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */\ - /* AcceptedCommandList (index=39) */ \ + /* AcceptedCommandList (index=41) */ \ 0x00000000 /* ResetCounts */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */\ - /* AcceptedCommandList (index=41) */ \ + /* AcceptedCommandList (index=43) */ \ 0x00000000 /* ResetCounts */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */\ - /* AcceptedCommandList (index=43) */ \ + /* AcceptedCommandList (index=45) */ \ 0x00000000 /* ResetCounts */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */\ - /* AcceptedCommandList (index=45) */ \ + /* AcceptedCommandList (index=47) */ \ 0x00000000 /* OpenCommissioningWindow */, \ 0x00000001 /* OpenBasicCommissioningWindow */, \ 0x00000002 /* RevokeCommissioning */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 0, Cluster: Operational Credentials (server) */\ - /* AcceptedCommandList (index=49) */ \ + /* AcceptedCommandList (index=51) */ \ 0x00000000 /* AttestationRequest */, \ 0x00000002 /* CertificateChainRequest */, \ 0x00000004 /* CSRRequest */, \ @@ -658,32 +664,31 @@ 0x00000009 /* UpdateFabricLabel */, \ 0x0000000A /* RemoveFabric */, \ 0x0000000B /* AddTrustedRootCertificate */, \ - 0x0000000C /* RemoveTrustedRootCertificate */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=59)*/ \ + /* GeneratedCommandList (index=60)*/ \ 0x00000001 /* AttestationResponse */, \ 0x00000003 /* CertificateChainResponse */, \ 0x00000005 /* CSRResponse */, \ 0x00000008 /* NOCResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 0, Cluster: Group Key Management (server) */\ - /* AcceptedCommandList (index=64) */ \ + /* AcceptedCommandList (index=65) */ \ 0x00000000 /* KeySetWrite */, \ 0x00000001 /* KeySetRead */, \ 0x00000003 /* KeySetRemove */, \ 0x00000004 /* KeySetReadAllIndices */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=69)*/ \ + /* GeneratedCommandList (index=70)*/ \ 0x00000002 /* KeySetReadResponse */, \ 0x00000005 /* KeySetReadAllIndicesResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Identify (server) */\ - /* AcceptedCommandList (index=72) */ \ + /* AcceptedCommandList (index=73) */ \ 0x00000000 /* Identify */, \ 0x00000040 /* TriggerEffect */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Groups (server) */\ - /* AcceptedCommandList (index=75) */ \ + /* AcceptedCommandList (index=76) */ \ 0x00000000 /* AddGroup */, \ 0x00000001 /* ViewGroup */, \ 0x00000002 /* GetGroupMembership */, \ @@ -691,14 +696,14 @@ 0x00000004 /* RemoveAllGroups */, \ 0x00000005 /* AddGroupIfIdentifying */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=82)*/ \ + /* GeneratedCommandList (index=83)*/ \ 0x00000000 /* AddGroupResponse */, \ 0x00000001 /* ViewGroupResponse */, \ 0x00000002 /* GetGroupMembershipResponse */, \ 0x00000003 /* RemoveGroupResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: On/Off (server) */\ - /* AcceptedCommandList (index=87) */ \ + /* AcceptedCommandList (index=88) */ \ 0x00000000 /* Off */, \ 0x00000001 /* On */, \ 0x00000002 /* Toggle */, \ @@ -707,7 +712,7 @@ 0x00000042 /* OnWithTimedOff */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Level Control (server) */\ - /* AcceptedCommandList (index=94) */ \ + /* AcceptedCommandList (index=95) */ \ 0x00000000 /* MoveToLevel */, \ 0x00000001 /* Move */, \ 0x00000002 /* Step */, \ @@ -718,7 +723,7 @@ 0x00000007 /* StopWithOnOff */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Color Control (server) */\ - /* AcceptedCommandList (index=103) */ \ + /* AcceptedCommandList (index=104) */ \ 0x00000000 /* MoveToHue */, \ 0x00000001 /* MoveHue */, \ 0x00000002 /* StepHue */, \ @@ -873,61 +878,61 @@ /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ .clusterId = 0x00000033, \ .attributes = ZAP_ATTRIBUTE_INDEX(71), \ - .attributeCount = 10, \ + .attributeCount = 11, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = nullptr ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 37 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ .clusterId = 0x00000034, \ - .attributes = ZAP_ATTRIBUTE_INDEX(81), \ + .attributes = ZAP_ATTRIBUTE_INDEX(82), \ .attributeCount = 6, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 37 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 39 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ .clusterId = 0x00000035, \ - .attributes = ZAP_ATTRIBUTE_INDEX(87), \ + .attributes = ZAP_ATTRIBUTE_INDEX(88), \ .attributeCount = 65, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 39 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 41 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ .clusterId = 0x00000036, \ - .attributes = ZAP_ATTRIBUTE_INDEX(152), \ + .attributes = ZAP_ATTRIBUTE_INDEX(153), \ .attributeCount = 15, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 41 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 43 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ .clusterId = 0x00000037, \ - .attributes = ZAP_ATTRIBUTE_INDEX(167), \ + .attributes = ZAP_ATTRIBUTE_INDEX(168), \ .attributeCount = 11, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 43 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 45 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Switch (server) */ \ .clusterId = 0x0000003B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(178), \ + .attributes = ZAP_ATTRIBUTE_INDEX(179), \ .attributeCount = 2, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -938,40 +943,40 @@ { \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ .clusterId = 0x0000003C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(180), \ + .attributes = ZAP_ATTRIBUTE_INDEX(181), \ .attributeCount = 5, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 45 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 47 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ .clusterId = 0x0000003E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(185), \ + .attributes = ZAP_ATTRIBUTE_INDEX(186), \ .attributeCount = 8, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 49 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 59 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 51 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 60 ) ,\ },\ { \ /* Endpoint: 0, Cluster: Group Key Management (server) */ \ .clusterId = 0x0000003F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(193), \ + .attributes = ZAP_ATTRIBUTE_INDEX(194), \ .attributeCount = 6, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 64 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 69 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 65 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 70 ) ,\ },\ { \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ .clusterId = 0x00000040, \ - .attributes = ZAP_ATTRIBUTE_INDEX(199), \ + .attributes = ZAP_ATTRIBUTE_INDEX(200), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -982,7 +987,7 @@ { \ /* Endpoint: 0, Cluster: User Label (server) */ \ .clusterId = 0x00000041, \ - .attributes = ZAP_ATTRIBUTE_INDEX(202), \ + .attributes = ZAP_ATTRIBUTE_INDEX(203), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -993,51 +998,51 @@ { \ /* Endpoint: 1, Cluster: Identify (server) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(205), \ + .attributes = ZAP_ATTRIBUTE_INDEX(206), \ .attributeCount = 4, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayIdentifyServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 72 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 73 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(209), \ + .attributes = ZAP_ATTRIBUTE_INDEX(210), \ .attributeCount = 3, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 75 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 82 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 76 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 83 ) ,\ },\ { \ /* Endpoint: 1, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(212), \ + .attributes = ZAP_ATTRIBUTE_INDEX(213), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 87 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 88 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Level Control (server) */ \ .clusterId = 0x00000008, \ - .attributes = ZAP_ATTRIBUTE_INDEX(219), \ + .attributes = ZAP_ATTRIBUTE_INDEX(220), \ .attributeCount = 16, \ .clusterSize = 27, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayLevelControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 94 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 95 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(235), \ + .attributes = ZAP_ATTRIBUTE_INDEX(236), \ .attributeCount = 6, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1048,18 +1053,18 @@ { \ /* Endpoint: 1, Cluster: Color Control (server) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(241), \ + .attributes = ZAP_ATTRIBUTE_INDEX(242), \ .attributeCount = 23, \ .clusterSize = 40, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayColorControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 103 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 104 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(264), \ + .attributes = ZAP_ATTRIBUTE_INDEX(265), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ From c8456a704c6eaf192f83a010ebc32f4085645a1c Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Wed, 1 Jun 2022 20:08:12 +0000 Subject: [PATCH 09/22] Simplify md5 --- examples/chef/chef.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 86332df04c4b5c..cb860f63ce822c 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -139,11 +139,9 @@ def generate_device_manifest( devices_manifest = ci_manifest["devices"] for device_name in _DEVICE_LIST: device_file_path = os.path.join(_DEVICE_FOLDER, device_name + ".zap") - file_md5 = hashlib.md5() with open(device_file_path, "rb") as device_file: - while data := device_file.read(128 * 32): - file_md5.update(data) - device_file_md5 = file_md5.hexdigest() + device_file_data = device_file.read() + device_file_md5 = hashlib.md5(device_file_data).hexdigest() devices_manifest[device_name] = device_file_md5 flush_print(f"Current digest for {device_name} : {device_file_md5}") if write_manifest_file: @@ -323,7 +321,7 @@ def main(argv: Sequence[str]) -> None: exit(1) current_zap = ci_manifest["zap_commit"] cached_zap = cached_manifest["zap_commit"] - flush_print(f"currnt zap commit {current_zap}") + flush_print(f"current zap commit {current_zap}") flush_print(f"cached zap commit {cached_zap}") if current_zap != cached_zap: flush_print(f"BAD ZAP VERSION: {fix_instructions}") From 6537adb28c805f2533488a31c312ed428dacb1fe Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Wed, 1 Jun 2022 20:33:08 +0000 Subject: [PATCH 10/22] Restyle, dedent, fix instructions --- examples/chef/chef.py | 8 ++++---- examples/chef/stateful_shell.py | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index cb860f63ce822c..41c21bb13689db 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -294,8 +294,8 @@ def main(argv: Sequence[str]) -> None: npm install cd ../../.. ./examples/chef/chef.py --generate_zzz - git add {_CHEF_ZZZ_ROOT} - git add {_CI_MANIFEST_FILE_NAME} + git add examples/chef/ci_manifest.json + git add examples/chef/zzz_generated Ensure you are running with the latest version of ZAP from master!""") ci_manifest = generate_device_manifest(include_zap_submod=True, zap_check_master=True) @@ -518,7 +518,7 @@ def main(argv: Sequence[str]) -> None: options.sample_device_type_name, "zap-generated") if not os.path.exists(zzz_dir): - flush_print(f""" + flush_print(textwrap.dedent(f""" You have specified --use_zzz for device {options.sample_device_type_name} which does not exist in the cached ZAP output. @@ -526,7 +526,7 @@ def main(argv: Sequence[str]) -> None: ensure {options.sample_device_type_name}.zap is placed in {_DEVICE_FOLDER} run chef with the option --generate_zzz - """) + """)) exit(1) shutil.rmtree(gen_dir, ignore_errors=True) shutil.copytree(zzz_dir, gen_dir) diff --git a/examples/chef/stateful_shell.py b/examples/chef/stateful_shell.py index 160927352d9028..22dc3e4da67290 100644 --- a/examples/chef/stateful_shell.py +++ b/examples/chef/stateful_shell.py @@ -60,7 +60,6 @@ def print_env(self) -> None: if env_var: print(f"export {env_var}={quoted_value}") - def run_cmd( self, cmd: str, *, raise_on_returncode=True, From 1b7786ed9426d1af9e8acc0ded82f88eeb85646d Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Wed, 1 Jun 2022 20:43:04 +0000 Subject: [PATCH 11/22] Missed type hint --- examples/chef/chef.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 41c21bb13689db..1ae55d683b510b 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -97,7 +97,7 @@ def check_python_version() -> None: exit(1) -def check_zap(master=False) -> str: +def check_zap(master: bool = False) -> str: """Produces hash of ZAP submodule Args: From bfa6278152c0bf58abb73b0fa1972a67d2a47498 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Wed, 1 Jun 2022 21:41:58 +0000 Subject: [PATCH 12/22] Missed return code --- examples/chef/chef.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 1ae55d683b510b..dfeaaff8797ac0 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -325,6 +325,7 @@ def main(argv: Sequence[str]) -> None: flush_print(f"cached zap commit {cached_zap}") if current_zap != cached_zap: flush_print(f"BAD ZAP VERSION: {fix_instructions}") + exit(1) flush_print("Cached ZAP output is up to date!") exit(0) From f04b770345a7743af0057a050389a21b90f3d18b Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Thu, 2 Jun 2022 01:48:58 +0000 Subject: [PATCH 13/22] Squashed commit of the following: commit 2ecd59cefce5e38f84fb33fef593f8258118bc65 Author: Austin Bozowski Date: Thu Jun 2 01:47:42 2022 +0000 [no ci] restore workflows commit 1fca56e51249931ded9060b73139827d87d79738 Author: Austin Bozowski Date: Thu Jun 2 01:46:24 2022 +0000 Clean commit c91c923cd0556ad74c9b470bfa5344ed0e6971d1 Author: Austin Bozowski Date: Thu Jun 2 01:39:37 2022 +0000 Style commit 950d454937d8017fcc756a8108fa4259c929bd7c Author: Austin Bozowski Date: Thu Jun 2 01:32:32 2022 +0000 generate_zzz commit b151b26dcf9b23e5ec77437169f15b77041aa5c0 Author: Austin Bozowski Date: Thu Jun 2 01:31:41 2022 +0000 Update help text commit 576f1637590d74482dbc4ef4ebd0dcd5aff9fb9b Author: Austin Bozowski Date: Thu Jun 2 01:27:13 2022 +0000 fix dead ref commit 27ea5b5fe496a783c9eb41218681bd61d9aa9005 Author: Austin Bozowski Date: Thu Jun 2 01:24:54 2022 +0000 validate should break now commit c8762f650aa5f890950327e2206c2e6a9be67fec Author: Austin Bozowski Date: Thu Jun 2 01:10:31 2022 +0000 docstring commit 69e84a4462d06fae09e717399f2341b3dcb34916 Author: Austin Bozowski Date: Thu Jun 2 01:07:38 2022 +0000 Delete manifest commit bce3069e4a5fbe2ade046ee36b09d993ca850130 Author: Austin Bozowski Date: Thu Jun 2 01:07:01 2022 +0000 Make write to folder commit ca95512ae598acf08abd196a0c27374193c18c11 Author: Austin Bozowski Date: Thu Jun 2 00:45:49 2022 +0000 Temp delete workflows, remove git check on master --- examples/chef/chef.py | 87 ++++++++----------- examples/chef/ci_manifest.json | 6 -- .../zzz_generated/lighting-app/ZAPSHA.txt | 1 + .../zap-generated/endpoint_config.h | 5 +- 4 files changed, 42 insertions(+), 57 deletions(-) delete mode 100644 examples/chef/ci_manifest.json create mode 100644 examples/chef/zzz_generated/lighting-app/ZAPSHA.txt diff --git a/examples/chef/chef.py b/examples/chef/chef.py index dfeaaff8797ac0..2645a8a3108457 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -38,8 +38,8 @@ _DEVICE_FOLDER = os.path.join(_CHEF_SCRIPT_PATH, "devices") _DEVICE_LIST = [file[:-4] for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap")] _CHEF_ZZZ_ROOT = os.path.join(_CHEF_SCRIPT_PATH, "zzz_generated") -_CI_MANIFEST_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "ci_manifest.json") _CI_DEVICE_MANIFEST_NAME = "INPUTMD5.txt" +_CI_ZAP_MANIFEST_NAME = "ZAPSHA.txt" _CICD_CONFIG_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cicd_meta.json") _CI_ALLOW_LIST = ["lighting-app"] @@ -98,12 +98,12 @@ def check_python_version() -> None: def check_zap(master: bool = False) -> str: - """Produces hash of ZAP submodule + """Produces hash of ZAP submodule. Args: - master: check branch master instead of current branch + master: Check branch master instead of current branch. Returns: - SHA of zap submodule + SHA of zap submodule. """ shell.run_cmd(f"cd {_REPO_BASE_PATH}") if master: @@ -116,27 +116,27 @@ def check_zap(master: bool = False) -> str: return_cmd_output=True).replace("\n", "") command = f"git ls-tree {branch} third_party/zap/repo" zap_commit = shell.run_cmd(command, return_cmd_output=True) - flush_print(f"Raw zap commit {zap_commit}") zap_commit = zap_commit.split(" ")[2] zap_commit = zap_commit[:zap_commit.index("\t")] - flush_print(f"zap commit: {zap_commit}") + flush_print(f"found zap commit: {zap_commit}") return zap_commit def generate_device_manifest( - include_zap_submod: bool = False, write_manifest_file: bool = False, zap_check_master: bool = False) -> Dict[str, Any]: """Produces dictionary containing md5 of device dir zap files. Args: - include_zap_submod: Include ZAP commit in manifest - write_manifest_file: Serialize manifest in file and tree + write_manifest_file: Serialize manifest in file and tree. + zap_check_master: Check master instead of HEAD for zap. Returns: Dict containing MD5 of device dir zap files. """ ci_manifest = {"devices": {}} devices_manifest = ci_manifest["devices"] + zap_sha = check_zap(master=zap_check_master) + ci_manifest["zap_commit"] = zap_sha for device_name in _DEVICE_LIST: device_file_path = os.path.join(_DEVICE_FOLDER, device_name + ".zap") with open(device_file_path, "rb") as device_file: @@ -145,16 +145,13 @@ def generate_device_manifest( devices_manifest[device_name] = device_file_md5 flush_print(f"Current digest for {device_name} : {device_file_md5}") if write_manifest_file: - device_zzz_md5_file = os.path.join(_CHEF_ZZZ_ROOT, - device_name, - _CI_DEVICE_MANIFEST_NAME) - with open(device_zzz_md5_file, "w+", encoding="utf-8") as md5file: - md5file.write(device_file_md5) - if include_zap_submod: - ci_manifest["zap_commit"] = check_zap(master=zap_check_master) - if write_manifest_file: - with open(_CI_MANIFEST_FILE_NAME, "w+", encoding="utf-8") as ci_manifest_file: - ci_manifest_file.write(json.dumps(ci_manifest, indent=4)+"\n") + device_zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device_name) + device_zzz_md5_file = os.path.join(device_zzz_dir, _CI_DEVICE_MANIFEST_NAME) + with open(device_zzz_md5_file, "w+", encoding="utf-8") as md5_file: + md5_file.write(device_file_md5) + device_zzz_zap_sha_file = os.path.join(device_zzz_dir, _CI_ZAP_MANIFEST_NAME) + with open(device_zzz_zap_sha_file, "w+", encoding="utf-8") as zap_sha_file: + zap_sha_file.write(zap_sha) return ci_manifest @@ -173,13 +170,11 @@ def load_cicd_config() -> Dict[str, Any]: def flush_print( to_print: str, with_border: bool = False) -> None: - """Prints and flushes stdout buffer + """Prints and flushes stdout buffer. Args: - to_print: The string to print - with_border: Add boarder above and below to_print - Returns: - None + to_print: The string to print. + with_border: Add boarder above and below to_print. """ if with_border: border = ('-' * 64) + '\n' @@ -282,10 +277,9 @@ def main(argv: Sequence[str]) -> None: # if options.validate_zzz: - flush_print(f"Validating\n{_CI_MANIFEST_FILE_NAME}\n{_CHEF_ZZZ_ROOT}\n", + flush_print(f"Validating\n{_CHEF_ZZZ_ROOT}\n", with_border=True) - fix_instructions = textwrap.dedent(f""" - + fix_instructions = textwrap.dedent(f""" \ Cached files out of date! Please: ./scripts/bootstrap.sh @@ -294,38 +288,33 @@ def main(argv: Sequence[str]) -> None: npm install cd ../../.. ./examples/chef/chef.py --generate_zzz - git add examples/chef/ci_manifest.json git add examples/chef/zzz_generated Ensure you are running with the latest version of ZAP from master!""") - ci_manifest = generate_device_manifest(include_zap_submod=True, - zap_check_master=True) - with open(_CI_MANIFEST_FILE_NAME, "r", encoding="utf-8") as ci_manifest_file: - cached_manifest = json.loads(ci_manifest_file.read()) - cached_device_manifest = cached_manifest["devices"] + ci_manifest = generate_device_manifest() + current_zap = ci_manifest["zap_commit"] for device, device_md5 in ci_manifest["devices"].items(): zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device) + device_zap_sha_file = os.path.join(zzz_dir, _CI_ZAP_MANIFEST_NAME) device_md5_file = os.path.join(zzz_dir, _CI_DEVICE_MANIFEST_NAME) - if device not in cached_device_manifest: - flush_print(f"MANIFEST MISSING {device}: {fix_instructions}") - elif cached_device_manifest[device] != device_md5: - flush_print(f"MANIFEST MISMATCH {device}: {fix_instructions}") + help_msg = f"{device}: {fix_instructions}" + if not os.path.exists(device_zap_sha_file): + flush_print(f"ZAP VERSION MISSING {help_msg}") exit(1) - elif not os.path.exists(device_md5_file): - flush_print(f"OUTPUT MISSING {device}: {fix_instructions}") + else: + with open(device_zap_sha_file, "r", encoding="utf-8") as zap_file: + output_cached_zap_sha = zap_file.read() + if output_cached_zap_sha != current_zap: + flush_print(f"ZAP VERSION MISMATCH {help_msg}") + exit(1) + if not os.path.exists(device_md5_file): + flush_print(f"INPUT MD5 MISSING {help_msg}") exit(1) else: with open(device_md5_file, "r", encoding="utf-8") as md5_file: output_cached_md5 = md5_file.read() if output_cached_md5 != device_md5: - flush_print(f"OUTPUT MISMATCH {device}: {fix_instrucitons}") + flush_print(f"INPUT MD5 MISMATCH {help_msg}") exit(1) - current_zap = ci_manifest["zap_commit"] - cached_zap = cached_manifest["zap_commit"] - flush_print(f"current zap commit {current_zap}") - flush_print(f"cached zap commit {cached_zap}") - if current_zap != cached_zap: - flush_print(f"BAD ZAP VERSION: {fix_instructions}") - exit(1) flush_print("Cached ZAP output is up to date!") exit(0) @@ -375,8 +364,7 @@ def main(argv: Sequence[str]) -> None: {_REPO_BASE_PATH}/scripts/tools/zap/generate.py \ {_CHEF_SCRIPT_PATH}/devices/{device_name}.zap -o {device_out_dir}""")) shell.run_cmd(f"touch {device_out_dir}/af-gen-event.h") - generate_device_manifest(include_zap_submod=True, - write_manifest_file=True) + generate_device_manifest(write_manifest_file=True) exit(0) # @@ -399,7 +387,6 @@ def main(argv: Sequence[str]) -> None: if options.build_all: # TODO - # Needs testing after refactor # Needs to call per-platform bundle function flush_print("Build all disabled") exit(1) diff --git a/examples/chef/ci_manifest.json b/examples/chef/ci_manifest.json deleted file mode 100644 index d3ba4ad9e3e552..00000000000000 --- a/examples/chef/ci_manifest.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "devices": { - "lighting-app": "cf5e2008cd0ef3cd8ba066eb35012254" - }, - "zap_commit": "6594a9257ce96ee6d852eed052939849b31259fc" -} diff --git a/examples/chef/zzz_generated/lighting-app/ZAPSHA.txt b/examples/chef/zzz_generated/lighting-app/ZAPSHA.txt new file mode 100644 index 00000000000000..02a77022fa0d56 --- /dev/null +++ b/examples/chef/zzz_generated/lighting-app/ZAPSHA.txt @@ -0,0 +1 @@ +6594a9257ce96ee6d852eed052939849b31259fc \ No newline at end of file diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h index 8b813e7a4bfc6a..d19927ef456eb1 100644 --- a/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h @@ -1116,7 +1116,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, // Array of device types #define FIXED_DEVICE_TYPES \ { \ - { 0x0016, 1 }, { 0x0101, 1 } \ + { 0x0016, 1 }, \ + { \ + 0x0101, 1 \ + } \ } // Array of device type offsets From 15d187be1317b6a119355f7322269761328bbf20 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Thu, 2 Jun 2022 01:56:29 +0000 Subject: [PATCH 14/22] Exclude chef zzz_generated from restyle --- .restyled.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.restyled.yaml b/.restyled.yaml index 28003f28532fd4..766b9ad0ad70ef 100644 --- a/.restyled.yaml +++ b/.restyled.yaml @@ -70,6 +70,7 @@ exclude: - "src/controller/python/chip/clusters/Objects.py" # generated file, no point to restyle - "src/controller/python/chip/clusters/CHIPClusters.py" # generated file, no point to restyle - "scripts/idl/tests/outputs/**/*" # Matches generated output 1:1 + - "examples/chef/zzz_generated" changed_paths: From 2d471f03aaa3558f8810cb83f700f223074039db Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Thu, 2 Jun 2022 02:09:27 +0000 Subject: [PATCH 15/22] Exclude restyle --- .restyled.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.restyled.yaml b/.restyled.yaml index 766b9ad0ad70ef..eb9e0e6a92d8ea 100644 --- a/.restyled.yaml +++ b/.restyled.yaml @@ -70,7 +70,7 @@ exclude: - "src/controller/python/chip/clusters/Objects.py" # generated file, no point to restyle - "src/controller/python/chip/clusters/CHIPClusters.py" # generated file, no point to restyle - "scripts/idl/tests/outputs/**/*" # Matches generated output 1:1 - - "examples/chef/zzz_generated" + - "examples/chef/zzz_generated/**/*" changed_paths: From 2e77e8d5223a9f275300f1cefe6157036ac52549 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Thu, 2 Jun 2022 21:38:32 +0000 Subject: [PATCH 16/22] Squashed commit of the following: commit 436ce0b33adec9cae50e3bcddbba52fc388d0ded Author: Austin Bozowski Date: Thu Jun 2 21:36:07 2022 +0000 [no ci] caps commit 126ff6a4c9ad7fb4e66651e81c9fec2e9b6923d6 Author: Austin Bozowski Date: Thu Jun 2 21:28:34 2022 +0000 Restyle commit f7b72225724ced2803f7ec53d1434ea59810274d Author: Austin Bozowski Date: Thu Jun 2 21:23:37 2022 +0000 [no ci] restore workflows commit d44b0146ba395e05d4d74e94db3e910d6e0381a6 Author: Austin Bozowski Date: Thu Jun 2 21:21:27 2022 +0000 README commit be2dc9ccca28d66ae6d0385593da480463e5e7ea Author: Austin Bozowski Date: Thu Jun 2 21:19:04 2022 +0000 README commit 01deda9783fbd916eaf46d99757b9506465590b3 Author: Austin Bozowski Date: Thu Jun 2 21:15:31 2022 +0000 README commit abba2241ab1198fdfc63782c40bda5aa53b6e18b Author: Austin Bozowski Date: Thu Jun 2 20:37:28 2022 +0000 Make GCB workable commit 1623e4bc7ef5e7412277ca4429f2c2aa350de650 Author: Austin Bozowski Date: Thu Jun 2 20:31:36 2022 +0000 Flatten with block commit 02f3e78a450010fbcfa5f87b4fa176678dc8fb30 Author: Austin Bozowski Date: Thu Jun 2 20:29:42 2022 +0000 Remove functionality to check master branch for zap commit 2a79c1c9d63226174ed00208c17086c61cb22c48 Author: Austin Bozowski Date: Thu Jun 2 20:24:07 2022 +0000 Remove explicit encoding commit 2dfcb00e3142f9d16c440b755b2c893d19e1855d Author: Austin Bozowski Date: Thu Jun 2 20:20:43 2022 +0000 Temp delete workflows --- examples/chef/README.md | 61 +++++++++++++++++++++++++++++++ examples/chef/chef.py | 57 ++++++++++++----------------- integrations/cloudbuild/chef.yaml | 6 +-- 3 files changed, 87 insertions(+), 37 deletions(-) diff --git a/examples/chef/README.md b/examples/chef/README.md index 0ccd51193bae73..72fa7f8ed49150 100644 --- a/examples/chef/README.md +++ b/examples/chef/README.md @@ -58,3 +58,64 @@ Run `chef.py -h` to see the available commands 3. Click on `Save As` and save the file with the name of your new device type into the `devices` folder. This device is now available for the script. See `chef.py -h` for a list of devices available. + +## CI + +### zzz_generated + +To eliminate a dependnecy on ZAP in CI jobs, all chef examples found in +`examples/chef/devices` must have their output from the ZAP tool cached in +`examples/chef/zzz_generated`. + +To generate the cache, one may execute chef with the option `--generate_zzz`. +This will run ZAP for all devices in `examples/chef/devices` and place the +output into the appropriate directory structure. + +Other than the output from the ZAP tool, the cache directory contains two +additional files for each device: + +- `INPUTMD5.txt` contains the md5 hex digest of the ZAP file used to generate + the directory. +- `ZAPSHA.txt` contains the commit of ZAP in the user's tree when the + directory was generated. + +``` +zzz_generated/ +└── lighting-app + ├── INPUTMD5.txt + ├── zap-generated + │   ├── access.h + │   ├── af-gen-event.h + │   └── ... + └── ZAPSHA.txt +``` + +These additional files will be used by the CI jobs to validate whether the cache +must be regenerated i.e. regeneration is needed when ZAP or the input ZAP files +change. + +### Workflow + +All CI jobs for chef can be found in `.github/workflows/chef.yaml`. + +#### Validate + +The workflow begins by calling chef with `--validate_zzz`. + +`--validate_zzz` will recalculate the current ZAP commit and the md5 of all +example ZAP files and compare with what is committed to `zzz_generated`. + +If the validation job fails, it will provide instructions to repair +`zzz_generated` and no builds will run. + +#### Build + +Once the validation job is complete, there is a separate job for each platform, +which run in parallel. + +These jobs use a platform-specific image with base `chip-build`. + +The build jobs call chef with the options `--ci -t `. The `--ci` +option will execute builds for all devices specified in `_CI_ALLOW_LIST` defined +in `chef.py` (so long as these devices are also in `/devices`) on the specified +platform. diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 2645a8a3108457..d36ce27178d703 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -97,45 +97,36 @@ def check_python_version() -> None: exit(1) -def check_zap(master: bool = False) -> str: - """Produces hash of ZAP submodule. +def check_zap() -> str: + """Produces SHA of ZAP submodule for current HEAD. - Args: - master: Check branch master instead of current branch. Returns: SHA of zap submodule. """ shell.run_cmd(f"cd {_REPO_BASE_PATH}") - if master: - flush_print("Fetching master") - command = "git fetch origin master --depth=1 --recurse-submodules" - shell.run_cmd(command) - branch = "origin/master" - else: - branch = shell.run_cmd("git rev-parse --abbrev-ref HEAD", - return_cmd_output=True).replace("\n", "") + branch = shell.run_cmd("git rev-parse --abbrev-ref HEAD", + return_cmd_output=True) + branch = branch.replace("\n", "") command = f"git ls-tree {branch} third_party/zap/repo" zap_commit = shell.run_cmd(command, return_cmd_output=True) zap_commit = zap_commit.split(" ")[2] zap_commit = zap_commit[:zap_commit.index("\t")] - flush_print(f"found zap commit: {zap_commit}") + flush_print(f"Found zap commit: {zap_commit}") return zap_commit def generate_device_manifest( - write_manifest_file: bool = False, - zap_check_master: bool = False) -> Dict[str, Any]: + write_manifest_file: bool = False) -> Dict[str, Any]: """Produces dictionary containing md5 of device dir zap files. Args: - write_manifest_file: Serialize manifest in file and tree. - zap_check_master: Check master instead of HEAD for zap. + write_manifest_file: Serialize manifest in tree. Returns: Dict containing MD5 of device dir zap files. """ ci_manifest = {"devices": {}} devices_manifest = ci_manifest["devices"] - zap_sha = check_zap(master=zap_check_master) + zap_sha = check_zap() ci_manifest["zap_commit"] = zap_sha for device_name in _DEVICE_LIST: device_file_path = os.path.join(_DEVICE_FOLDER, device_name + ".zap") @@ -147,23 +138,23 @@ def generate_device_manifest( if write_manifest_file: device_zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device_name) device_zzz_md5_file = os.path.join(device_zzz_dir, _CI_DEVICE_MANIFEST_NAME) - with open(device_zzz_md5_file, "w+", encoding="utf-8") as md5_file: + with open(device_zzz_md5_file, "w+") as md5_file: md5_file.write(device_file_md5) device_zzz_zap_sha_file = os.path.join(device_zzz_dir, _CI_ZAP_MANIFEST_NAME) - with open(device_zzz_zap_sha_file, "w+", encoding="utf-8") as zap_sha_file: + with open(device_zzz_zap_sha_file, "w+") as zap_sha_file: zap_sha_file.write(zap_sha) return ci_manifest def load_cicd_config() -> Dict[str, Any]: - with open(_CICD_CONFIG_FILE_NAME, "r", encoding="utf-8") as config_file: + with open(_CICD_CONFIG_FILE_NAME) as config_file: config = json.loads(config_file.read()) - for platform_name, platform_config in config.items(): - has_build_dir = "build_dir" in platform_config - has_plat_label = "platform_label" in platform_config - if not has_build_dir or not has_plat_label: - flush_print(f"{platform_name} CICD config missing build_dir or platform_label") - exit(1) + for platform_name, platform_config in config.items(): + has_build_dir = "build_dir" in platform_config + has_plat_label = "platform_label" in platform_config + if not has_build_dir or not has_plat_label: + flush_print(f"{platform_name} CICD config missing build_dir or platform_label") + exit(1) return config @@ -301,7 +292,7 @@ def main(argv: Sequence[str]) -> None: flush_print(f"ZAP VERSION MISSING {help_msg}") exit(1) else: - with open(device_zap_sha_file, "r", encoding="utf-8") as zap_file: + with open(device_zap_sha_file) as zap_file: output_cached_zap_sha = zap_file.read() if output_cached_zap_sha != current_zap: flush_print(f"ZAP VERSION MISMATCH {help_msg}") @@ -310,7 +301,7 @@ def main(argv: Sequence[str]) -> None: flush_print(f"INPUT MD5 MISSING {help_msg}") exit(1) else: - with open(device_md5_file, "r", encoding="utf-8") as md5_file: + with open(device_md5_file) as md5_file: output_cached_md5 = md5_file.read() if output_cached_md5 != device_md5: flush_print(f"INPUT MD5 MISMATCH {help_msg}") @@ -379,6 +370,7 @@ def main(argv: Sequence[str]) -> None: command = f"./chef.py -cbr --use_zzz -d {device_name} -t {options.build_target}" flush_print(f"Building {command}", with_border=True) shell.run_cmd(command) + # TODO call per-platform bundle function for extra validation exit(0) # @@ -386,10 +378,6 @@ def main(argv: Sequence[str]) -> None: # if options.build_all: - # TODO - # Needs to call per-platform bundle function - flush_print("Build all disabled") - exit(1) flush_print("Building all chef examples") archive_prefix = "/workspace/artifacts/" archive_suffix = ".tar.gz" @@ -404,7 +392,8 @@ def main(argv: Sequence[str]) -> None: shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}") shell.run_cmd("export GNUARMEMB_TOOLCHAIN_PATH=\"$PW_ARM_CIPD_INSTALL_DIR\"") shell.run_cmd(command) - archive_name = f"{label}-chef-{device_name}-wifi-rpc" + # TODO Needs to call per-platform bundle function + archive_name = f"{label}-{device_name}" archive_full_name = archive_prefix + archive_name + archive_suffix flush_print(f"Adding build output to archive {archive_full_name}") with tarfile.open(archive_full_name, "w:gz") as tar: diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index 37d01efc3e8616..f70c63976217dd 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -37,6 +37,6 @@ artifacts: paths: ["/workspace/artifacts/*.tar.gz"] # Using higher CPU machines generally speeds up builds, except bootstrap is always # slow. -# options: -# machineType: "E2_HIGHCPU_32" -# diskSizeGb: 200 +options: + machineType: "E2_HIGHCPU_32" + diskSizeGb: 200 From 47d20659208ac420da63644458833fbbd5e04a69 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Thu, 2 Jun 2022 22:57:10 +0000 Subject: [PATCH 17/22] Misspelled word --- examples/chef/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/README.md b/examples/chef/README.md index 72fa7f8ed49150..91da0db5201682 100644 --- a/examples/chef/README.md +++ b/examples/chef/README.md @@ -63,7 +63,7 @@ Run `chef.py -h` to see the available commands ### zzz_generated -To eliminate a dependnecy on ZAP in CI jobs, all chef examples found in +To eliminate a dependency on ZAP in CI jobs, all chef examples found in `examples/chef/devices` must have their output from the ZAP tool cached in `examples/chef/zzz_generated`. From c6c29ac6186287dbc1d94182afcd1c18367ea9ba Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Fri, 3 Jun 2022 00:06:52 +0000 Subject: [PATCH 18/22] --generate_zzz after zap file changed in master --- examples/chef/zzz_generated/lighting-app/INPUTMD5.txt | 2 +- .../lighting-app/zap-generated/endpoint_config.h | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt b/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt index d1c4ae871e98ac..f4b1212da7a458 100644 --- a/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt +++ b/examples/chef/zzz_generated/lighting-app/INPUTMD5.txt @@ -1 +1 @@ -cf5e2008cd0ef3cd8ba066eb35012254 \ No newline at end of file +65bbdbd4db827e5f72d20fb32eaae7c0 \ No newline at end of file diff --git a/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h index d19927ef456eb1..8b813e7a4bfc6a 100644 --- a/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h +++ b/examples/chef/zzz_generated/lighting-app/zap-generated/endpoint_config.h @@ -1116,10 +1116,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, // Array of device types #define FIXED_DEVICE_TYPES \ { \ - { 0x0016, 1 }, \ - { \ - 0x0101, 1 \ - } \ + { 0x0016, 1 }, { 0x0101, 1 } \ } // Array of device type offsets From ec4d26757857dadea581b7317fac73694cadf075 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Fri, 3 Jun 2022 11:05:15 +0000 Subject: [PATCH 19/22] propagate nrf error, fix esp32 --- examples/chef/chef.py | 2 +- examples/chef/stateful_shell.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index d36ce27178d703..3a59c15a65bee2 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -537,7 +537,7 @@ def main(argv: Sequence[str]) -> None: if options.build_target == "esp32": shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/esp32") if options.do_clean: - shell.run_cmd(f"rm {_CHEF_SCRIPT_PATH}/esp32/sdkconfig") + shell.run_cmd(f"rm -f {_CHEF_SCRIPT_PATH}/esp32/sdkconfig") shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/esp32") shell.run_cmd(f"rm -rf {_CHEF_SCRIPT_PATH}/esp32/build") shell.run_cmd("idf.py fullclean") diff --git a/examples/chef/stateful_shell.py b/examples/chef/stateful_shell.py index 54faed206b7e80..0775933aabda93 100644 --- a/examples/chef/stateful_shell.py +++ b/examples/chef/stateful_shell.py @@ -61,7 +61,7 @@ def print_env(self) -> None: def run_cmd( self, cmd: str, *, - raise_on_returncode=True, + raise_on_returncode=False, return_cmd_output=False, ) -> Optional[str]: """Runs a command and updates environment. @@ -92,8 +92,8 @@ def run_cmd( redirect = "" command_with_state = ( - f"OLDPWD={self.env.get('OLDPWD', '')}; {cmd} {redirect};" - f" env -0 > {self.envfile_path}") + f"OLDPWD={self.env.get('OLDPWD', '')}; {cmd} {redirect}; RETCODE=$?;" + f" env -0 > {self.envfile_path}; exit $RETCODE") with subprocess.Popen( [command_with_state], env=self.env, cwd=self.cwd, @@ -114,7 +114,9 @@ def run_cmd( if raise_on_returncode and returncode != 0: raise RuntimeError( - f"Error. Return code is not 0. It is: {returncode}") + "Error. Nonzero return code." + f"\nReturncode: {returncode}" + f"\nCmd: {cmd}") if return_cmd_output: with open(self.cmd_output_path, encoding="latin1") as f: From 9e6f4e1e588b0d08e3db3fa63c746ee631ba9d9d Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Fri, 3 Jun 2022 11:27:25 +0000 Subject: [PATCH 20/22] Fix overwrite --- examples/chef/stateful_shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/stateful_shell.py b/examples/chef/stateful_shell.py index 0775933aabda93..066fa0b63852f1 100644 --- a/examples/chef/stateful_shell.py +++ b/examples/chef/stateful_shell.py @@ -61,7 +61,7 @@ def print_env(self) -> None: def run_cmd( self, cmd: str, *, - raise_on_returncode=False, + raise_on_returncode=True, return_cmd_output=False, ) -> Optional[str]: """Runs a command and updates environment. From 3869228a59a750fbfe201d99ac5930c9e1395c25 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Sat, 4 Jun 2022 21:04:48 +0000 Subject: [PATCH 21/22] Fix dedents --- examples/chef/chef.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 3a59c15a65bee2..8b0e56a6145ba4 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -270,7 +270,7 @@ def main(argv: Sequence[str]) -> None: if options.validate_zzz: flush_print(f"Validating\n{_CHEF_ZZZ_ROOT}\n", with_border=True) - fix_instructions = textwrap.dedent(f""" \ + fix_instructions = textwrap.dedent("""\ Cached files out of date! Please: ./scripts/bootstrap.sh @@ -316,11 +316,12 @@ def main(argv: Sequence[str]) -> None: if options.do_bootstrap_zap: if sys.platform == "linux" or sys.platform == "linux2": flush_print("Installing ZAP OS package dependencies") - shell.run_cmd( - textwrap.dedent(""" \ - sudo apt-get install sudo apt-get install node node-yargs npm \ - libpixman-1-dev libcairo2-dev libpango1.0-dev node-pre-gyp \ - libjpeg9-dev libgif-dev node-typescript \"""")) + install_deps_cmd = textwrap.dedent("""\ + sudo apt-get install node node-yargs npm + libpixman-1-dev libcairo2-dev libpango1.0-dev node-pre-gyp + libjpeg9-dev libgif-dev node-typescript""") + install_deps_cmd = install_deps_cmd.replace("\n", " ") + shell.run_cmd(install_deps_cmd) if sys.platform == "darwin": flush_print("Installation of ZAP OS packages not supported on MacOS") if sys.platform == "win32": @@ -495,7 +496,7 @@ def main(argv: Sequence[str]) -> None: options.sample_device_type_name, "zap-generated") if not os.path.exists(zzz_dir): - flush_print(textwrap.dedent(f""" + flush_print(textwrap.dedent(f"""\ You have specified --use_zzz for device {options.sample_device_type_name} which does not exist in the cached ZAP output. From fbcc33089354a3c0289e384cc9f017bc9d721792 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Sat, 4 Jun 2022 21:08:44 +0000 Subject: [PATCH 22/22] generate_zzz and update workflow image version --- .github/workflows/chef.yaml | 8 ++++---- examples/chef/zzz_generated/lighting-app/ZAPSHA.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index 9e34ecd94a8556..7f856d8e9f085c 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.5.73 + image: connectedhomeip/chip-build:0.5.77 options: --user root steps: - uses: Wandalen/wretry.action@v1.0.15 @@ -53,7 +53,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.5.73 + image: connectedhomeip/chip-build:0.5.77 options: --user root steps: @@ -77,7 +77,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32:0.5.73 + image: connectedhomeip/chip-build-esp32:0.5.77 options: --user root steps: @@ -101,7 +101,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-nrf-platform:0.5.73 + image: connectedhomeip/chip-build-nrf-platform:0.5.77 options: --user root steps: diff --git a/examples/chef/zzz_generated/lighting-app/ZAPSHA.txt b/examples/chef/zzz_generated/lighting-app/ZAPSHA.txt index 02a77022fa0d56..37e00b022574e7 100644 --- a/examples/chef/zzz_generated/lighting-app/ZAPSHA.txt +++ b/examples/chef/zzz_generated/lighting-app/ZAPSHA.txt @@ -1 +1 @@ -6594a9257ce96ee6d852eed052939849b31259fc \ No newline at end of file +ca9cbecbc36228db65349864a77402075c39d9d2 \ No newline at end of file