From b06fc4288bb3586de4677d8c7287be56d2785646 Mon Sep 17 00:00:00 2001 From: Anders Esbensen Date: Tue, 13 Sep 2022 13:00:42 +0000 Subject: [PATCH] Pull request #63: UIC-2321: Moving the Unify Matter Bridge to matter repo. Merge in WMN_TOOLS/matter from feature/unify_matter_bridge to silabs Squashed commit of the following: commit daf32d2989c04e17911cd1a7379a887210e82ae8 Author: Anders Esbensen Date: Tue Sep 13 13:29:45 2022 +0200 Applied new formating. commit 7d9e0b2f4ebed9919ae36776ab2536f8d11406ec Author: Anders Esbensen Date: Tue Sep 13 12:27:05 2022 +0200 Added stograge persistance. commit 354849c5861f15b70241abd2ca91f3d9db449e81 Author: Anders Esbensen Date: Mon Sep 12 11:06:49 2022 +0200 Only build efr32 examples in CI for now. commit 6b72a5ac9c011cb0570e578e74e92ac7db76c883 Author: Anders Esbensen Date: Thu Sep 8 12:09:55 2022 +0200 UIC-2321: Use pkg_config instead. commit 28afe77a4b9525909f12b5b04b36e86302dbb31c Author: Anders Esbensen Date: Fri Sep 2 09:47:11 2022 +0200 UIC-2321: Moving the Unify Matter Bridge to matter repo. --- examples/platform/linux/NamedPipeCommands.h | 2 + .../unify-matter-bridge/docker/Dockerfile | 33 + silabs_examples/unify-matter-bridge/linux/.gn | 25 + .../unify-matter-bridge/linux/BUILD.gn | 53 + .../unify-matter-bridge/linux/args.gni | 38 + .../linux/build_overrides/build.gni | 18 + .../linux/build_overrides/chip.gni | 18 + .../linux/build_overrides/nlassert.gni | 18 + .../build_overrides/nlfaultinjection.gni | 19 + .../linux/build_overrides/nlio.gni | 18 + .../linux/build_overrides/nlunit_test.gni | 18 + .../linux/build_overrides/openthread.gni | 17 + .../linux/build_overrides/ot_br_posix.gni | 17 + .../linux/build_overrides/pigweed.gni | 20 + .../build_overrides/pigweed_environment.gni | 12 + .../linux/include/attribute_state_cache.hpp | 81 + .../include/matter_cluster_translator.hpp | 72 + .../linux/include/matter_data_storage.hpp | 75 + .../include/matter_device_translator.hpp | 106 + .../include/matter_node_state_monitor.hpp | 205 + .../linux/src/attribute_state_cache.cpp | 19 + .../attribute_translator_interface.hpp | 178 + ...device_basic_info_attribute_translator.cpp | 420 ++ ...device_basic_info_attribute_translator.hpp | 61 + .../command_translator_interface.hpp | 113 + .../src/cluster_translator/genResult.json | 419 ++ .../group_command_translator.cpp | 88 + .../group_command_translator.hpp | 38 + .../cluster_translator/group_translator.cpp | 79 + .../cluster_translator/group_translator.hpp | 121 + .../identify_attribute_translator.cpp | 120 + .../identify_attribute_translator.hpp | 55 + .../identify_command_translator.cpp | 116 + .../identify_command_translator.hpp | 46 + .../level_attribute_translator.cpp | 482 ++ .../level_attribute_translator.hpp | 64 + .../level_command_translator.cpp | 300 + .../level_command_translator.hpp | 47 + .../on_off_attribute_translator.cpp | 262 + .../on_off_attribute_translator.hpp | 53 + .../on_off_command_translator.cpp | 56 + .../on_off_command_translator.h | 38 + .../linux/src/demo_uic_cli.cpp | 52 + .../linux/src/demo_uic_cli.h | 43 + .../matter_device_mapper.inc | 358 + .../matter_device_translator.cpp | 179 + .../matter_device_types_clusters_list.inc | 61 + ...ter_device_types_clusters_list_updated.inc | 62 + .../unify-matter-bridge/linux/src/dummy.cpp | 21 + .../unify-matter-bridge/linux/src/matter.h | 58 + .../linux/src/matter_bridge_config.c | 79 + .../linux/src/matter_bridge_config.h | 65 + .../linux/src/matter_bridge_config_fixt.h | 48 + .../linux/src/matter_bridge_main.cpp | 155 + .../linux/src/matter_data_storage.cpp | 109 + .../context_builder.hpp | 136 + .../matter_cluster_interactor.cpp | 156 + .../matter_cluster_interactor.hpp | 46 + .../matter_context.hpp | 80 + .../matter_endpoint_builder.cpp | 79 + .../matter_endpoint_builder.hpp | 79 + .../matter_node_state_monitor.cpp | 207 + .../linux/third_party/connectedhomeip | 1 + .../linux/zap/addon-helper copy.js | 113 + .../linux/zap/addon-helper.js | 172 + .../linux/zap/gen-templates.json | 16 + .../linux/zap/matter_device_mapper.inc.zapt | 112 + .../unify-matter-bridge/readme_building.md | 67 + .../unify-matter-bridge/readme_user.md | 184 + .../unify-matter-bridge/release_notes.md | 20 + .../unify-matter-bridge/run_zap.sh | 5 + .../unify-matter-bridge-common/BUILD.gn | 25 + .../include/CHIPProjectAppConfig.h | 34 + .../unify-matter-bridge.matter | 1442 ++++ .../unify-matter-bridge.zap | 5777 +++++++++++++++++ .../zap-generated/CHIPClientCallbacks.h | 41 + .../zap-generated/CHIPClusters.h | 52 + .../zap-generated/IMClusterCommandHandler.cpp | 842 +++ .../PluginApplicationCallbacks.h | 50 + .../zap-generated/access.h | 272 + .../zap-generated/af-gen-event.h | 0 .../zap-generated/callback-stub.cpp | 319 + .../zap-generated/endpoint_config.h | 906 +++ .../zap-generated/gen_config.h | 198 + .../zap-generated/gen_tokens.h | 45 + 85 files changed, 16806 insertions(+) create mode 100644 silabs_examples/unify-matter-bridge/docker/Dockerfile create mode 100644 silabs_examples/unify-matter-bridge/linux/.gn create mode 100644 silabs_examples/unify-matter-bridge/linux/BUILD.gn create mode 100644 silabs_examples/unify-matter-bridge/linux/args.gni create mode 100644 silabs_examples/unify-matter-bridge/linux/build_overrides/build.gni create mode 100644 silabs_examples/unify-matter-bridge/linux/build_overrides/chip.gni create mode 100644 silabs_examples/unify-matter-bridge/linux/build_overrides/nlassert.gni create mode 100644 silabs_examples/unify-matter-bridge/linux/build_overrides/nlfaultinjection.gni create mode 100644 silabs_examples/unify-matter-bridge/linux/build_overrides/nlio.gni create mode 100644 silabs_examples/unify-matter-bridge/linux/build_overrides/nlunit_test.gni create mode 100644 silabs_examples/unify-matter-bridge/linux/build_overrides/openthread.gni create mode 100644 silabs_examples/unify-matter-bridge/linux/build_overrides/ot_br_posix.gni create mode 100644 silabs_examples/unify-matter-bridge/linux/build_overrides/pigweed.gni create mode 100644 silabs_examples/unify-matter-bridge/linux/build_overrides/pigweed_environment.gni create mode 100644 silabs_examples/unify-matter-bridge/linux/include/attribute_state_cache.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/include/matter_cluster_translator.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/include/matter_data_storage.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/include/matter_device_translator.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/include/matter_node_state_monitor.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/attribute_state_cache.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/attribute_translator_interface.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/bridged_device_basic_info_attribute_translator.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/bridged_device_basic_info_attribute_translator.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/command_translator_interface.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/genResult.json create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_command_translator.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_command_translator.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_translator.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_translator.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_attribute_translator.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_attribute_translator.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_command_translator.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_command_translator.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_attribute_translator.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_attribute_translator.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_command_translator.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_command_translator.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_command_translator.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_command_translator.h create mode 100644 silabs_examples/unify-matter-bridge/linux/src/demo_uic_cli.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/demo_uic_cli.h create mode 100644 silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_mapper.inc create mode 100644 silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_translator.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_types_clusters_list.inc create mode 100644 silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_types_clusters_list_updated.inc create mode 100644 silabs_examples/unify-matter-bridge/linux/src/dummy.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter.h create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config.c create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config.h create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config_fixt.h create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_bridge_main.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_data_storage.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/context_builder.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_cluster_interactor.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_cluster_interactor.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_context.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_endpoint_builder.cpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_endpoint_builder.hpp create mode 100644 silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_node_state_monitor.cpp create mode 120000 silabs_examples/unify-matter-bridge/linux/third_party/connectedhomeip create mode 100644 silabs_examples/unify-matter-bridge/linux/zap/addon-helper copy.js create mode 100644 silabs_examples/unify-matter-bridge/linux/zap/addon-helper.js create mode 100644 silabs_examples/unify-matter-bridge/linux/zap/gen-templates.json create mode 100644 silabs_examples/unify-matter-bridge/linux/zap/matter_device_mapper.inc.zapt create mode 100644 silabs_examples/unify-matter-bridge/readme_building.md create mode 100644 silabs_examples/unify-matter-bridge/readme_user.md create mode 100644 silabs_examples/unify-matter-bridge/release_notes.md create mode 100755 silabs_examples/unify-matter-bridge/run_zap.sh create mode 100644 silabs_examples/unify-matter-bridge/unify-matter-bridge-common/BUILD.gn create mode 100644 silabs_examples/unify-matter-bridge/unify-matter-bridge-common/include/CHIPProjectAppConfig.h create mode 100644 silabs_examples/unify-matter-bridge/unify-matter-bridge-common/unify-matter-bridge.matter create mode 100644 silabs_examples/unify-matter-bridge/unify-matter-bridge-common/unify-matter-bridge.zap create mode 100644 zzz_generated/unify-matter-bridge/zap-generated/CHIPClientCallbacks.h create mode 100644 zzz_generated/unify-matter-bridge/zap-generated/CHIPClusters.h create mode 100644 zzz_generated/unify-matter-bridge/zap-generated/IMClusterCommandHandler.cpp create mode 100644 zzz_generated/unify-matter-bridge/zap-generated/PluginApplicationCallbacks.h create mode 100644 zzz_generated/unify-matter-bridge/zap-generated/access.h create mode 100644 zzz_generated/unify-matter-bridge/zap-generated/af-gen-event.h create mode 100644 zzz_generated/unify-matter-bridge/zap-generated/callback-stub.cpp create mode 100644 zzz_generated/unify-matter-bridge/zap-generated/endpoint_config.h create mode 100644 zzz_generated/unify-matter-bridge/zap-generated/gen_config.h create mode 100644 zzz_generated/unify-matter-bridge/zap-generated/gen_tokens.h diff --git a/examples/platform/linux/NamedPipeCommands.h b/examples/platform/linux/NamedPipeCommands.h index ceacec36ca5593..9dfffa17912fda 100644 --- a/examples/platform/linux/NamedPipeCommands.h +++ b/examples/platform/linux/NamedPipeCommands.h @@ -21,6 +21,8 @@ #include #include #include +#include +#include class NamedPipeCommandDelegate { diff --git a/silabs_examples/unify-matter-bridge/docker/Dockerfile b/silabs_examples/unify-matter-bridge/docker/Dockerfile new file mode 100644 index 00000000000000..ad6c3cdb9599a0 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/docker/Dockerfile @@ -0,0 +1,33 @@ +ARG VERSION=latest +FROM connectedhomeip/chip-build:${VERSION} + +# Rust Version to install +ENV RUST_VERSION=1.60.0 +# Rust and Cargo home directories +ENV RUSTUP_HOME=/opt/rustup-home +ENV CARGO_HOME=/opt/cargo-home +# Install Rust and Cargo +RUN curl https://sh.rustup.rs -sSf --output /tmp/sh.rustup.rs \ + && cd /tmp && chmod +x sh.rustup.rs \ + && ./sh.rustup.rs -y --profile minimal --default-toolchain ${RUST_VERSION}\ + && rm /tmp/sh.rustup.rs \ + && /opt/cargo-home/bin/cargo install cargo2junit \ + # remove the main branch reference once the maintainer tagged 81d73b4 + && /opt/cargo-home/bin/cargo install cargo-deb --git https://github.com/kornelski/cargo-deb.git --branch main \ + && chmod -R a+rw ${RUSTUP_HOME} ${CARGO_HOME} \ + && find ${RUSTUP_HOME} ${CARGO_HOME} -type d -exec chmod a+x {} \; +ENV PATH="${CARGO_HOME}/bin:${PATH}" + +#Target dependencies +RUN apt update && \ + apt install -y \ + libsqlite3-dev libedit-dev libyaml-cpp0.6 libmosquitto-dev\ + libyaml-cpp-dev \ + libboost-atomic-dev libboost-chrono-dev libboost-date-time-dev \ + libboost-filesystem-dev libboost-regex-dev libboost-program-options-dev \ + libboost-serialization-dev libboost-system-dev libboost-thread-dev \ + libboost-log-dev nlohmann-json3-dev + +#Build host dependencies +RUN ln -s /usr/bin/python3 /usr/bin/python +RUN apt install -y ruby ruby-dev diff --git a/silabs_examples/unify-matter-bridge/linux/.gn b/silabs_examples/unify-matter-bridge/linux/.gn new file mode 100644 index 00000000000000..70728706ea4a14 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/.gn @@ -0,0 +1,25 @@ +# 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. + +import("//build_overrides/build.gni") + +# The location of the build configuration file. +buildconfig = "${build_root}/config/BUILDCONFIG.gn" + +# CHIP uses angle bracket includes. +check_system_includes = true + +default_args = { + import("//args.gni") +} diff --git a/silabs_examples/unify-matter-bridge/linux/BUILD.gn b/silabs_examples/unify-matter-bridge/linux/BUILD.gn new file mode 100644 index 00000000000000..b4b7f6e2c82cf9 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/BUILD.gn @@ -0,0 +1,53 @@ +import("//build_overrides/chip.gni") +import("${chip_root}/build/chip/tools.gni") +import("${chip_root}/build/config/linux/pkg_config.gni") + +assert(chip_build_tools) + +pkg_config("unify") { + packages = [ "libunify" ] +} + +executable("unify-matter-bridge") { + include_dirs = [ + "src", + "src/cluster_translator", + "src/device_type_mapper", + "src/matter_node_state_monitor", + "include", + ] + + sources = [ + "src/matter_data_storage.cpp", + "src/attribute_state_cache.cpp", + "src/cluster_translator/bridged_device_basic_info_attribute_translator.cpp", + "src/cluster_translator/group_command_translator.cpp", + "src/cluster_translator/group_translator.cpp", + "src/cluster_translator/identify_attribute_translator.cpp", + "src/cluster_translator/identify_command_translator.cpp", + + #"src/cluster_translator/level_attribute_translator.cpp", + #"src/cluster_translator/level_command_translator.cpp", + "src/cluster_translator/on_off_attribute_translator.cpp", + "src/cluster_translator/on_off_command_translator.cpp", + "src/demo_uic_cli.cpp", + "src/device_type_mapper/matter_device_translator.cpp", + "src/device_type_mapper/matter_device_types_clusters_list_updated.inc", + "src/dummy.cpp", + "src/matter_bridge_config.c", + "src/matter_bridge_main.cpp", + "src/matter_node_state_monitor/matter_cluster_interactor.cpp", + "src/matter_node_state_monitor/matter_endpoint_builder.cpp", + "src/matter_node_state_monitor/matter_node_state_monitor.cpp", + ] + + deps = [ + "${chip_root}/examples/platform/linux:app-main", + "//../unify-matter-bridge-common", + ] + configs += [ ":unify" ] +} + +group("linux") { + deps = [ ":unify-matter-bridge" ] +} diff --git a/silabs_examples/unify-matter-bridge/linux/args.gni b/silabs_examples/unify-matter-bridge/linux/args.gni new file mode 100644 index 00000000000000..df05cd7f1c6c62 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/args.gni @@ -0,0 +1,38 @@ +# Copyright (c) 2020 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("//build_overrides/chip.gni") + +import("${chip_root}/config/standalone/args.gni") + +chip_device_project_config_include = "" +chip_project_config_include = "" +chip_system_project_config_include = "" + +chip_project_config_include_dirs = + [ "${chip_root}/examples/tv-app/tv-common/include" ] +chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] + +chip_build_libshell = true + +chip_enable_additional_data_advertising = true + +chip_enable_rotating_device_id = true + +cpp_standard = "c++17" + +enable_pic = false + +default_configs_exceptions = + [ "//third_party/connectedhomeip/build/config/compiler:exceptions" ] diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/build.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/build.gni new file mode 100644 index 00000000000000..323b150ed3399a --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/build.gni @@ -0,0 +1,18 @@ +# 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. + +declare_args() { + # Root directory for build files. + build_root = "//third_party/connectedhomeip/build" +} diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/chip.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/chip.gni new file mode 100644 index 00000000000000..23aafc1df7b3cd --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/chip.gni @@ -0,0 +1,18 @@ +# Copyright (c) 2020 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. + +declare_args() { + # Root directory for CHIP. + chip_root = "//third_party/connectedhomeip" +} diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/nlassert.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlassert.gni new file mode 100644 index 00000000000000..30e8c701634664 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlassert.gni @@ -0,0 +1,18 @@ +# Copyright (c) 2020 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. + +declare_args() { + # Root directory for nlassert. + nlassert_root = "//third_party/connectedhomeip/third_party/nlassert" +} diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/nlfaultinjection.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlfaultinjection.gni new file mode 100644 index 00000000000000..155d765597d110 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlfaultinjection.gni @@ -0,0 +1,19 @@ +# Copyright (c) 2020 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. + +declare_args() { + # Root directory for nlfaultinjection. + nlfaultinjection_root = + "//third_party/connectedhomeip/third_party/nlfaultinjection" +} diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/nlio.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlio.gni new file mode 100644 index 00000000000000..f7d5ee6117e826 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlio.gni @@ -0,0 +1,18 @@ +# Copyright (c) 2020 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. + +declare_args() { + # Root directory for nlio. + nlio_root = "//third_party/connectedhomeip/third_party/nlio" +} diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/nlunit_test.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlunit_test.gni new file mode 100644 index 00000000000000..ed017adc65f04a --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlunit_test.gni @@ -0,0 +1,18 @@ +# Copyright (c) 2020 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. + +declare_args() { + # Root directory for nlunit-test. + nlunit_test_root = "//third_party/connectedhomeip/third_party/nlunit-test" +} diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/openthread.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/openthread.gni new file mode 100644 index 00000000000000..10edfdf202e885 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/openthread.gni @@ -0,0 +1,17 @@ +# Copyright (c) 2020 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. + +declare_args() { + openthread_root = "//third_party/openthread/repo" +} diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/ot_br_posix.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/ot_br_posix.gni new file mode 100644 index 00000000000000..2ed583ff245c14 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/ot_br_posix.gni @@ -0,0 +1,17 @@ +# Copyright (c) 2020 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. + +declare_args() { + ot_br_posix_root = "//third_party/ot-br-posix" +} diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/pigweed.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/pigweed.gni new file mode 100644 index 00000000000000..0aaf7c4d226844 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/pigweed.gni @@ -0,0 +1,20 @@ +# Copyright (c) 2020 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. + +declare_args() { + # Location of the Pigweed repository. + dir_pigweed = "//third_party/connectedhomeip/third_party/pigweed/repo" +} + +import("$dir_pigweed/modules.gni") diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/pigweed_environment.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/pigweed_environment.gni new file mode 100644 index 00000000000000..26ca441a30812a --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/pigweed_environment.gni @@ -0,0 +1,12 @@ +# This file is automatically generated by Pigweed's environment setup. Do not +# edit it manually or check it in. +declare_args() { + pw_env_setup_CIPD_ARM = "//.environment/cipd/packages/arm" + dir_cipd_arm = "//.environment/cipd/packages/arm" + pw_env_setup_CIPD_PIGWEED = "//.environment/cipd/packages/pigweed" + dir_cipd_pigweed = "//.environment/cipd/packages/pigweed" + pw_env_setup_CIPD_PYTHON = "//.environment/cipd/packages/python" + dir_cipd_python = "//.environment/cipd/packages/python" + pw_env_setup_VIRTUAL_ENV = "//.environment/pigweed-venv" + pw_env_setup_PACKAGE_ROOT = "//.environment/packages" +} diff --git a/silabs_examples/unify-matter-bridge/linux/include/attribute_state_cache.hpp b/silabs_examples/unify-matter-bridge/linux/include/attribute_state_cache.hpp new file mode 100644 index 00000000000000..aa0b45e4af9767 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/include/attribute_state_cache.hpp @@ -0,0 +1,81 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @defgroup attribute_state_cache + * @brief The module cache the attribute states in a memory and provides + * the state when a user of the API request the attribute state using + * ConcreteAttributePath. + * + * @{ + */ + +#ifndef ATTRIBUTE_STATE_CASH_H +#define ATTRIBUTE_STATE_CASH_H + +#include +#include +#include +#include +#include + +#include "matter.h" +#include + +using value_t + = std::variant; +using AttrPath_t = chip::app::ConcreteAttributePath; + +class attribute_state_cache +{ + public: + attribute_state_cache() {}; + ~attribute_state_cache() {}; + + // Get the attribute_state_cache class instance + static attribute_state_cache &get_instance(); + + /** + * @brief load the attribute state to a memory + * + * @param attributePath A representation of a concrete attribute path. + * @param data The attribute state value. + */ + template void set(const AttrPath_t &attributePath, const T &data) + { + attribute_state_container[attributePath] = data; + } + + /** + * @brief Get the attribute state from a memory + * + * @param attributePath A representation of a concrete attribute path + */ + template const T &get(const AttrPath_t &attributePath) const + { + auto iter = attribute_state_container.find(attributePath); + if (iter != attribute_state_container.end()) { + return std::get(iter->second); + } else { + throw std::out_of_range( + "The attribute path is not in attribute_state_container container"); + } + } + + private: + // Attribute State Container + std::map attribute_state_container; +}; + +#endif //ATTRIBUTE_STATE_CASH_H +/** @} end attribute_state_cache */ diff --git a/silabs_examples/unify-matter-bridge/linux/include/matter_cluster_translator.hpp b/silabs_examples/unify-matter-bridge/linux/include/matter_cluster_translator.hpp new file mode 100644 index 00000000000000..f9cb7dddb1ebd1 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/include/matter_cluster_translator.hpp @@ -0,0 +1,72 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @defgroup matter_cluster_translator + * @brief TODO: Write brief for matter_cluster_translator + * + * TODO: Write component description for matter_cluster_translator + * + * @{ + */ + +#ifndef MATTER_CLUSTER_TRANSLATOR_HPP +#define MATTER_CLUSTER_TRANSLATOR_HPP + +#include +#include + + +namespace unify::matter_bridge +{ + /** + * The purpose of the cluster translator is to handle read/write attribute + * calls as well as matter commands. Since the matter data model and the UIC + * data model are very similar we will generally be able to do a 1-1 + * translation. + * + * The translator has a ZAP generated handler, which implements a generic + * handler for all clusters which is able to send translate Matter commands + * into mqtt messages. The translator uses + * `InteractionModelEngine::RegisterCommandHandler` to register itself with + * the matter application framework. As the default behavior the translator + * will directly translate the matter command into a unify mqtt command. + * + * The translator will also handle attribute read and attribute writes. For + * attributes the translator uses the system + * `registerAttributeAccessOverride, when an attribute read is requested the + * Unify Reported value should be reported when an attribute write is + * requested the corresponding /WriteAttribute command is published on the + * mqtt side. + * + * The Unify Cluster translator is not required to check the capabilities of + * a node before sending WriteAttributes or other commands. + * + */ + class matter_cluster_translator { + + /** + * @brief Register access an interface to a cluster + * + * Register a cluster translator. + * + * @param command_handler + * @param attribute_access + * @return true on success + */ + bool register_cluster(chip::ClusterId, const CommandHandlerInterface& command_handler, const AttributeAccessInterface& attribute_access); + } + +} +#endif //MATTER_CLUSTER_TRANSLATOR_HPP +/** @} end matter_cluster_translator */ diff --git a/silabs_examples/unify-matter-bridge/linux/include/matter_data_storage.hpp b/silabs_examples/unify-matter-bridge/linux/include/matter_data_storage.hpp new file mode 100644 index 00000000000000..4054f9ac4c80c3 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/include/matter_data_storage.hpp @@ -0,0 +1,75 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @defgroup matter_data_storage + * @brief the module persist the dynamic endpoint mapping + * from unify unid and endpoint. + * + * @{ + */ + +#ifndef MATTER_DATA_STORAGE_HPP +#define MATTER_DATA_STORAGE_HPP + +#include +#include "matter.h" +#include + +namespace unify::matter_bridge +{ +class matter_data_storage +{ + public: + struct endpoint_mapping { + const char *unify_unid; + uint8_t unify_endpoint; + std::optional matter_endpoint; + }; + struct group_mapping { + uint16_t matter_group_id; + std::optional unify_group_id; + }; + /** + * @brief Persist data + * + * @param key_value a struct that contain the key and value, + * that should be persisted to the data storage + * @return true if the data is persisted + * @return false if the data is not persisted + */ + template bool persist_data(T &key_value); + + /** + * @brief Get the persisted dynamic endpoint + * + * @param key_value a struct that contain the key and value + * that the persisted dat copy over + * @return true if value is written on the value field of + * the key_value struct + * @return false if the key is not found in the data storage + */ + template bool get_persisted_data(T &key_value); + /** + * @brief remove the persisted data + * + * @param key key + */ + template void remove_persisted_data(T &key); + + static matter_data_storage &instance(); +}; + +} // namespace unify::matter_bridge +#endif //MATTER_DATA_STORAGE_HPP + /** @} end matter_data_storage */ diff --git a/silabs_examples/unify-matter-bridge/linux/include/matter_device_translator.hpp b/silabs_examples/unify-matter-bridge/linux/include/matter_device_translator.hpp new file mode 100644 index 00000000000000..5b9b49c59ba214 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/include/matter_device_translator.hpp @@ -0,0 +1,106 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @defgroup matter_device_mapper + * @brief Unify matter device mapper + * + * The purpose of the device mapper is to translate unify terms into matter terms. + * The device mapper is capable of doing the following: + * - Given a list of unify cluster names find the best matching device type + * - Given a unify cluster name return the matter cluster id + * - Given a unify attribute name return the matter attribute id + * - Given a unify Command name return the matter command id + * + * @{ + */ + +#ifndef MATTER_DEVICE_TRANSLATOR_HPP +#define MATTER_DEVICE_TRANSLATOR_HPP + +#include +#include +#include +#include + +namespace unify::matter_bridge +{ +/** + * @brief Device translator class. + */ +class device_translator +{ + public: + /** + * @brief Given list of clustername find possible matching device types. + * + * @param clusters Vector of clusters to find device type for. + * @return vector of possible device types sorted by most likely, or an empty + * vector if none is found. + */ + virtual std::vector + get_device_types(const std::vector &clusters) const; + + /** + * @brief It provides the matter device name from device id. + * + * @param device_id the device id. + * @return std::optional containing the device name or std::nullopt_t. + */ + virtual std::optional + get_device_name(chip::DeviceTypeId device_id) const; + + /** + * @brief Get the cluster id given a unify cluster name. + * + * @param cluster_name + * @return std::optional containing the cluster id or std::nullopt_t. + */ + virtual std::optional + get_cluster_id(const std::string &cluster_name) const; + + /** + * @brief Get the attribute id given a unify cluster name and attribute name. + * + * @param cluster_name + * @param attribute_name + * @return std::optional containg the attribute id or std::nullopt_t. + */ + + virtual std::optional + get_attribute_id(const std::string &cluster_name, + const std::string &attribute_name) const; + + /** + * @brief Get the command id given a unify cluster name and command name. + * + * @param cluster_name + * @param attribute_name + * @return std::optional containing the command id or std::nullopt_t. + */ + + virtual std::optional + get_command_id(const std::string &cluster_name, + const std::string &command_name) const; + + virtual ~device_translator() = default; + + static const device_translator& instance() { + static device_translator me; + return me; + } +}; +} // namespace unify::matter_bridge + +#endif //MATTER_DEVICE_TRANSLATOR_HPP +/** @} end matter_device_mapper */ diff --git a/silabs_examples/unify-matter-bridge/linux/include/matter_node_state_monitor.hpp b/silabs_examples/unify-matter-bridge/linux/include/matter_node_state_monitor.hpp new file mode 100644 index 00000000000000..07fcf6a08efdfa --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/include/matter_node_state_monitor.hpp @@ -0,0 +1,205 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +#ifndef MATTER_NODE_STATE_MONITOR_HPP +#define MATTER_NODE_STATE_MONITOR_HPP + +#include +#include "unify_node_state_monitor.hpp" +#include "matter_context.hpp" +#include +#include + +namespace unify::matter_bridge +{ +class device_translator; + +/** + * @brief definition of a bridged endpoint + * + * this holds all the information needed to map the + * matter endpoints to a unify endpoint + * + */ +struct bridged_endpoint { + /// the unid of the bridged endpoint + /// + std::string unify_unid; + + /// the unify endpoint number + /// + uint8_t unify_endpoint; + + /// the endpoint id assigned on the matter bridge + /// + chip::EndpointId matter_endpoint; + + /// the index that holds the matter endpoint in + /// memory + uint16_t index; + + /// Matter Device type of the endpoint + /// + uint16_t matter_type; + + /// the ember endpoint structure, this will contain + /// the complete cluster list + matter_endpoint_context ember_endpoint; + + /// Tells if the node is reachable, ie it is possible to communicate with the + /// device it may be that the node is a non-listening device, so it could be + /// that the communication latency is very high + bool reachable; + + bridged_endpoint(matter_endpoint_context &&context) : + ember_endpoint(std::move(context)) + {} +}; + +/** + * @brief Matter node state monitor + * + * The matter nodestate monitor is responsible for using a unify_node_state_monitor + * to check when new unify nodes has been added to- or removed from- the network and + * then crating a set of bridged endpoints. + * + * As this components is the first point of contact between the Matter world + * and the unify world, the node state monitor also provides a translation between + * matter endpoints ids and the unify (unid,epid) tuple. + * + */ +class matter_node_state_monitor : + private unify::node_state_monitor::node_state_monitor_interface +{ + public: + matter_node_state_monitor(const device_translator &matter_device_translator); + + /** + * @brief Get the bridged endpoint by object from unify addresses + * + * @param unid + * @param epid + * @return const bridged_endpoint& + */ + const struct bridged_endpoint *bridged_endpoint(const std::string &unid, + int epid) const; + /** + * @brief Get the unify endpoint address from a matter endpoint id + * + * @return std::pair + */ + const struct bridged_endpoint * + bridged_endpoint(chip::EndpointId endpoint) const; + + enum update_t { + NODE_ADDED, //<<< A node has been added (or just found) + NODE_DELETED, ///<<< A node has been deleted + NODE_STATE_CHANGED /// A node has changed its reachable state + }; + + /** + * @brief Callback function for event notifications + * + */ + using event_listener_t + = std::function; + + /** + * @brief Register an event listener with the node state monitor + * + * An event listener may be registered with the node state monitor allowing a user + * to get notified when certain events occur. + * + * @param event_listener Callback function to be called + */ + void register_event_listener(const event_listener_t &event_listener); + + private: + /** + * @brief called when a unify device is added + * + * When a device is added a number of matter endpoints are created. All + * newly added endpints will get a matter endpoint id assigned. + * + * Then add endpints are created their existence is published on the matter + * fabric. Using the function emberAfSetDynamicEndpoint + * + * @param node + */ + void on_unify_node_added(const unify::node_state_monitor::node &node); + + /** + * @brief Called when a Unify node is deleted. + * + * This will remove all endpoints belonging to a unid from mapped endpoint + * list. The removal of the endpoint is announced on the matter fabric + * Using emberAfClearDynamicEndpoint + * + * @param unid + */ + void on_unify_node_removed(const std::string &unid); + + /** + * @brief Called when a unify node changes state. + * + * When this function is called all endpoints belonging to a Unify node + * changes its state The updated state must be published on the matter + * fabric + * + * @param unid + * @param state + */ + void on_unify_node_state_changed(const node_state_monitor::node &node); + + /** + * @brief Invoke all listeners + * + * Invokes all listeners for all endpoints of the node + * + * @param node + */ + void invoke_listeners(const struct bridged_endpoint &ep, + update_t update) const; + /** + * @brief construct a new bridged endpoint. + * + * this function used by the matter bridge to construct an instance of a + * bridged endpoint. this function will query the unify node state monitor + * about details regarding the endpoint. note all matter endpoints + * has a device type, this is not the case for unify endpoints. + * + * in some cases we need to look at the capabilities of endpoint 0 + * to determine the actual device type. + * + * @param node + * @return std::vector + */ + std::vector + new_bridged_endpoints(const unify::node_state_monitor::node &node); + const device_translator &matter_device_translator; + + /** @brief map containing all bridged endpoints which are currently registered + the node state monitor. If an entry is dropped from this list any associated + resources which might be in use by matter will released as well + */ + std::multimap bridged_endpoints; + + /** + * @brief Event listeners + * + */ + std::vector event_listeners; +}; +} // namespace unify::matter_bridge + +#endif //MATTER_NODE_STATE_MONITOR_HPP diff --git a/silabs_examples/unify-matter-bridge/linux/src/attribute_state_cache.cpp b/silabs_examples/unify-matter-bridge/linux/src/attribute_state_cache.cpp new file mode 100644 index 00000000000000..995676823f34f7 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/attribute_state_cache.cpp @@ -0,0 +1,19 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#include "attribute_state_cache.hpp" + +attribute_state_cache instance; +attribute_state_cache & attribute_state_cache::get_instance() +{ + return instance; +} \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/attribute_translator_interface.hpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/attribute_translator_interface.hpp new file mode 100644 index 00000000000000..548093031e3366 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/attribute_translator_interface.hpp @@ -0,0 +1,178 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +#ifndef ATTRIBUTE_TRANSLATOR_INTERFACE_HPP +#define ATTRIBUTE_TRANSLATOR_INTERFACE_HPP + +#include +#include +#include +#include +#include +#include + +#include "matter.h" +#include "uic_mqtt.h" +#include "matter_node_state_monitor.hpp" +#include "matter_device_translator.hpp" +#include "sl_log.h" + +namespace unify::matter_bridge +{ + +/** + * @brief Base class for attribute access interfaces + * + * This class performs the base functionality for all attribute access + * interfaces for in the Unify Bridge. Upon construction the class will register + * itself with chip::app framework + * + */ +class attribute_translator_interface : + public chip::app::AttributeAccessInterface +{ + public: + attribute_translator_interface(matter_node_state_monitor &node_state_monitor, + chip::ClusterId id) : + chip::app::AttributeAccessInterface( + chip::Optional::Missing(), id), + m_node_state_monitor(node_state_monitor) + { + registerAttributeAccessOverride(this); + + //Register the an event listener for subscriptions + auto f = [&](const bridged_endpoint &ep, + matter_node_state_monitor::update_t update) { + attributes_update_subscription(ep, update); + }; + node_state_monitor.register_event_listener(f); + } + + protected: + /** + * @brief List of cluster names which this translator will be using. + * + * @return std::vector + */ + virtual std::vector unify_cluster_names() const = 0; + + /** + * @brief Called when a reported attribute is updated + * + * @param ep + * @param cluster + * @param attribute + * @param value + */ + virtual void reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &value) + = 0; + matter_node_state_monitor &m_node_state_monitor; + + private: + const char *LOG_TAG = "attribute_cluster_server"; + + void on_mqtt_message_cb(const char *topic, + const char *message, + const size_t message_length) + { + std::regex rgx("ucl/by-unid" + "/([^/]*)" // UNID + "/ep([^/]*)" // Endpoint + "/([^/]*)" // Cluster + "/Attributes" + "/([^/]*)" // Attribute + "/Reported"); + std::smatch match; + std::string topic_str(topic); + if (!std::regex_search(topic_str, match, rgx)) { + return; + } + const std::string &unid = match.str(1); + const std::string &endpoint_id = match.str(2); + const std::string &cluster = match.str(3); + const std::string &attribute = match.str(4); + + auto unify_node + = m_node_state_monitor.bridged_endpoint(unid, std::stoi(endpoint_id)); + // In Matter Bridge Endpoint 0 is dedicated to the root node (bridge app) + // So unify bridged node will not be assigned endpoint 0. + if (!unify_node) { + sl_log_debug( + LOG_TAG, + "The bridged node is not assigned a matter dynamic endpoint\n"); + return; + } + + std::string msg(message, message_length); + if (!attribute.empty() && !cluster.empty() && !msg.empty()) { + try { + nlohmann::json jsn = nlohmann::json::parse(msg); + reported_updated(unify_node, cluster, attribute, jsn["value"]); + } catch (const nlohmann::json::parse_error &e) { + sl_log_info(LOG_TAG, + "It was not possible to parse incoming attribute state " + "update since the message payload is not json, %s\n", + e.what()); + } catch (const nlohmann::json::type_error &e) { + sl_log_info( + LOG_TAG, + "It was not possible to parse incoming attribute state update since " + "the value of different type or key is not present, %s\n", + e.what()); + } + } else { + sl_log_debug(LOG_TAG, "Unknown attributes [%s]", attribute.c_str()); + } + } + + void + attributes_update_subscription(const bridged_endpoint &ep, + matter_node_state_monitor::update_t update) + { + for (const auto &unify_cluster: unify_cluster_names()) { + std::string topic = "ucl/by-unid/" + ep.unify_unid + "/ep" + + std::to_string(ep.unify_endpoint) + "/" + + unify_cluster + "/Attributes/+/Reported"; + + if (update == matter_node_state_monitor::update_t::NODE_ADDED) { + uic_mqtt_subscribe_ex( + topic.c_str(), + attribute_translator_interface::on_mqtt_message_c_cb, + this); + } else if (update == matter_node_state_monitor::update_t::NODE_DELETED) { + uic_mqtt_unsubscribe_ex( + topic.c_str(), + attribute_translator_interface::on_mqtt_message_c_cb, + this); + } + } + } + + static void on_mqtt_message_c_cb(const char *topic, + const char *message, + const size_t message_length, + void *user) + { + attribute_translator_interface *instance + = static_cast(user); + if (instance) { + instance->on_mqtt_message_cb(topic, message, message_length); + } + } +}; +} // namespace unify::matter_bridge + +#endif //ATTRIBUTE_TRANSLATOR_INTERFACE_HPP diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/bridged_device_basic_info_attribute_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/bridged_device_basic_info_attribute_translator.cpp new file mode 100644 index 00000000000000..d984ff7ea08392 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/bridged_device_basic_info_attribute_translator.cpp @@ -0,0 +1,420 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#include "bridged_device_basic_info_attribute_translator.hpp" + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include "matter_device_translator.hpp" +#include "matter_node_state_monitor.hpp" +#include "uic_mqtt.h" +#include "sl_log.h" + +#define LOG_TAG "bridge_device_basic_cluster_server" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::BridgedDeviceBasic; +using namespace chip::app::Clusters::BridgedDeviceBasic::Attributes; +using namespace unify::matter_bridge; + +constexpr uint32_t ATTRIBUTE_ID_INVALID = 0xFFFFFFFF; +// Can not find a map for PartNumber, UniqueID (i.e., they are also optional attributes). +// ProductID, Location and LocalConfigDisabled attributes are not a part of +// BridgedDeviceBasic attribute namespace. +const static std::unordered_map basic_information_map { + {"ManufacturerName", Attributes::VendorName::Id}, // string, string + {"ManufacturerName", + Attributes::VendorID::Id}, // string, vendor id {can not map to one to one} + {"ModelIdentifier", Attributes::ProductName::Id}, // string, string + {"HWVersion", Attributes::HardwareVersion::Id}, // uint8_t, uint16_t + {"ModelIdentifier", Attributes::HardwareVersionString::Id}, // string, string + {"ApplicationVersion", Attributes::SoftwareVersion::Id}, // uint8_t, uint32_t + {"SWBuildID", Attributes::SoftwareVersionString::Id}, // string , string + {"DateCode", Attributes::ManufacturingDate::Id}, // string, string + {"ProductURL", Attributes::ProductURL::Id}, // string, string + {"ProductLabel", Attributes::ProductLabel::Id}, // string, string + {"SerialNumber", Attributes::SerialNumber::Id}, //string, string + {"ApplicationVersion", Attributes::UniqueID::Id}}; // uint8_t, string + +BridgedDeviceBasicInfoAttributeAccess::BridgedDeviceBasicInfoAttributeAccess( + matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::BridgedDeviceBasic::Id) + +{ + //Register the an event listener for reachable state update + node_state_monitor.register_event_listener( + BridgedDeviceBasicInfoAttributeAccess::unify_node_reachable_state_update); +} + +CHIP_ERROR BridgedDeviceBasicInfoAttributeAccess::Read( + const ConcreteReadAttributePath &aPath, AttributeValueEncoder &aEncoder) +{ + if (aPath.mClusterId != BridgedDeviceBasic::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath attr_path = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + try { + switch (aPath.mAttributeId) { + case VendorName::Id: { + std::string read_vendor_name + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode( + chip::CharSpan::fromCharString(read_vendor_name.c_str())); + } + case VendorID::Id: { + uint16_t read_vendor_id + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode(read_vendor_id); + } + case ProductName::Id: { + std::string read_product_name + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode( + chip::CharSpan::fromCharString(read_product_name.c_str())); + } + case HardwareVersion::Id: { + uint16_t read_hardware_version + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode(read_hardware_version); + } + case HardwareVersionString::Id: { + std::string read_hardware_version_string + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode( + chip::CharSpan::fromCharString(read_hardware_version_string.c_str())); + } + case SoftwareVersion::Id: { + uint32_t read_software_version + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode(read_software_version); + } + case SoftwareVersionString::Id: { + std::string read_software_version_string + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode( + chip::CharSpan::fromCharString(read_software_version_string.c_str())); + } + case ManufacturingDate::Id: { + std::string read_manufacturing_date + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode( + chip::CharSpan::fromCharString(read_manufacturing_date.c_str())); + } + case ProductURL::Id: { + std::string read_product_url + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode( + chip::CharSpan::fromCharString(read_product_url.c_str())); + } + case ProductLabel::Id: { + std::string read_product_label + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode( + chip::CharSpan::fromCharString(read_product_label.c_str())); + } + case SerialNumber::Id: { + std::string read_serial_number + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode( + chip::CharSpan::fromCharString(read_serial_number.c_str())); + } + case NodeLabel::Id: { + std::string read_node_label + = attribute_state_cache::get_instance().get(attr_path); + return aEncoder.Encode( + chip::CharSpan::fromCharString(read_node_label.c_str())); + } + case Reachable::Id: { + Reachable::TypeInfo::Type state + = attribute_state_cache::get_instance() + .get(attr_path); + return aEncoder.Encode(state); + } + } + } catch (const std::out_of_range &e) { + sl_log_info( + LOG_TAG, + "The request attribute Path is not found in the attribute state " + "container, %s\n", + e.what()); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR BridgedDeviceBasicInfoAttributeAccess::Write( + const ConcreteDataAttributePath &aPath, AttributeValueDecoder &aDecoder) +{ + if (aPath.mClusterId != BridgedDeviceBasic::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + // Note that only NodeLabel and Location attributes are the only writable attributes. + // Location attribute is not mapped since we can not find the attribute + // that matches under BridgedDeviceBasic attributes namespace. + if (aPath.mAttributeId == NodeLabel::Id) { + chip::CharSpan node_label_span; + ReturnErrorOnFailure(aDecoder.Decode(node_label_span)); + + nlohmann::json jsn; + std::string node_label + = std::string(node_label_span.begin(), node_label_span.end()); + jsn["value"] = node_label; + // Get unify node unid and endpoint from matter endpoint + auto unify_node = m_node_state_monitor.bridged_endpoint(aPath.mEndpointId); + std::string name_topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/NameAndLocation/Attributes/Name/Desired"; + std::string payload_str = jsn.dump(); + uic_mqtt_publish(name_topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_NO_ERROR; + } + return CHIP_ERROR_NO_MESSAGE_HANDLER; +} + +void BridgedDeviceBasicInfoAttributeAccess::reported_updated( + const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + chip::EndpointId matter_endpoint = ep->matter_endpoint; + ConcreteAttributePath attrpath; + + //handler basic cluster attributes + if (cluster == "Basic") { + uint32_t attribute_id = map_basic_cluster_attributes(attribute.c_str()); + if (attribute_id == ATTRIBUTE_ID_INVALID) { + return; + } + attrpath = ConcreteAttributePath(matter_endpoint, + BridgedDeviceBasic::Id, + attribute_id); + + switch (attribute_id) { + case VendorName::Id: { + std::string value = unify_value; + std::vector value_vec(value.begin(), value.end()); + attribute_state_cache::get_instance().set(attrpath, value); + MatterReportingAttributeChangeCallback(matter_endpoint, + BridgedDeviceBasic::Id, + VendorName::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + &value_vec[0]); + break; + } + case VendorID::Id: { + // We can find a direct mapping, we just set to unspecified + // considering that manufacturer name is publish on unify side + uint16_t unspecified_vendor = chip::VendorId::NotSpecified; + attribute_state_cache::get_instance().set(attrpath, + unspecified_vendor); + MatterReportingAttributeChangeCallback( + matter_endpoint, + BridgedDeviceBasic::Id, + VendorID::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(unspecified_vendor)); + break; + } + case ProductName::Id: { + std::string value = unify_value; + std::vector value_vec(value.begin(), value.end()); + attribute_state_cache::get_instance().set(attrpath, value); + MatterReportingAttributeChangeCallback(matter_endpoint, + BridgedDeviceBasic::Id, + ProductName::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + &value_vec[0]); + break; + } + case HardwareVersion::Id: { + uint16_t value = unify_value; + attribute_state_cache::get_instance().set(attrpath, value); + MatterReportingAttributeChangeCallback( + matter_endpoint, + BridgedDeviceBasic::Id, + HardwareVersion::Id, + + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(value)); + break; + } + case HardwareVersionString::Id: { + std::string value = unify_value; + std::vector value_vec(value.begin(), value.end()); + attribute_state_cache::get_instance().set(attrpath, value); + MatterReportingAttributeChangeCallback(matter_endpoint, + BridgedDeviceBasic::Id, + HardwareVersionString::Id, + + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + &value_vec[0]); + break; + } + case SoftwareVersion::Id: { + uint32_t value = unify_value; + attribute_state_cache::get_instance().set(attrpath, value); + MatterReportingAttributeChangeCallback( + matter_endpoint, + BridgedDeviceBasic::Id, + SoftwareVersion::Id, + + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(value)); + break; + } + case SoftwareVersionString::Id: { + std::string value = unify_value; + std::vector value_vec(value.begin(), value.end()); + attribute_state_cache::get_instance().set(attrpath, value); + MatterReportingAttributeChangeCallback(matter_endpoint, + BridgedDeviceBasic::Id, + SoftwareVersionString::Id, + + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + &value_vec[0]); + break; + } + case ManufacturingDate::Id: { + std::string value = unify_value; + std::vector value_vec(value.begin(), value.end()); + attribute_state_cache::get_instance().set(attrpath, value); + MatterReportingAttributeChangeCallback(matter_endpoint, + BridgedDeviceBasic::Id, + ManufacturingDate::Id, + + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + &value_vec[0]); + break; + } + case ProductURL::Id: { + std::string value = unify_value; + std::vector value_vec(value.begin(), value.end()); + attribute_state_cache::get_instance().set(attrpath, value); + MatterReportingAttributeChangeCallback(matter_endpoint, + BridgedDeviceBasic::Id, + ProductURL::Id, + + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + &value_vec[0]); + break; + } + case ProductLabel::Id: { + std::string value = unify_value; + std::vector value_vec(value.begin(), value.end()); + attribute_state_cache::get_instance().set(attrpath, value); + MatterReportingAttributeChangeCallback(matter_endpoint, + BridgedDeviceBasic::Id, + ProductLabel::Id, + + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + &value_vec[0]); + break; + } + case SerialNumber::Id: { + std::string value = unify_value; + std::vector value_vec(value.begin(), value.end()); + attribute_state_cache::get_instance().set(attrpath, value); + MatterReportingAttributeChangeCallback(matter_endpoint, + BridgedDeviceBasic::Id, + SerialNumber::Id, + + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + &value_vec[0]); + } + } + } + + // Handler dot dot NameAndLocation cluster attribute update for NodeLabel + // attribute for bridged device basic information cluster mapping + if (cluster == "NameAndLocation") { + if (attribute.compare("Name") == 0) { + // parse the name or location attribute state value + std::string name = unify_value; + std::vector name_vec(name.begin(), name.end()); + attrpath = ConcreteAttributePath(matter_endpoint, + BridgedDeviceBasic::Id, + NodeLabel::Id); + attribute_state_cache::get_instance().set(attrpath, name); + MatterReportingAttributeChangeCallback(matter_endpoint, + BridgedDeviceBasic::Id, + NodeLabel::Id, + + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + &name_vec[0]); + } + } +} + +void BridgedDeviceBasicInfoAttributeAccess::unify_node_reachable_state_update( + const bridged_endpoint &ep, matter_node_state_monitor::update_t state) +{ + /// A node has changed its reachable state + if (state == matter_node_state_monitor::update_t::NODE_STATE_CHANGED) { + ConcreteAttributePath attr_path + = ConcreteAttributePath(ep.matter_endpoint, + BridgedDeviceBasic::Id, + Reachable::Id); + + Reachable::TypeInfo::Type node_reachable_state = ep.reachable; + attribute_state_cache::get_instance().set( + attr_path, + node_reachable_state); + + + MatterReportingAttributeChangeCallback( + ep.matter_endpoint, + BridgedDeviceBasic::Id, + Reachable::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&node_reachable_state)); + + // update the ReachableChanged Event + Events::ReachableChanged::Type event {node_reachable_state}; + EventNumber eventNumber; + if (CHIP_NO_ERROR != LogEvent(event, ep.matter_endpoint, eventNumber)) { + ChipLogError(Zcl, + "ReachableChanged: Failed to record ReachableChanged event"); + } + } +} + +uint32_t BridgedDeviceBasicInfoAttributeAccess::map_basic_cluster_attributes( + const std::string &dot_dot_basic_attribute) const +{ + static const auto end = basic_information_map.end(); + auto it = basic_information_map.find(dot_dot_basic_attribute); + if (it != end) { + return it->second; + } else { + return ATTRIBUTE_ID_INVALID; + } +} \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/bridged_device_basic_info_attribute_translator.hpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/bridged_device_basic_info_attribute_translator.hpp new file mode 100644 index 00000000000000..333c0680770f25 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/bridged_device_basic_info_attribute_translator.hpp @@ -0,0 +1,61 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @defgroup bridged_device_basic_info_attribute_translator + * @brief The module collect all relevant information regarding + * Basic/NameAndLocation/State clusters from the unify node and map them to + * matter bridged device basic information cluster. + * + * @{ + */ + +#ifndef BRIDGED_DEVICE_BASIC_INFO_ATTRIBUTE_TRANSLATOR_HPP +#define BRIDGED_DEVICE_BASIC_INFO_ATTRIBUTE_TRANSLATOR_HPP + +#include "attribute_translator_interface.hpp" + +namespace unify::matter_bridge +{ +class BridgedDeviceBasicInfoAttributeAccess : + public attribute_translator_interface +{ + public: + BridgedDeviceBasicInfoAttributeAccess( + matter_node_state_monitor &node_state_monitor); + CHIP_ERROR Read(const chip::app::ConcreteReadAttributePath &aPath, + chip::app::AttributeValueEncoder &aEncoder) override; + CHIP_ERROR Write(const chip::app::ConcreteDataAttributePath &aPath, + chip::app::AttributeValueDecoder &aDecoder) override; + + void reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) override; + + std::vector unify_cluster_names() const override + { + return std::vector({"Basic", "NameAndLocation"}); + } + + private: + uint32_t map_basic_cluster_attributes( + const std::string &dot_dot_basic_attributes) const; + static void unify_node_reachable_state_update( + const bridged_endpoint &ep, matter_node_state_monitor::update_t state); +}; + +} // namespace unify::matter_bridge + +#endif //BRIDGED_DEVICE_BASIC_INFO_ATTRIBUTE_TRANSLATOR_HPP +/** @} end bridged_device_basic_info_attribute_translator */ diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/command_translator_interface.hpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/command_translator_interface.hpp new file mode 100644 index 00000000000000..54bc9408b3f588 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/command_translator_interface.hpp @@ -0,0 +1,113 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +#ifndef COMMAND_TRANSLATOR_INTERFACE_HPP +#define COMMAND_TRANSLATOR_INTERFACE_HPP + +#include "matter.h" + +#include "matter_node_state_monitor.hpp" +#include "group_translator.hpp" +#include "uic_mqtt.h" +#include "sl_log.h" + +namespace unify::matter_bridge { + +/** + * @brief Base class for handling translation of commands + * + * This class hold base functionality for command translators, such + * at registering the translator with the chip::app framework. + * + */ +class command_translator_interface : public chip::app::CommandHandlerInterface { +public: + command_translator_interface(const matter_node_state_monitor& node_state_monitor,chip::ClusterId id, const char* name) : + chip::app::CommandHandlerInterface(chip::Optional::Missing(), + id ), + m_node_state_monitor(node_state_monitor), + cluster_name(name) + { + chip::app::InteractionModelEngine::GetInstance()->RegisterCommandHandler(this); + } + + /** + * @brief Send a unify command + * + * This function sends a unify command, either as a Single cast or a group + * cast message, depending on the context. + * + * @param ctxt + * @param cmd + * @param payload + */ + void send_unify_mqtt_cmd(const CommandHandlerInterface::HandlerContext& ctxt,const std::string& cmd, const nlohmann::json& payload) const { + std::string topic; + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + return; + } + + if( ctxt.mCommandHandler.GetExchangeContext()->IsGroupExchangeContext() ) { + auto matter_group_id = ctxt.mCommandHandler.GetExchangeContext()->GetSessionHandle()->AsIncomingGroupSession()->GetGroupId(); + auto unify_group_id = group_translator::instance().get_unify_group( {matter_group_id} ); + if(unify_group_id) { + topic = "ucl/by-group/" + std::to_string(unify_group_id.value()); + } else { + return; + } + } else { + topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint); + } + topic = topic + "/" + std::string(cluster_name) + "/Commands/"+ cmd; + + std::string msg = payload.dump(); + sl_log_debug("command_translator_interface", "--- send_unify_mqtt_cmd %s -> %s ---", topic.c_str(), msg.c_str()); + + uic_mqtt_publish(topic.c_str(), msg.c_str(), msg.size(), true); + } + + template void send_unify_mqtt_command_with_callbacks( + const CommandHandlerInterface::HandlerContext &ctxt, + T command_data, + void(*send_command_callback)(const char *, uint8_t, T), + void(*send_group_command_callback)(unify_group_t, T)) const + { + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + return; + } + + sl_log_debug("command_translator_interface", "Sending translated command from Matter to Unify to node %s", unify_node->unify_unid.c_str()); + if( ctxt.mCommandHandler.GetExchangeContext()->IsGroupExchangeContext() ) { + auto matter_group_id = ctxt.mCommandHandler.GetExchangeContext()->GetSessionHandle()->AsIncomingGroupSession()->GetGroupId(); + auto unify_group_id = group_translator::instance().get_unify_group( {matter_group_id} ); + if(unify_group_id) { + send_group_command_callback(unify_group_id.value(), command_data); + } else { + return; + } + } + + send_command_callback(unify_node->unify_unid.c_str(), unify_node->unify_endpoint, command_data); + } + +protected: + const matter_node_state_monitor& m_node_state_monitor; + const char* cluster_name; +}; + +} + +#endif //COMMAND_TRANSLATOR_INTERFACE_HPP diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/genResult.json b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/genResult.json new file mode 100644 index 00000000000000..a66c81939cff9b --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/genResult.json @@ -0,0 +1,419 @@ +{ + "writeTime": "Fri Aug 12 2022 14:47:30 GMT+0200 (Central European Summer Time)", + "featureLevel": 75, + "creator": "zap", + "content": [ + "command_translator.cpp", + "command_translator.hpp", + "matter_device_mapper.inc" + ], + "timing": { + "fileLoad": { + "nsDuration": 7237287, + "readableDuration": "7ms" + }, + "generation": { + "nsDuration": 176840485, + "readableDuration": "177ms" + } + }, + "stats": { + "templates": { + "command_translator.cpp": { + "zcl_clusters": { + "useCount": 2, + "isDeprecated": false + }, + "asUpperCamelCase": { + "useCount": 2661, + "isDeprecated": false + }, + "zcl_commands_source_client": { + "useCount": 58, + "isDeprecated": false + }, + "zcl_bitmaps": { + "useCount": 58, + "isDeprecated": false + }, + "zcl_enums": { + "useCount": 58, + "isDeprecated": false + }, + "zcl_structs": { + "useCount": 58, + "isDeprecated": false + }, + "zcl_enum_items": { + "useCount": 90, + "isDeprecated": false + }, + "zcl_command_arguments": { + "useCount": 153, + "isDeprecated": false + }, + "asLowerCamelCase": { + "useCount": 288, + "isDeprecated": false + } + }, + "command_translator.hpp": { + "zcl_clusters": { + "useCount": 1, + "isDeprecated": false + }, + "asUpperCamelCase": { + "useCount": 232, + "isDeprecated": false + } + }, + "matter_device_mapper.inc": { + "zcl_clusters": { + "useCount": 5, + "isDeprecated": false + }, + "zcl_attributes_server": { + "useCount": 58, + "isDeprecated": false + }, + "chipSupportedCluster": { + "useCount": 1111, + "isDeprecated": false + }, + "asUpperCamelCase": { + "useCount": 1149, + "isDeprecated": false + }, + "listComma": { + "useCount": 1013, + "isDeprecated": false + }, + "last": { + "useCount": 1013, + "isDeprecated": false + }, + "zcl_commands": { + "useCount": 58, + "isDeprecated": false + }, + "chipClusterConversion": { + "useCount": 190, + "isDeprecated": false + }, + "chipSupportedClusterWithCommands": { + "useCount": 58, + "isDeprecated": false + }, + "first": { + "useCount": 897, + "isDeprecated": false + }, + "chipSupportedAttribute": { + "useCount": 705, + "isDeprecated": false + }, + "chipAttributeConversion": { + "useCount": 705, + "isDeprecated": false + }, + "chipSupportedCommands": { + "useCount": 192, + "isDeprecated": false + }, + "chipCommandsConversion": { + "useCount": 146, + "isDeprecated": false + } + } + }, + "allHelpers": { + "access": 0, + "access_aggregate": 0, + "addOne": 0, + "addToAccumulator": 0, + "add_one": 0, + "add_prefix_to_all_strings": 0, + "add_to_accumulator": 0, + "after": 0, + "all_cli_commands_for_user_enabled_clusters": 0, + "all_commands_for_user_enabled_clusters": 0, + "all_incoming_commands_for_cluster": 0, + "all_incoming_commands_for_cluster_combined": 0, + "all_outgoing_commands_for_cluster": 0, + "all_user_cluster_attributes_for_generated_defaults": 0, + "all_user_cluster_attributes_irrespective_of_manufatucuring_specification": 0, + "all_user_cluster_attributes_min_max_defaults": 0, + "all_user_cluster_commands": 0, + "all_user_cluster_commands_irrespective_of_manufaturing_specification": 0, + "all_user_cluster_generated_attributes": 0, + "all_user_cluster_generated_commands": 0, + "all_user_cluster_manufacturer_specific_attributes": 0, + "all_user_cluster_manufacturer_specific_commands": 0, + "all_user_cluster_non_manufacturer_specific_attributes": 0, + "all_user_cluster_non_manufacturer_specific_commands": 0, + "all_user_clusters": 0, + "all_user_clusters_irrespective_of_side": 0, + "all_user_clusters_names": 0, + "all_user_clusters_with_incoming_commands": 0, + "all_user_clusters_with_incoming_commands_combined": 0, + "all_user_clusters_with_outgoing_commands": 0, + "all_user_incoming_commands_for_all_clusters": 0, + "all_user_reportable_attributes": 0, + "asBytes": 0, + "asCamelCased": 0, + "asCliType": 0, + "asDelimitedMacro": 0, + "asHex": 0, + "asLastWord": 0, + "asOffset": 0, + "asSpacedLowercase": 0, + "asSymbol": 0, + "asType": 0, + "asUnderlyingType": 0, + "asUnderlyingZclType": 0, + "asUnderscoreLowercase": 0, + "asUnderscoreUppercase": 0, + "as_bytes": 0, + "as_camel_cased": 0, + "as_cli_type": 0, + "as_delimited_macro": 0, + "as_generated_default_macro": 0, + "as_hex": 0, + "as_last_word": 0, + "as_offset": 0, + "as_snake_case": 0, + "as_spaced_lowercase": 0, + "as_symbol": 0, + "as_type": 0, + "as_underlying_type": 0, + "as_underlying_zcl_type": 0, + "as_underlying_zcl_type_ca_always_present_with_presentif": 0, + "as_underlying_zcl_type_ca_not_always_present_no_presentif": 0, + "as_underlying_zcl_type_ca_not_always_present_with_presentif": 0, + "as_underlying_zcl_type_command_argument_always_present": 0, + "as_underlying_zcl_type_command_argument_always_present_with_presentif": 0, + "as_underlying_zcl_type_command_argument_not_always_present_no_presentif": 0, + "as_underlying_zcl_type_command_argument_not_always_present_with_presentif": 0, + "as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present": 0, + "as_underlying_zcl_type_if_command_is_not_fixed_length": 0, + "as_underscore_lowercase": 0, + "as_underscore_uppercase": 0, + "as_uppercase": 0, + "as_zcl_cli_type": 0, + "attribute_extension": 0, + "attribute_mask": 0, + "attribute_type_extension": 0, + "backslash": 0, + "cleanseLabel": 0, + "cleanseLabelAsKebabCase": 0, + "cleanse_label": 0, + "cleanse_label_as_kebab_case": 0, + "cluster_extension": 0, + "command_arguments_total_length": 0, + "command_extension": 0, + "command_mask": 0, + "concatenate": 0, + "dataTypeForBitmap": 0, + "dataTypeForEnum": 0, + "data_type_for_bitmap": 0, + "data_type_for_enum": 0, + "debug_object": 0, + "default_access": 0, + "device_type_extension": 0, + "endpoint_attribute_count": 0, + "endpoint_attribute_list": 0, + "endpoint_attribute_long_defaults": 0, + "endpoint_attribute_long_defaults_count": 0, + "endpoint_attribute_manufacturer_code_count": 0, + "endpoint_attribute_manufacturer_codes": 0, + "endpoint_attribute_min_max_count": 0, + "endpoint_attribute_min_max_list": 0, + "endpoint_cluster_count": 0, + "endpoint_cluster_list": 0, + "endpoint_cluster_manufacturer_code_count": 0, + "endpoint_cluster_manufacturer_codes": 0, + "endpoint_command_count": 0, + "endpoint_command_list": 0, + "endpoint_command_manufacturer_code_count": 0, + "endpoint_command_manufacturer_codes": 0, + "endpoint_config": 0, + "endpoint_config_macros": 0, + "endpoint_count": 0, + "endpoint_fixed_device_type_array": 0, + "endpoint_fixed_device_type_array_lengths": 0, + "endpoint_fixed_device_type_array_offsets": 0, + "endpoint_fixed_endpoint_array": 0, + "endpoint_fixed_endpoint_type_array": 0, + "endpoint_fixed_network_array": 0, + "endpoint_fixed_profile_id_array": 0, + "endpoint_largest_attribute_size": 0, + "endpoint_reporting_config_default_count": 0, + "endpoint_reporting_config_defaults": 0, + "endpoint_singletons_size": 0, + "endpoint_total_storage_size": 0, + "endpoint_type_count": 0, + "endpoint_type_identifier": 0, + "endpoint_type_index": 0, + "endpoint_types_list": 0, + "event_extension": 0, + "fail": 0, + "feature_bits": 0, + "first": 897, + "first_unused_enum_value": 0, + "formatValue": 0, + "format_value": 0, + "format_zcl_string_as_characters_for_generated_defaults": 0, + "future": 0, + "generated_attribute_min_max_index": 0, + "generated_attributes_min_max_index": 0, + "generated_clustes_details": 0, + "generated_default_index": 0, + "generated_defaults_index": 0, + "generated_endpoint_type_details": 0, + "global_attribute_default": 0, + "ident": 0, + "if_ca_always_present_with_presentif": 0, + "if_ca_not_always_present_no_presentif": 0, + "if_ca_not_always_present_with_presentif": 0, + "if_cluster_extension_false": 0, + "if_cluster_extension_true": 0, + "if_command_arg_always_present_with_presentif": 0, + "if_command_arg_not_always_present_no_presentif": 0, + "if_command_arg_not_always_present_with_presentif": 0, + "if_command_args_exist": 0, + "if_command_argument_always_present": 0, + "if_command_argument_always_present_with_presentif": 0, + "if_command_argument_not_always_present_no_presentif": 0, + "if_command_argument_not_always_present_with_presentif": 0, + "if_command_arguments_exist": 0, + "if_command_arguments_have_fixed_length": 0, + "if_command_discovery_enabled": 0, + "if_command_extension_false": 0, + "if_command_extension_true": 0, + "if_command_fixed_length": 0, + "if_command_is_fixed_length": 0, + "if_command_is_not_fixed_length_but_command_argument_is_always_present": 0, + "if_command_not_fixed_length_command_argument_always_present": 0, + "if_future": 0, + "if_is_atomic": 0, + "if_is_bitmap": 0, + "if_is_char_string": 0, + "if_is_enum": 0, + "if_is_long_string": 0, + "if_is_number": 0, + "if_is_octet_string": 0, + "if_is_short_string": 0, + "if_is_string": 0, + "if_is_struct": 0, + "if_manufacturing_specific_cluster": 0, + "if_mfg_specific_cluster": 0, + "indent": 0, + "isBitmap": 0, + "isClient": 0, + "isCommandAvailable": 0, + "isEnabled": 0, + "isEnum": 0, + "isEqual": 0, + "isFirstElement": 0, + "isLastElement": 0, + "isServer": 0, + "isStrEqual": 0, + "isStruct": 0, + "is_bitmap": 0, + "is_client": 0, + "is_command_available": 0, + "is_command_default_response_disabled": 0, + "is_command_default_response_enabled": 0, + "is_defined": 0, + "is_enabled": 0, + "is_enum": 0, + "is_equal": 0, + "is_first_element": 0, + "is_last_element": 0, + "is_lowercase_equal": 0, + "is_num_equal": 0, + "is_number_greater_than": 0, + "is_server": 0, + "is_str_equal": 0, + "is_string_underscored": 0, + "is_struct": 0, + "is_zcl_string": 0, + "iterate": 0, + "iterateAccumulator": 0, + "iterate_accumulator": 0, + "last": 1013, + "manufacturing_clusters_with_incoming_commands": 0, + "middle": 0, + "multiply": 0, + "new_line": 0, + "not_first": 0, + "not_last": 0, + "replace_string": 0, + "set_future": 0, + "template_option_with_code": 0, + "template_options": 0, + "toggle": 0, + "token_next": 0, + "tokens_context": 0, + "trim_string": 0, + "user_all_attributes": 0, + "user_cluster_attributes": 0, + "user_cluster_command_count_with_cli": 0, + "user_cluster_commands": 0, + "user_cluster_commands_all_endpoints": 0, + "user_cluster_commands_with_cli": 0, + "user_cluster_has_enabled_command": 0, + "user_clusters": 0, + "user_default_response_policy": 0, + "user_endpoint_count_by_cluster": 0, + "user_endpoint_type_count": 0, + "user_endpoint_types": 0, + "user_endpoints": 0, + "user_manufacturer_code": 0, + "user_session_key": 0, + "zap_header": 0, + "zcl_atomics": 0, + "zcl_attributes": 0, + "zcl_attributes_client": 0, + "zcl_attributes_server": 58, + "zcl_bitmap_items": 0, + "zcl_bitmaps": 58, + "zcl_cluster_largest_label_length": 0, + "zcl_clusters": 8, + "zcl_command_argument_data_type": 0, + "zcl_command_argument_type_to_cli_data_type": 0, + "zcl_command_argument_type_to_zcl_cli_data_type": 0, + "zcl_command_arguments": 153, + "zcl_command_arguments_count": 0, + "zcl_command_tree": 0, + "zcl_commands": 58, + "zcl_commands_source_client": 58, + "zcl_commands_source_server": 0, + "zcl_commands_with_arguments": 0, + "zcl_commands_with_cluster_info": 0, + "zcl_device_type_cluster_attributes": 0, + "zcl_device_type_cluster_commands": 0, + "zcl_device_type_clusters": 0, + "zcl_device_types": 0, + "zcl_enum_items": 90, + "zcl_enums": 58, + "zcl_event_fields": 0, + "zcl_events": 0, + "zcl_global_commands": 0, + "zcl_string_type_return": 0, + "zcl_struct_items": 0, + "zcl_struct_items_by_struct_name": 0, + "zcl_structs": 58, + "asUpperCamelCase": null, + "asLowerCamelCase": null, + "chipSupportedCluster": null, + "listComma": null, + "chipClusterConversion": null, + "chipSupportedClusterWithCommands": null, + "chipSupportedAttribute": null, + "chipAttributeConversion": null, + "chipSupportedCommands": null, + "chipCommandsConversion": null + } + } +} \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_command_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_command_translator.cpp new file mode 100644 index 00000000000000..5b2462cd7ceec5 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_command_translator.cpp @@ -0,0 +1,88 @@ +/******************************************************************************* + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + ******************************************************************************/ +#include "group_command_translator.hpp" +#include "uic_mqtt.h" +#include +#include +#include +#include "sl_log.h" +#include +#include + + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters::Groups; +using namespace chip::DeviceLayer; +using namespace unify::matter_bridge; + +#define LOG_TAG "group_cluster_server" + + +void GroupClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + + std::string cmd; + nlohmann::json payload; + + // We copy the TLV reader here, because it is state full. and we need the + // ember group handler to read the parameters as well + TLV::TLVReader tlv; + tlv.Init(ctxt.GetReader()); + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::AddGroup::Id: + { + Commands::AddGroup::DecodableType addGroupData; + CHIP_ERROR TLVError = DataModel::Decode(tlv, addGroupData); + if(CHIP_ERROR::IsSuccess(TLVError)) { + cmd = "AddGroup"; + payload["GroupId"] = addGroupData.groupId; + payload["GroupName"] = std::string(addGroupData.groupName.begin(),addGroupData.groupName.end()); + + group_translator::matter_group group = { addGroupData.groupId }; + group_translator::instance().add_matter_group( group ); + } + } + break; + case Commands::RemoveGroup::Id: + { + Commands::RemoveGroup::DecodableType removeGroupData; + CHIP_ERROR TLVError = DataModel::Decode(tlv, removeGroupData); + if(CHIP_ERROR::IsSuccess(TLVError)) { + cmd = "RemoveGroup"; + payload["GroupId"] = removeGroupData.groupId; + group_translator::matter_group group = {removeGroupData.groupId }; + group_translator::instance().remove_matter_group( group ); + } + } + break; + default: + // As we are just "sniffing" on the commands we do not need to + // do the actual matter handling here. This is done by the ember code. + break; + } + + // We will not set the handle flag on the group cluster, + // Because it need to be passed to the Matter App framework + ctxt.SetCommandNotHandled(); + if(!cmd.empty()) { + send_unify_mqtt_cmd(ctxt, cmd, payload); + } + +} + + + diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_command_translator.hpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_command_translator.hpp new file mode 100644 index 00000000000000..6e6e59e4425615 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_command_translator.hpp @@ -0,0 +1,38 @@ +/****************************************************************************** + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @file on_off_command_translator.h + * @ingroup components + * + * @brief OnOff cluster command handler for matter interface + * + * @{ + */ +#pragma once +#include "matter.h" +#include "command_translator_interface.hpp" + +namespace unify::matter_bridge +{ +class GroupClusterCommandHandler : public command_translator_interface +{ + public: + GroupClusterCommandHandler(const matter_node_state_monitor& node_state_monitor) : command_translator_interface(node_state_monitor,chip::app::Clusters::Groups::Id,"Groups" ) {} + // CommandHandlerInterface + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &handlerContext) override; + +}; + +} // namespace unify::matter_bridge \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_translator.cpp new file mode 100644 index 00000000000000..7de87338b92805 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_translator.cpp @@ -0,0 +1,79 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#include "group_translator.hpp" +#include "matter_data_storage.hpp" +#include +#include +#include +#include + +namespace unify::matter_bridge +{ + +std::optional + group_translator::get_unify_group(const matter_group &group) +{ + matter_data_storage::group_mapping group_info = {group.group}; + if (matter_data_storage::instance().get_persisted_data(group_info)) { + return group_info.unify_group_id.value(); + } else { + return std::nullopt; + } +} + +bool group_translator::add_matter_group(const matter_group &group) +{ + while (allocated_unify_groups.count(last_allocated_group)) { + last_allocated_group++; + if (last_allocated_group == std::numeric_limits::max()) { + return false; + } + } + matter_data_storage::group_mapping group_info + = {group.group, last_allocated_group}; + matter_data_storage::instance().persist_data(group_info); + return true; +} + +void group_translator::remove_matter_group(const matter_group &group) +{ + auto ug = get_unify_group(group); + if (ug) { + matter_data_storage::group_mapping group_info = {group.group}; + matter_data_storage::instance().remove_persisted_data(group_info); + } +} + +void group_translator::register_unify_group(const unify_group_t &group) +{ + allocated_unify_groups.insert(group); +} + +void group_translator::on_mqtt_message_cb(const char *topic, + const char *message, + const size_t message_length) +{ + std::regex rgx("ucl/by-group" + "/([^/]*)" // group id + "/NodeList" + "/([^/]*)"); + std::smatch match; + std::string topic_str(topic); + if (!std::regex_search(topic_str, match, rgx)) { + return; + } + const std::string &group_id = match.str(1); + const unify_group_t group = std::stoi(group_id); + group_translator::register_unify_group(group); +} +} // namespace unify::matter_bridge \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_translator.hpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_translator.hpp new file mode 100644 index 00000000000000..f8e74c5c2dabe0 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/group_translator.hpp @@ -0,0 +1,121 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @defgroup group_translator + * @brief Translate between matter groups ans unify groups. + * + * The purpose of the group translator is to translate Matter group into Unify groups + * + * @{ + */ + +#ifndef GROUP_TRANSLATOR_HPP +#define GROUP_TRANSLATOR_HPP + +#include +#include + +#include "matter.h" +#include "uic_mqtt.h" +#include + +namespace unify::matter_bridge +{ + +using unify_group_t = uint16_t; + +/** + * @brief Group Translator + * The role of the group translator is to translate between Unify Gorup Ids + * and matter group ID's + */ +class group_translator +{ + public: + struct matter_group { + //uint32_t fabric; + chip::GroupId group; + + bool operator<(const matter_group &b) const + { + return group < b.group; + } + }; + + group_translator() : last_allocated_group(0) + { + std::string topic_by_group = "ucl/by-group/#"; + uic_mqtt_subscribe_ex(topic_by_group.c_str(), + group_translator::on_mqtt_message_c_cb, + this); + } + + std::optional get_unify_group(const matter_group &group); + + /** + * @brief Register a new matter group + * + * This funciton allocates a new unify group to match with the matter group number. + * + * @param group + * @return true + * @return false + */ + bool add_matter_group(const matter_group &group); + + /** + * @brief Remove a created group map + * + * @param group + */ + void remove_matter_group(const matter_group &group); + + /** + * @brief Register a created unify group + * + * This is used to ensure that we do not allocate unify + * groups which are already in use + * + * @param group + */ + void register_unify_group(const unify_group_t &group); + + static group_translator &instance() + { + static group_translator m; + return m; + } + + private: + unify_group_t last_allocated_group; + std::set allocated_unify_groups; + void on_mqtt_message_cb(const char *topic, + const char *message, + const size_t message_length); + static void on_mqtt_message_c_cb(const char *topic, + const char *message, + const size_t message_length, + void *user) + { + group_translator *instance = static_cast(user); + if (instance) { + instance->on_mqtt_message_cb(topic, message, message_length); + } + } +}; + +} // namespace unify::matter_bridge + +#endif //GROUP_TRANSLATOR_HPP +/** @} end group_translator */ diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_attribute_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_attribute_translator.cpp new file mode 100644 index 00000000000000..c9940dad2af361 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_attribute_translator.cpp @@ -0,0 +1,120 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#include "identify_attribute_translator.hpp" + +#include +#include +#include +#include "matter.h" + +#include +#include "matter_device_translator.hpp" +#include "uic_mqtt.h" +#include "sl_log.h" + +#define LOG_TAG "identify_cluster_server" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::Identify; +using namespace chip::app::Clusters::Identify::Attributes; +using namespace unify::matter_bridge; + +CHIP_ERROR IdentifyAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + if (aPath.mClusterId != Clusters::Identify::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + if (aPath.mAttributeId == IdentifyTime::Id) { + ConcreteAttributePath attr_path = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + Attributes::IdentifyTime::TypeInfo::Type remaining_time + = attribute_state_cache::get_instance() + .get(attr_path); + return aEncoder.Encode(remaining_time); + } else { + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } +} + +CHIP_ERROR +IdentifyAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + if (aPath.mClusterId != Clusters::Identify::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + auto unify_node = m_node_state_monitor.bridged_endpoint(aPath.mEndpointId); + + if (!unify_node) { + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + if (aPath.mAttributeId == IdentifyTime::Id) { + IdentifyTime::TypeInfo::DecodableType timeout_value; + aDecoder.Decode(timeout_value); + nlohmann::json jsn; + jsn["value"] = timeout_value; + std::string identify_time_topic + = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/Identify/Attributes/IdentifyTime/Desired"; + std::string payload_str = jsn.dump(); + uic_mqtt_publish(identify_time_topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_NO_ERROR; + } else { + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } +} + +void IdentifyAttributeAccess::reported_updated( + const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + if (!cluster_id.has_value() || (cluster_id.value() != Identify::Id)) { + return; + } + auto attribute_id + = device_translator::instance().get_attribute_id(cluster, attribute); + + if (!attribute_id.has_value()) { + return; + } + + if (attribute_id.value() == IdentifyTime::Id) { + chip::EndpointId node_matter_endpoint = ep->matter_endpoint; + ConcreteAttributePath attr_path + = ConcreteAttributePath(node_matter_endpoint, + Identify::Id, + attribute_id.value()); + IdentifyTime::TypeInfo::Type value = unify_value; + attribute_state_cache::get_instance() + .set(attr_path, value); + MatterReportingAttributeChangeCallback(node_matter_endpoint, + Clusters::Identify::Id, + Attributes::IdentifyTime::Id, + + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value)); + } +} \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_attribute_translator.hpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_attribute_translator.hpp new file mode 100644 index 00000000000000..4e41591c78cdb7 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_attribute_translator.hpp @@ -0,0 +1,55 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @defgroup identify_attribute_translator + * @brief components + * + * It parse and update attribute state update for identify cluster. + * + * @{ + */ + +#ifndef IDENTIFY_ATTRIBUTE_TRANSLATOR_HPP +#define IDENTIFY_ATTRIBUTE_TRANSLATOR_HPP + +#include "attribute_translator_interface.hpp" + +namespace unify::matter_bridge +{ +class IdentifyAttributeAccess : public attribute_translator_interface +{ + public: + IdentifyAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::Identify::Id) + {} + CHIP_ERROR Read(const chip::app::ConcreteReadAttributePath &aPath, + chip::app::AttributeValueEncoder &aEncoder) override; + CHIP_ERROR Write(const chip::app::ConcreteDataAttributePath &aPath, + chip::app::AttributeValueDecoder &aDecoder) override; + + private: + void reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) override; + std::vector unify_cluster_names() const override + { + return std::vector({"Identify"}); + } +}; + +} // namespace unify::matter_bridge +#endif //IDENTIFY_ATTRIBUTE_TRANSLATOR_HPP +/** @} end identify_attribute_translator */ diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_command_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_command_translator.cpp new file mode 100644 index 00000000000000..d970dcb17ea045 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_command_translator.cpp @@ -0,0 +1,116 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#include "identify_command_translator.hpp" +#include + +// Standard library +#include +#include +#include + +// Unify library +#include "uic_mqtt.h" +#include "sl_log.h" + +// Third party +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::Identify; +using namespace unify::matter_bridge; + +#define LOG_TAG "identify_cluster_command_server" + +void IdentifyClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + auto unify_node + = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + + if (!unify_node) { + return; + } + nlohmann::json payload = {}; + + std::string cmd; + switch (ctxt.mRequestPath.mCommandId) { + case Commands::Identify::Id: { + Commands::Identify::DecodableType data; + CHIP_ERROR TLVError = DataModel::Decode(ctxt.GetReader(), data); + if (TLVError != CHIP_NO_ERROR) { + ctxt.mCommandHandler.AddStatus( + ctxt.mRequestPath, + Protocols::InteractionModel::Status::InvalidCommand); + ctxt.SetCommandHandled(); + sl_log_error(LOG_TAG, "Unable to read Identify command payload"); + return; + } + + cmd = "Identify"; + payload["IdentifyTime"] = data.identifyTime; + ctxt.mCommandHandler.AddStatus( + ctxt.mRequestPath, + Protocols::InteractionModel::Status::Success); + ctxt.SetCommandHandled(); + break; + } + /**case Commands::IdentifyQuery::Id: { + cmd = "IdentifyQuery"; + //read the remaining time in second for identify the endpoint + ConcreteAttributePath attr_path + = ConcreteAttributePath(ctxt.mRequestPath.mEndpointId, + Identify::Id, + Attributes::IdentifyTime::Id); + Attributes::IdentifyTime::TypeInfo::Type remaining_time = 0; + remaining_time + = attribute_state_cache::get_instance() + .get(attr_path); + // Preparing the response + Commands::IdentifyQueryResponse::Type data_response; + data_response.timeout = remaining_time; + ctxt.mCommandHandler.AddResponseData(ctxt.mRequestPath, data_response); + break; + }*/ + case Commands::TriggerEffect::Id: { + Commands::TriggerEffect::DecodableType data; + CHIP_ERROR TLVError = DataModel::Decode(ctxt.GetReader(), data); + if (TLVError != CHIP_NO_ERROR) { + ctxt.mCommandHandler.AddStatus( + ctxt.mRequestPath, + Protocols::InteractionModel::Status::InvalidCommand); + ctxt.SetCommandHandled(); + sl_log_error(LOG_TAG, "Unable to read TriggerEffect command payload"); + return; + } + cmd = "TriggerEffect"; + payload["EffectIdentifier"] = static_cast(data.effectIdentifier); + payload["EffectVariant"] = static_cast(data.effectVariant); + ctxt.mCommandHandler.AddStatus( + ctxt.mRequestPath, + Protocols::InteractionModel::Status::Success); + ctxt.SetCommandHandled(); + break; + } + default: { + ctxt.mCommandHandler.AddStatus( + ctxt.mRequestPath, + Protocols::InteractionModel::Status::UnsupportedCommand); + ctxt.SetCommandHandled(); + sl_log_info(LOG_TAG, "Unknown identify cluster command is received"); + return; + } + } + send_unify_mqtt_cmd( ctxt, cmd, payload); +} \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_command_translator.hpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_command_translator.hpp new file mode 100644 index 00000000000000..138e5794b677ac --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_command_translator.hpp @@ -0,0 +1,46 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @defgroup identify_command_translator + * @brief Identify cluster command translator for matter interface + * + * Translate Identify cluster commands from the matter protocol to unify + * dotdot data model. + * + * @{ + */ + +#ifndef IDENTIFY_COMMAND_TRANSLATOR_HPP +#define IDENTIFY_COMMAND_TRANSLATOR_HPP + +#pragma once +#include "command_translator_interface.hpp" + +namespace unify::matter_bridge +{ +class IdentifyClusterCommandHandler : public command_translator_interface +{ + public: + IdentifyClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::Identify::Id,"Identify") + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +} // namespace unify::matter_bridge + +#endif //IDENTIFY_COMMAND_TRANSLATOR_HPP +/** @} end identify_command_translator */ diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_attribute_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_attribute_translator.cpp new file mode 100644 index 00000000000000..757829602aa45f --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_attribute_translator.cpp @@ -0,0 +1,482 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +#include "level_attribute_translator.hpp" + +// Standard library +#include +#include +#include + +// Third party +#include + +// Matter library +#include +#include +#include + +// Application components +#include "matter_device_translator.hpp" +#include "matter_node_state_monitor.hpp" + +// Unify components +#include "attribute_state_cache.hpp" +#include "uic_mqtt.h" +#include "sl_log.h" + +#define LOG_TAG "level_attribute_cluster_server" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::LevelControl; +using namespace unify::matter_bridge; + +static const unify::matter_bridge::device_translator &device_translator_obj + = unify::matter_bridge::device_translator::instance(); + +static const std::unordered_map zcl_types_map { + {typeid(uint8_t), ZCL_INT8_U_ATTRIBUTE_ID}, + {typeid(uint16_t), ZCL_INT16_U_ATTRIBUTE_ID}, + {typeid(uint32_t), ZCL_INT32_U_ATTRIBUTE_ID}, + {typeid(uint64_t), ZCL_INT64_U_ATTRIBUTE_ID}, + {typeid(int8_t), ZCL_INT8_S_ATTRIBUTE_ID}, + {typeid(int16_t), ZCL_INT16_S_ATTRIBUTE_ID}, + {typeid(int32_t), ZCL_INT32_S_ATTRIBUTE_ID}, + {typeid(int64_t), ZCL_INT64_S_ATTRIBUTE_ID}, + {typeid(chip::app::DataModel::Nullable), + ZCL_NULLABLE_INT8_U_ATTRIBUTE_ID}, + {typeid(chip::app::DataModel::Nullable), + ZCL_NULLABLE_INT16_U_ATTRIBUTE_ID}, + {typeid(chip::app::DataModel::Nullable), + ZCL_NULLABLE_INT32_U_ATTRIBUTE_ID}, + {typeid(chip::app::DataModel::Nullable), + ZCL_NULLABLE_INT64_U_ATTRIBUTE_ID}, +}; + +CHIP_ERROR +LevelAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + if (aPath.mClusterId != Clusters::LevelControl::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + return ReadAttributeState(aPath, aEncoder); +} + +CHIP_ERROR LevelAttributeAccess::ReadAttributeState( + const ConcreteReadAttributePath &aPath, AttributeValueEncoder &aEncoder) +{ + sl_log_info(LOG_TAG, "read %i\n", aPath.mEndpointId); + + ConcreteAttributePath attribute_path + = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + case Attributes::CurrentLevel::Id: { + Attributes::CurrentLevel::TypeInfo::Type read_current_level_state + = attribute_state_cache::get_instance() + .get(attribute_path); + return aEncoder.Encode(read_current_level_state); + } + case Attributes::RemainingTime::Id: { + Attributes::RemainingTime::TypeInfo::Type read_remaining_time_state + = attribute_state_cache::get_instance() + .get(attribute_path); + return aEncoder.Encode(read_remaining_time_state); + } + case Attributes::MinLevel::Id: { + Attributes::MinLevel::TypeInfo::Type read_min_level_state + = attribute_state_cache::get_instance() + .get(attribute_path); + return aEncoder.Encode(read_min_level_state); + } + case Attributes::MaxLevel::Id: { + Attributes::MaxLevel::TypeInfo::Type read_max_level_state + = attribute_state_cache::get_instance() + .get(attribute_path); + return aEncoder.Encode(read_max_level_state); + } + case Attributes::CurrentFrequency::Id: { + Attributes::CurrentFrequency::TypeInfo::Type + read_current_frequency_state + = attribute_state_cache::get_instance() + .get( + attribute_path); + return aEncoder.Encode(read_current_frequency_state); + } + case Attributes::MinFrequency::Id: { + Attributes::MinFrequency::TypeInfo::Type read_min_frequency_state + = attribute_state_cache::get_instance() + .get(attribute_path); + return aEncoder.Encode(read_min_frequency_state); + } + case Attributes::MaxFrequency::Id: { + Attributes::MaxFrequency::TypeInfo::Type read_max_frequency_state + = attribute_state_cache::get_instance() + .get(attribute_path); + return aEncoder.Encode(read_max_frequency_state); + } + case Attributes::OnOffTransitionTime::Id: { + Attributes::OnOffTransitionTime::TypeInfo::Type + read_on_off_transition_time_state + = attribute_state_cache::get_instance() + .get( + attribute_path); + return aEncoder.Encode(read_on_off_transition_time_state); + } + case Attributes::OnLevel::Id: { + Attributes::OnLevel::TypeInfo::Type::UnderlyingType read_on_level_state + = attribute_state_cache::get_instance() + .get( + attribute_path); + return aEncoder.Encode(read_on_level_state); + } + case Attributes::OnTransitionTime::Id: { + Attributes::OnTransitionTime::TypeInfo::Type::UnderlyingType + read_on_transition_time_state + = attribute_state_cache::get_instance() + .get< + Attributes::OnTransitionTime::TypeInfo::Type::UnderlyingType>( + attribute_path); + return aEncoder.Encode(read_on_transition_time_state); + } + case Attributes::OffTransitionTime::Id: { + Attributes::OffTransitionTime::TypeInfo::Type::UnderlyingType + read_off_transition_time_state + = attribute_state_cache::get_instance() + .get< + Attributes::OffTransitionTime::TypeInfo::Type::UnderlyingType>( + attribute_path); + return aEncoder.Encode(read_off_transition_time_state); + } + case Attributes::DefaultMoveRate::Id: { + Attributes::DefaultMoveRate::TypeInfo::Type::UnderlyingType + read_default_move_rate_state + = attribute_state_cache::get_instance() + .get( + attribute_path); + return aEncoder.Encode(read_default_move_rate_state); + } + case Attributes::Options::Id: { + Attributes::Options::TypeInfo::Type read_options_state + = attribute_state_cache::get_instance() + .get(attribute_path); + return aEncoder.Encode(read_options_state); + } + case Attributes::StartUpCurrentLevel::Id: { + Attributes::StartUpCurrentLevel::TypeInfo::Type::UnderlyingType + read_start_up_current_level_state + = attribute_state_cache::get_instance() + .get(attribute_path); + return aEncoder.Encode(read_start_up_current_level_state); + } + default: + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + } catch (const std::out_of_range &e) { + sl_log_info( + LOG_TAG, + "The request attribute Path is not found in the attribute state " + "contanier, %s\n", + e.what()); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } +} + +CHIP_ERROR +LevelAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + if (aPath.mClusterId != Clusters::LevelControl::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto unify_node = m_node_state_monitor.bridged_endpoint(aPath.mEndpointId); + + if (!unify_node) { + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + std::string attribute_name; + nlohmann::json payload; + switch (aPath.mAttributeId) { + case Attributes::CurrentLevel::Id: { + Attributes::CurrentLevel::TypeInfo::DecodableType desired_current_level; + aDecoder.Decode(desired_current_level); + payload["value"] = desired_current_level; + attribute_name = "CurrentLevel"; + break; + } + case Attributes::OnOffTransitionTime::Id: { + Attributes::OnOffTransitionTime::TypeInfo::DecodableType + desired_on_off_transition_time; + aDecoder.Decode(desired_on_off_transition_time); + payload["value"] = desired_on_off_transition_time; + attribute_name = "OnOffTransitionTime"; + break; + } + case Attributes::OnLevel::Id: { + Attributes::OnLevel::TypeInfo::DecodableType::UnderlyingType + desired_on_level; + aDecoder.Decode(desired_on_level); + payload["value"] = desired_on_level; + attribute_name = "OnLevel"; + break; + } + case Attributes::OnTransitionTime::Id: { + Attributes::OnTransitionTime::TypeInfo::DecodableType::UnderlyingType + desired_on_transition_time; + aDecoder.Decode(desired_on_transition_time); + payload["value"] = desired_on_transition_time; + attribute_name = "OnTransitionTime"; + break; + } + case Attributes::OffTransitionTime::Id: { + Attributes::OffTransitionTime::TypeInfo::DecodableType::UnderlyingType + desired_off_transition_time; + aDecoder.Decode(desired_off_transition_time); + payload["value"] = desired_off_transition_time; + attribute_name = "OffTransitionTime"; + break; + } + case Attributes::DefaultMoveRate::Id: { + Attributes::DefaultMoveRate::TypeInfo::DecodableType::UnderlyingType + desired_default_move_rate; + aDecoder.Decode(desired_default_move_rate); + payload["value"] = desired_default_move_rate; + attribute_name = "DefaultMoveRate"; + break; + } + case Attributes::Options::Id: { + Attributes::Options::TypeInfo::DecodableType desired_options; + aDecoder.Decode(desired_options); + payload["value"] = desired_options; + attribute_name = "Options"; + break; + } + case Attributes::StartUpCurrentLevel::Id: { + Attributes::StartUpCurrentLevel::TypeInfo::DecodableType::UnderlyingType + desired_start_up_current_level; + aDecoder.Decode(desired_start_up_current_level); + payload["value"] = desired_start_up_current_level; + attribute_name = "StartUpCurrentLevel"; + break; + } + default: + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + if (!attribute_name.empty()) { + std::string onoff_topic; + std::string payload_str; + onoff_topic = "ucl/by-unid/" + unify_node->unify_unid + "/" + + std::to_string(unify_node->unify_endpoint) + + "/Level/Attributes/" + attribute_name + "/Desired"; + payload_str = payload.dump(); + uic_mqtt_publish(onoff_topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + } + + return CHIP_NO_ERROR; +} + +template +bool attribute_translation(chip::ClusterId cluster_id, + chip::AttributeId attribute_id, + ConcreteAttributePath attribute_path, + chip::EndpointId matter_endpoint, + nlohmann::json payload) +{ + attribute_underlying_type value = payload; + attribute_state_cache::get_instance().set( + attribute_path, + value); + auto zcl_type = zcl_types_map.at(typeid(attribute_type)); + + MatterReportingAttributeChangeCallback(matter_endpoint, + cluster_id, + attribute_id, + zcl_type, + reinterpret_cast(&value)); + return true; +} + +void LevelAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + if (!cluster_id.has_value() || (cluster_id.value() != LevelControl::Id)) { + return; + } + auto attribute_id + = device_translator::instance().get_attribute_id(cluster, attribute); + + if (!attribute_id.has_value()) { + return; + } + + //handler basic cluster attributes + chip::EndpointId matter_endpoint = ep->matter_endpoint; + ConcreteAttributePath attribute_path + = ConcreteAttributePath(matter_endpoint, + LevelControl::Id, + attribute_id.value()); + try { + switch (attribute_id.value()) { + case Attributes::CurrentLevel::Id: { + attribute_translation( + LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + break; + } + case Attributes::RemainingTime::Id: { + attribute_translation( + LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + break; + } + case Attributes::MinLevel::Id: { + attribute_translation( + LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + break; + } + case Attributes::MaxLevel::Id: { + attribute_translation( + LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + } + case Attributes::CurrentFrequency::Id: { + attribute_translation( + LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + } + case Attributes::MinFrequency::Id: { + attribute_translation( + LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + } + case Attributes::MaxFrequency::Id: { + attribute_translation( + LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + } + case Attributes::OnOffTransitionTime::Id: { + attribute_translation( + LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + } + case Attributes::OnLevel::Id: { + attribute_translation< + Attributes::OnLevel::TypeInfo::Type::UnderlyingType, + Attributes::OnLevel::TypeInfo::Type>(LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + } + case Attributes::OnTransitionTime::Id: { + attribute_translation< + Attributes::OnTransitionTime::TypeInfo::Type::UnderlyingType, + Attributes::OnTransitionTime::TypeInfo::Type>(LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + } + case Attributes::OffTransitionTime::Id: { + attribute_translation< + Attributes::OffTransitionTime::TypeInfo::Type::UnderlyingType, + Attributes::OffTransitionTime::TypeInfo::Type>(LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + } + case Attributes::DefaultMoveRate::Id: { + attribute_translation< + Attributes::DefaultMoveRate::TypeInfo::Type::UnderlyingType, + Attributes::DefaultMoveRate::TypeInfo::Type>(LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + } + case Attributes::Options::Id: { + attribute_translation( + LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + } + case Attributes::StartUpCurrentLevel::Id: { + attribute_translation< + Attributes::StartUpCurrentLevel::TypeInfo::Type::UnderlyingType, + Attributes::StartUpCurrentLevel::TypeInfo::Type>(LevelControl::Id, + attribute_id.value(), + attribute_path, + matter_endpoint, + unify_value); + } + } + } catch (const nlohmann::json::type_error &e) { + sl_log_info(LOG_TAG, + "Failed parsing incoming attribute the value of different type " + "or key is not present, %s\n. Payload: %s", + e.what(), + unify_value.dump().c_str()); + } +} \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_attribute_translator.hpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_attribute_translator.hpp new file mode 100644 index 00000000000000..dfed20d1f63d5e --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_attribute_translator.hpp @@ -0,0 +1,64 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @defgroup level_attribute_translator + * @brief Level attribute translator for matter interface + * + * Translates attributes from matter to unify and unify to matter. + * + * @{ + */ + +#ifndef LEVEL_ATTRIBUTE_TRANSLATOR_HPP +#define LEVEL_ATTRIBUTE_TRANSLATOR_HPP + +#include "attribute_translator_interface.hpp" + +namespace unify::matter_bridge +{ +class LevelAttributeAccess : public attribute_translator_interface +{ + public: + LevelAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::LevelControl::Id) + {} + + CHIP_ERROR Read(const chip::app::ConcreteReadAttributePath &aPath, + chip::app::AttributeValueEncoder &aEncoder) override; + CHIP_ERROR Write(const chip::app::ConcreteDataAttributePath &aPath, + chip::app::AttributeValueDecoder &aDecoder) override; + + void + attributes_update_subscription(const bridged_endpoint &ep, + matter_node_state_monitor::update_t update); + + private: + CHIP_ERROR + ReadAttributeState(const chip::app::ConcreteReadAttributePath &aPath, + chip::app::AttributeValueEncoder &aEncoder); + + void reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) override; + std::vector unify_cluster_names() const override + { + return std::vector({"Level"}); + } +}; +} // namespace unify::matter_bridge + +#endif //LEVEL_ATTRIBUTE_TRANSLATOR_HPP + /** @} end level_attribute_translator */ \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_command_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_command_translator.cpp new file mode 100644 index 00000000000000..608631e3ace730 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_command_translator.cpp @@ -0,0 +1,300 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#include "level_command_translator.hpp" + +// Standard library +#include +#include +#include + +// Unify library +#include "uic_mqtt.h" +#include "sl_log.h" + +namespace Unify +{ +#include "dotdot_mqtt_send_commands.h" +} + +// Third party +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::LevelControl; +using namespace chip::DeviceLayer; +using namespace unify::matter_bridge; + +#define LOG_TAG "level_command_cluster_server" + +void set_command_handled_success(CommandHandlerInterface::HandlerContext &ctxt) +{ + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, + Protocols::InteractionModel::Status::Success); + ctxt.SetCommandHandled(); +} + +void set_command_handled_failed(CommandHandlerInterface::HandlerContext &ctxt) +{ + ctxt.mCommandHandler.AddStatus( + ctxt.mRequestPath, + Protocols::InteractionModel::Status::InvalidCommand); + ctxt.SetCommandHandled(); +} + +void LevelClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + auto unify_node + = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + + if (!unify_node) { + return; + } + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::MoveToLevel::Id: { + Commands::MoveToLevel::DecodableType move_to_level_command_data; + CHIP_ERROR TLVError + = DataModel::Decode(ctxt.GetReader(), move_to_level_command_data); + + if (!CHIP_ERROR::IsSuccess(TLVError)) { + set_command_handled_failed(ctxt); + sl_log_error(LOG_TAG, + "Failed processing MoveToLevel command on Level Cluster"); + return; + } + + Unify::uic_mqtt_dotdot_level_command_move_to_level_fields_t + move_to_level_fields; + move_to_level_fields.level = move_to_level_command_data.level; + move_to_level_fields.transition_time + = move_to_level_command_data.transitionTime; + move_to_level_fields.options_mask = move_to_level_command_data.optionMask; + move_to_level_fields.options_override + = move_to_level_command_data.optionOverride; + + send_unify_mqtt_command_with_callbacks< + const Unify::uic_mqtt_dotdot_level_command_move_to_level_fields_t *>( + ctxt, + &move_to_level_fields, + Unify::uic_mqtt_dotdot_level_publish_move_to_level_command, + Unify::uic_mqtt_dotdot_level_publish_move_to_level_command_to_group); + + set_command_handled_success(ctxt); + } break; + case Commands::Move::Id: { + Commands::Move::DecodableType move_command_data; + CHIP_ERROR TLVError + = DataModel::Decode(ctxt.GetReader(), move_command_data); + + if (!CHIP_ERROR::IsSuccess(TLVError)) { + set_command_handled_failed(ctxt); + sl_log_error(LOG_TAG, + "Failed processing Move command on Level Cluster"); + return; + } + + Unify::uic_mqtt_dotdot_level_command_move_fields_t move_fields; + move_fields.move_mode + = static_cast(move_command_data.moveMode); + move_fields.rate = move_command_data.rate; + move_fields.options_mask = move_command_data.optionMask; + move_fields.options_override = move_command_data.optionOverride; + + send_unify_mqtt_command_with_callbacks< + const Unify::uic_mqtt_dotdot_level_command_move_fields_t *>( + ctxt, + &move_fields, + Unify::uic_mqtt_dotdot_level_publish_move_command, + Unify::uic_mqtt_dotdot_level_publish_move_command_to_group); + set_command_handled_success(ctxt); + } break; + case Commands::Step::Id: { + Commands::Step::DecodableType step_command_data; + + CHIP_ERROR TLVError + = DataModel::Decode(ctxt.GetReader(), step_command_data); + + if (!CHIP_ERROR::IsSuccess(TLVError)) { + set_command_handled_failed(ctxt); + sl_log_error(LOG_TAG, + "Failed processing Step command on Level Cluster"); + return; + } + + Unify::uic_mqtt_dotdot_level_command_step_fields_t step_fields; + step_fields.step_mode + = static_cast(step_command_data.stepMode); + step_fields.step_size = step_command_data.stepSize; + step_fields.transition_time = step_command_data.transitionTime; + step_fields.options_mask = step_command_data.optionMask; + step_fields.options_override = step_command_data.optionOverride; + send_unify_mqtt_command_with_callbacks< + const Unify::uic_mqtt_dotdot_level_command_step_fields_t *>( + ctxt, + &step_fields, + Unify::uic_mqtt_dotdot_level_publish_step_command, + Unify::uic_mqtt_dotdot_level_publish_step_command_to_group); + set_command_handled_success(ctxt); + } break; + case Commands::Stop::Id: { + Commands::Stop::DecodableType stop_command_data; + CHIP_ERROR TLVError + = DataModel::Decode(ctxt.GetReader(), stop_command_data); + + if (!CHIP_ERROR::IsSuccess(TLVError)) { + set_command_handled_failed(ctxt); + sl_log_error(LOG_TAG, + "Failed processing Stop command on Level Cluster"); + return; + } + + Unify::uic_mqtt_dotdot_level_command_stop_fields_t stop_fields; + stop_fields.options_mask = stop_command_data.optionMask; + stop_fields.options_override = stop_command_data.optionOverride; + send_unify_mqtt_command_with_callbacks< + const Unify::uic_mqtt_dotdot_level_command_stop_fields_t *>( + ctxt, + &stop_fields, + Unify::uic_mqtt_dotdot_level_publish_stop_command, + Unify::uic_mqtt_dotdot_level_publish_stop_command_to_group); + set_command_handled_success(ctxt); + } break; + case Commands::MoveToLevelWithOnOff::Id: { + Commands::MoveToLevelWithOnOff::DecodableType + move_to_level_with_on_off_command_data; + CHIP_ERROR TLVError + = DataModel::Decode(ctxt.GetReader(), + move_to_level_with_on_off_command_data); + + if (!CHIP_ERROR::IsSuccess(TLVError)) { + set_command_handled_failed(ctxt); + sl_log_error( + LOG_TAG, + "Failed processing MoveToLevelWithOnOff command on Level Cluster"); + return; + } + + Unify::uic_mqtt_dotdot_level_command_move_to_level_with_on_off_fields_t + move_to_level_with_on_off_fields; + move_to_level_with_on_off_fields.level + = move_to_level_with_on_off_command_data.level; + move_to_level_with_on_off_fields.transition_time + = move_to_level_with_on_off_command_data.transitionTime; + move_to_level_with_on_off_fields.options_mask = 0; + move_to_level_with_on_off_fields.options_override = 0; + send_unify_mqtt_command_with_callbacks< + const Unify:: + uic_mqtt_dotdot_level_command_move_to_level_with_on_off_fields_t *>( + ctxt, + &move_to_level_with_on_off_fields, + Unify::uic_mqtt_dotdot_level_publish_move_to_level_with_on_off_command, + Unify:: + uic_mqtt_dotdot_level_publish_move_to_level_with_on_off_command_to_group); + set_command_handled_success(ctxt); + } break; + case Commands::MoveWithOnOff::Id: { + Commands::MoveWithOnOff::DecodableType move_with_on_off_command_data; + CHIP_ERROR TLVError + = DataModel::Decode(ctxt.GetReader(), move_with_on_off_command_data); + + if (!CHIP_ERROR::IsSuccess(TLVError)) { + set_command_handled_failed(ctxt); + sl_log_error( + LOG_TAG, + "Failed processing MoveWithOnOff command on Level Cluster"); + return; + } + + Unify::uic_mqtt_dotdot_level_command_move_with_on_off_fields_t + move_with_on_off_fields; + move_with_on_off_fields.move_mode = static_cast( + move_with_on_off_command_data.moveMode); + move_with_on_off_fields.rate = move_with_on_off_command_data.rate; + move_with_on_off_fields.options_mask = 0; + move_with_on_off_fields.options_override = 0; + send_unify_mqtt_command_with_callbacks< + const Unify::uic_mqtt_dotdot_level_command_move_with_on_off_fields_t *>( + ctxt, + &move_with_on_off_fields, + Unify::uic_mqtt_dotdot_level_publish_move_with_on_off_command, + Unify::uic_mqtt_dotdot_level_publish_move_with_on_off_command_to_group); + set_command_handled_success(ctxt); + } break; + case Commands::StepWithOnOff::Id: { + Commands::StepWithOnOff::DecodableType step_with_on_off_command_data; + CHIP_ERROR TLVError + = DataModel::Decode(ctxt.GetReader(), step_with_on_off_command_data); + + if (!CHIP_ERROR::IsSuccess(TLVError)) { + set_command_handled_failed(ctxt); + sl_log_error( + LOG_TAG, + "Failed processing StepWithOnOff command on Level Cluster"); + return; + } + + Unify::uic_mqtt_dotdot_level_command_step_with_on_off_fields_t + step_with_on_off_fields; + step_with_on_off_fields.step_mode = static_cast( + step_with_on_off_command_data.stepMode); + step_with_on_off_fields.step_size + = step_with_on_off_command_data.stepSize; + step_with_on_off_fields.transition_time + = step_with_on_off_command_data.transitionTime; + + send_unify_mqtt_command_with_callbacks< + const Unify::uic_mqtt_dotdot_level_command_step_with_on_off_fields_t *>( + ctxt, + &step_with_on_off_fields, + Unify::uic_mqtt_dotdot_level_publish_step_with_on_off_command, + Unify::uic_mqtt_dotdot_level_publish_step_with_on_off_command_to_group); + + set_command_handled_success(ctxt); + } break; + case Commands::StopWithOnOff::Id: { + Commands::StopWithOnOff::DecodableType stop_with_on_off_command_data; + CHIP_ERROR TLVError + = DataModel::Decode(ctxt.GetReader(), stop_with_on_off_command_data); + + if (!CHIP_ERROR::IsSuccess(TLVError)) { + set_command_handled_failed(ctxt); + sl_log_error( + LOG_TAG, + "Failed processing StopWithOnOff command on Level Cluster"); + return; + } + + Unify::uic_mqtt_dotdot_level_command_stop_with_on_off_fields_t + stop_with_on_off_fields; + stop_with_on_off_fields.options_mask = 0; + stop_with_on_off_fields.options_override = 0; + + send_unify_mqtt_command_with_callbacks< + const Unify::uic_mqtt_dotdot_level_command_stop_with_on_off_fields_t *>( + ctxt, + &stop_with_on_off_fields, + Unify::uic_mqtt_dotdot_level_publish_stop_with_on_off_command, + Unify::uic_mqtt_dotdot_level_publish_stop_with_on_off_command_to_group); + set_command_handled_success(ctxt); + } break; + default: { + sl_log_error(LOG_TAG, + "Unsupported command on Level Cluster: %d", + ctxt.mRequestPath.mCommandId); + return; + } + } +} diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_command_translator.hpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_command_translator.hpp new file mode 100644 index 00000000000000..5a5cbdbe10d550 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_command_translator.hpp @@ -0,0 +1,47 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @defgroup level_command_translator + * @brief Level command translator for matter interface + * + * Translates commands from matter to unify and unify to matter. + * + * @{ + */ + +#ifndef LEVEL_COMMAND_TRANSLATOR_HPP +#define LEVEL_COMMAND_TRANSLATOR_HPP + +#pragma once +#include "matter.h" +#include "command_translator_interface.hpp" + +namespace unify::matter_bridge +{ +class LevelClusterCommandHandler : public command_translator_interface +{ + public: + LevelClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor) : + command_translator_interface( + node_state_monitor, chip::app::Clusters::LevelControl::Id, "Groups") + {} + // CommandHandlerInterface + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &handlerContext) override; +}; +} // namespace unify::matter_bridge + +#endif //LEVEL_COMMAND_TRANSLATOR_HPP + /** @} end level_command_translator */ \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.cpp new file mode 100644 index 00000000000000..c309399481152b --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.cpp @@ -0,0 +1,262 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +/**************************************************************************** + * @file + * @brief Implementation for the OnOff Server Cluster + ***************************************************************************/ +#include +#include +#include +#include "matter.h" + +#include +#include "on_off_attribute_translator.hpp" +#include "matter_device_translator.hpp" +#include "uic_mqtt.h" +#include "sl_log.h" + +#define LOG_TAG "on_off_cluster_server" + +using namespace std; +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::OnOff; +using namespace chip::app::Clusters::OnOff::Attributes; +using namespace unify::matter_bridge; + +CHIP_ERROR +OnOffAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + if (aPath.mClusterId != Clusters::OnOff::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + return ReadAttributeState(aPath, aEncoder); +} + +CHIP_ERROR OnOffAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + if (aPath.mClusterId != Clusters::OnOff::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto unify_node = m_node_state_monitor.bridged_endpoint(aPath.mEndpointId); + + if (!unify_node) { + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + std::string attribute_name; + nlohmann::json jsn; + switch (aPath.mAttributeId) { + case Attributes::OnOff::Id: { + sl_log_info(LOG_TAG, "OnOff attribute is not writable.\n"); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + case Attributes::OnTime::Id: { + Attributes::OnTime::TypeInfo::DecodableType on_time_payload; + aDecoder.Decode(on_time_payload); + jsn["value"] = on_time_payload; + attribute_name = string("OnTime"); + break; + } + case Attributes::OffWaitTime::Id: { + Attributes::OffWaitTime::TypeInfo::DecodableType off_wait_time_value; + aDecoder.Decode(off_wait_time_value); + jsn["value"] = off_wait_time_value; + attribute_name = string("OffWaitTime"); + break; + } + case Attributes::StartUpOnOff::Id: { + OnOffStartUpOnOff start_up_on_off_value{OnOffStartUpOnOff::kOff}; + aDecoder.Decode(start_up_on_off_value); + jsn["value"] = start_up_on_off_value; + attribute_name = string("StartUpOnOff"); + break; + } + case Attributes::GlobalSceneControl::Id: { + Attributes::GlobalSceneControl::TypeInfo::DecodableType + global_scene_control_value; + aDecoder.Decode(global_scene_control_value); + jsn["value"] = global_scene_control_value; + attribute_name = string("GlobalSceneControl"); + break; + } + default: + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + if (!attribute_name.empty()) { + std::string onoff_topic; + std::string payload_str; + onoff_topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/OnOff/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(onoff_topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR OnOffAttributeAccess::ReadAttributeState( + const ConcreteReadAttributePath &aPath, AttributeValueEncoder &aEncoder) +{ + sl_log_info(LOG_TAG, "read %i\n", aPath.mEndpointId); + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + try { + switch (aPath.mAttributeId) { + case Attributes::OnOff::Id: { + Attributes::OnOff::TypeInfo::Type read_on_off_attr_state + = attribute_state_cache::get_instance() + .get(atrpath); + return aEncoder.Encode(read_on_off_attr_state); + } + case Attributes::OnTime::Id: { + Attributes::OnTime::TypeInfo::Type read_on_time_attr_state + = attribute_state_cache::get_instance() + .get(atrpath); + return aEncoder.Encode(read_on_time_attr_state); + } + case Attributes::StartUpOnOff::Id: { + uint8_t read_start_up_on_off_attr_state + = attribute_state_cache::get_instance().get(atrpath); + return aEncoder.Encode(read_start_up_on_off_attr_state); + } + case Attributes::OffWaitTime::Id: { + Attributes::OffWaitTime::TypeInfo::Type read_off_wait_time_attr_state + = attribute_state_cache::get_instance() + .get(atrpath); + return aEncoder.Encode(read_off_wait_time_attr_state); + } + case Attributes::GlobalSceneControl::Id: { + Attributes::GlobalSceneControl::TypeInfo::Type + read_global_scene_attr_state + = attribute_state_cache::get_instance() + .get(atrpath); + return aEncoder.Encode(read_global_scene_attr_state); + } + default: + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + } catch (const std::out_of_range &e) { + sl_log_info( + LOG_TAG, + "The request attribute Path is not found in the attribute state " + "contanier, %s\n", + e.what()); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } +} + +void OnOffAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::OnOff::Id)) { + return; + } + + // get attribute id + auto attribute_id + = device_translator::instance().get_attribute_id(cluster, attribute); + + if (!attribute_id.has_value()) { + return; + } + + chip::EndpointId node_matter_endpoint = ep->matter_endpoint; + ConcreteAttributePath attrpath = ConcreteAttributePath(node_matter_endpoint, + Clusters::OnOff::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + case Attributes::OnOff::Id: { + Attributes::OnOff::TypeInfo::Type value = unify_value; + sl_log_debug(LOG_TAG, + "OnOff attribute value is %s", + value ? "On" : "Off"); + attribute_state_cache::get_instance() + .set(attrpath, value); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + Attributes::OnOff::Id, + + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value)); + break; + } + case Attributes::OnTime::Id: { + Attributes::OnTime::TypeInfo::Type value = unify_value; + attribute_state_cache::get_instance() + .set(attrpath, value); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + Attributes::OnTime::Id, + + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value)); + break; + } + case Attributes::OffWaitTime::Id: { + Attributes::OffWaitTime::TypeInfo::Type value = unify_value; + attribute_state_cache::get_instance() + .set(attrpath, value); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + Attributes::OffWaitTime::Id, + + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value)); + break; + } + case Attributes::StartUpOnOff::Id: { + uint8_t value = unify_value; + attribute_state_cache::get_instance().set(attrpath, value); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + Attributes::StartUpOnOff::Id, + + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value)); + break; + } + case Attributes::GlobalSceneControl::Id: { + Attributes::GlobalSceneControl::TypeInfo::Type value = unify_value; + attribute_state_cache::get_instance() + .set(attrpath, value); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + Attributes::GlobalSceneControl::Id, + + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value)); + break; + } + } +} \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.hpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.hpp new file mode 100644 index 00000000000000..20ba777ccc4517 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.hpp @@ -0,0 +1,53 @@ +/****************************************************************************** + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @file on_off_attribute_translator.h + * @ingroup components + * + * @brief OnOff cluster attribute state transition handler + * + * @{ + */ + +#include "attribute_translator_interface.hpp" + +namespace unify::matter_bridge +{ +class OnOffAttributeAccess : public attribute_translator_interface +{ + public: + OnOffAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::OnOff::Id) + {} + + CHIP_ERROR Read(const chip::app::ConcreteReadAttributePath &aPath, + chip::app::AttributeValueEncoder &aEncoder) override; + CHIP_ERROR Write(const chip::app::ConcreteDataAttributePath &aPath, + chip::app::AttributeValueDecoder &aDecoder) override; + + private: + CHIP_ERROR + ReadAttributeState(const chip::app::ConcreteReadAttributePath &aPath, + chip::app::AttributeValueEncoder &aEncoder); + + void reported_updated(const bridged_endpoint *ep, + const std::string& cluster, + const std::string& attribute, + const nlohmann::json &unify_value) override; + + std::vector unify_cluster_names() const override {return std::vector({ "OnOff" });} +}; + +} // namespace unify::matter_bridge \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_command_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_command_translator.cpp new file mode 100644 index 00000000000000..3936b539c6efce --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_command_translator.cpp @@ -0,0 +1,56 @@ +/******************************************************************************* + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + ******************************************************************************/ +#include "on_off_command_translator.h" +#include +#include +#include +#include "sl_log.h" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::OnOff; +using namespace chip::DeviceLayer; +using namespace unify::matter_bridge; + +#define LOG_TAG "on_off_cluster_server" + +void OnOffClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + std::string cmd; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::On::Id: + cmd = "On"; + break; + case Commands::Off::Id: + cmd = "Off"; + break; + case Commands::Toggle::Id: + cmd = "Toggle"; + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt,cmd, nlohmann::json() ); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + + + diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_command_translator.h b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_command_translator.h new file mode 100644 index 00000000000000..262889c620e923 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_command_translator.h @@ -0,0 +1,38 @@ +/****************************************************************************** + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @file on_off_command_translator.h + * @ingroup components + * + * @brief OnOff cluster command handler for matter interface + * + * @{ + */ +#pragma once +#include "matter.h" +#include "command_translator_interface.hpp" + +namespace unify::matter_bridge +{ +class OnOffClusterCommandHandler : public command_translator_interface +{ + public: + OnOffClusterCommandHandler(const matter_node_state_monitor& node_state_monitor) : command_translator_interface(node_state_monitor,chip::app::Clusters::OnOff::Id,"OnOff") {} + // CommandHandlerInterface + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &handlerContext) override; + +}; + +} // namespace unify::matter_bridge \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/demo_uic_cli.cpp b/silabs_examples/unify-matter-bridge/linux/src/demo_uic_cli.cpp new file mode 100644 index 00000000000000..d1eb2f3c7171e7 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/demo_uic_cli.cpp @@ -0,0 +1,52 @@ +/****************************************************************************** + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +#include "demo_uic_cli.h" + +// UIC components +#include "sl_log.h" +#include "uic_stdin.hpp" + +/// File descripter for output stream +static int out_stream; + +// UIC demo application pre decleration of application commands functions +static sl_status_t handle_demo(const handle_args_t & arg); + +#define LOG_TAG "demo_uic_cli" + +// Command map +const std::map> commands = { + { "demo_command", { "Demo command doing nothing but adding a command to base CLI", handle_demo } } +}; + +// Public +void demo_uic_cli_setup() +{ + uic_stdin_add_commands(commands); + uic_stdin_set_prompt_string("DEMO_UIC> "); + out_stream = uic_stdin_get_output_fd(); +} + +// Internal +static sl_status_t handle_demo(const handle_args_t & arg) +{ + sl_log_debug(LOG_TAG, "UIC demo CLI printing args"); + + for (auto it = arg.begin(); it != arg.end(); ++it) + { + printf("arg: %s\n", it->c_str()); + } + + return SL_STATUS_OK; +} diff --git a/silabs_examples/unify-matter-bridge/linux/src/demo_uic_cli.h b/silabs_examples/unify-matter-bridge/linux/src/demo_uic_cli.h new file mode 100644 index 00000000000000..b77f62950e062c --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/demo_uic_cli.h @@ -0,0 +1,43 @@ +/****************************************************************************** + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @file zpc_stdin_command_handling.h + * @brief TODO: Write brief for zpc_stdin_command_handling + * + * TODO: Write component description for zpc_stdin_command_handling + * + * @{ + */ + +#ifndef DEMO_UIC_CLI_H +#define DEMO_UIC_CLI_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sl_status.h" + +/** + * @brief Add command line interface commands to the Unify process. + * + */ +void demo_uic_cli_setup(); + +#ifdef __cplusplus +} +#endif + +#endif // DEMO_UIC_CLI_H +/** @} end demo_uic_cli */ diff --git a/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_mapper.inc b/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_mapper.inc new file mode 100644 index 00000000000000..2cf8b0f3c541f2 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_mapper.inc @@ -0,0 +1,358 @@ +/****************************************************************************** + * # License + * Copyright 2021 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +// This file is generated automatically. Don't try to change something here. +// To add support for new clusters, modify addon-helper.js in uic/applications/matter_bridge/src/zap + +// Component include +#include + +// Standard library +#include +#include +#include + +// Matter includes +#include +#include +#include + +// Cluster mapping Unify->Matter conversion +namespace chip { +namespace app { +namespace Clusters { + +static const std::unordered_map unify_cluster_id_map { + { "Identify", Identify::Id}, + { "Groups", Groups::Id}, + { "Scenes", Scenes::Id}, + { "OnOff", OnOff::Id}, + { "Level", LevelControl::Id}, + { "FanControl", FanControl::Id}, + { "ColorControl", ColorControl::Id}, + { "IlluminanceMeasurement", IlluminanceMeasurement::Id}, + { "TemperatureMeasurement", TemperatureMeasurement::Id}, + { "PressureMeasurement", PressureMeasurement::Id}, + { "FlowMeasurement", FlowMeasurement::Id}, + { "OccupancySensing", OccupancySensing::Id}, +}; + +// Attribute mapping Unify->Matter conversion +// Attribute structure for each cluster +namespace Identify { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "IdentifyTime", IdentifyTime::Id } +}; +} // namespace Attributes +} // namespace Identify +namespace Groups { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "NameSupport", NameSupport::Id } +}; +} // namespace Attributes +} // namespace Groups +namespace Scenes { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "SceneCount", SceneCount::Id }, + { "CurrentScene", CurrentScene::Id }, + { "CurrentGroup", CurrentGroup::Id }, + { "SceneValid", SceneValid::Id }, + { "NameSupport", NameSupport::Id }, + { "LastConfiguredBy", LastConfiguredBy::Id } +}; +} // namespace Attributes +} // namespace Scenes +namespace OnOff { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "OnOff", OnOff::Id }, + { "GlobalSceneControl", GlobalSceneControl::Id }, + { "OnTime", OnTime::Id }, + { "OffWaitTime", OffWaitTime::Id }, + { "StartUpOnOff", StartUpOnOff::Id } +}; +} // namespace Attributes +} // namespace OnOff +namespace LevelControl { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "CurrentLevel", CurrentLevel::Id }, + { "RemainingTime", RemainingTime::Id }, + { "MinLevel", MinLevel::Id }, + { "MaxLevel", MaxLevel::Id }, + { "CurrentFrequency", CurrentFrequency::Id }, + { "MinFrequency", MinFrequency::Id }, + { "MaxFrequency", MaxFrequency::Id }, + { "Options", Options::Id }, + { "OnOffTransitionTime", OnOffTransitionTime::Id }, + { "OnLevel", OnLevel::Id }, + { "OnTransitionTime", OnTransitionTime::Id }, + { "OffTransitionTime", OffTransitionTime::Id }, + { "DefaultMoveRate", DefaultMoveRate::Id }, + { "StartUpCurrentLevel", StartUpCurrentLevel::Id } +}; +} // namespace Attributes +} // namespace Level +namespace FanControl { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "FanMode", FanMode::Id }, + { "FanModeSequence", FanModeSequence::Id } +}; +} // namespace Attributes +} // namespace FanControl +namespace ColorControl { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "CurrentHue", CurrentHue::Id }, + { "CurrentSaturation", CurrentSaturation::Id }, + { "RemainingTime", RemainingTime::Id }, + { "CurrentX", CurrentX::Id }, + { "CurrentY", CurrentY::Id }, + { "DriftCompensation", DriftCompensation::Id }, + { "CompensationText", CompensationText::Id }, + { "ColorTemperatureMireds", ColorTemperature::Id }, + { "ColorMode", ColorMode::Id }, + { "NumberOfPrimaries", NumberOfPrimaries::Id }, + { "Primary1X", Primary1X::Id }, + { "Primary1Y", Primary1Y::Id }, + { "Primary1Intensity", Primary1Intensity::Id }, + { "Primary2X", Primary2X::Id }, + { "Primary2Y", Primary2Y::Id }, + { "Primary2Intensity", Primary2Intensity::Id }, + { "Primary3X", Primary3X::Id }, + { "Primary3Y", Primary3Y::Id }, + { "Primary3Intensity", Primary3Intensity::Id }, + { "Primary4X", Primary4X::Id }, + { "Primary4Y", Primary4Y::Id }, + { "Primary4Intensity", Primary4Intensity::Id }, + { "Primary5X", Primary5X::Id }, + { "Primary5Y", Primary5Y::Id }, + { "Primary5Intensity", Primary5Intensity::Id }, + { "Primary6X", Primary6X::Id }, + { "Primary6Y", Primary6Y::Id }, + { "Primary6Intensity", Primary6Intensity::Id }, + { "WhitePointX", WhitePointX::Id }, + { "WhitePointY", WhitePointY::Id }, + { "ColorPointRX", ColorPointRX::Id }, + { "ColorPointRY", ColorPointRY::Id }, + { "ColorPointRIntensity", ColorPointRIntensity::Id }, + { "ColorPointGX", ColorPointGX::Id }, + { "ColorPointGY", ColorPointGY::Id }, + { "ColorPointGIntensity", ColorPointGIntensity::Id }, + { "ColorPointBX", ColorPointBX::Id }, + { "ColorPointBY", ColorPointBY::Id }, + { "ColorPointBIntensity", ColorPointBIntensity::Id }, + { "EnhancedCurrentHue", EnhancedCurrentHue::Id }, + { "EnhancedColorMode", EnhancedColorMode::Id }, + { "ColorLoopActive", ColorLoopActive::Id }, + { "ColorLoopDirection", ColorLoopDirection::Id }, + { "ColorLoopTime", ColorLoopTime::Id }, + { "ColorLoopStartEnhancedHue", ColorLoopStartEnhancedHue::Id }, + { "ColorLoopStoredEnhancedHue", ColorLoopStoredEnhancedHue::Id }, + { "ColorCapabilities", ColorCapabilities::Id }, + { "ColorTempPhysicalMinMireds", ColorTempPhysicalMinMireds::Id }, + { "ColorTempPhysicalMaxMireds", ColorTempPhysicalMaxMireds::Id }, + { "CoupleColorTempToLevelMinMireds", CoupleColorTempToLevelMinMireds::Id }, + { "StartUpColorTemperatureMireds", StartUpColorTemperatureMireds::Id } +}; +} // namespace Attributes +} // namespace ColorControl +namespace IlluminanceMeasurement { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "MeasuredValue", MeasuredValue::Id }, + { "MinMeasuredValue", MinMeasuredValue::Id }, + { "MaxMeasuredValue", MaxMeasuredValue::Id }, + { "Tolerance", Tolerance::Id }, + { "LightSensorType", LightSensorType::Id } +}; +} // namespace Attributes +} // namespace IlluminanceMeasurement +namespace TemperatureMeasurement { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "MeasuredValue", MeasuredValue::Id }, + { "MinMeasuredValue", MinMeasuredValue::Id }, + { "MaxMeasuredValue", MaxMeasuredValue::Id }, + { "Tolerance", Tolerance::Id } +}; +} // namespace Attributes +} // namespace TemperatureMeasurement +namespace PressureMeasurement { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "MeasuredValue", MeasuredValue::Id }, + { "MinMeasuredValue", MinMeasuredValue::Id }, + { "MaxMeasuredValue", MaxMeasuredValue::Id }, + { "Tolerance", Tolerance::Id }, + { "ScaledValue", ScaledValue::Id }, + { "MinScaledValue", MinScaledValue::Id }, + { "MaxScaledValue", MaxScaledValue::Id }, + { "ScaledTolerance", ScaledTolerance::Id }, + { "Scale", Scale::Id } +}; +} // namespace Attributes +} // namespace PressureMeasurement +namespace FlowMeasurement { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "MeasuredValue", MeasuredValue::Id }, + { "MinMeasuredValue", MinMeasuredValue::Id }, + { "MaxMeasuredValue", MaxMeasuredValue::Id }, + { "Tolerance", Tolerance::Id } +}; +} // namespace Attributes +} // namespace FlowMeasurement +namespace OccupancySensing { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "Occupancy", Occupancy::Id }, + { "OccupancySensorType", OccupancySensorType::Id }, + { "OccupancySensorTypeBitmap", OccupancySensorTypeBitmap::Id }, + { "PirOccupiedToUnoccupiedDelay", PirOccupiedToUnoccupiedDelay::Id }, + { "PirUnoccupiedToOccupiedDelay", PirUnoccupiedToOccupiedDelay::Id }, + { "PirUnoccupiedToOccupiedThreshold", PirUnoccupiedToOccupiedThreshold::Id }, + { "UltrasonicOccupiedToUnoccupiedDelay", UltrasonicOccupiedToUnoccupiedDelay::Id }, + { "UltrasonicUnoccupiedToOccupiedDelay", UltrasonicUnoccupiedToOccupiedDelay::Id }, + { "UltrasonicUnoccupiedToOccupiedThreshold", UltrasonicUnoccupiedToOccupiedThreshold::Id }, + { "PhysicalContactOccupiedToUnoccupiedDelay", PhysicalContactOccupiedToUnoccupiedDelay::Id }, + { "PhysicalContactUnoccupiedToOccupiedDelay", PhysicalContactUnoccupiedToOccupiedDelay::Id }, + { "PhysicalContactUnoccupiedToOccupiedThreshold", PhysicalContactUnoccupiedToOccupiedThreshold::Id } +}; +} // namespace Attributes +} // namespace OccupancySensing + +// Global map of each clusters attributes +static const std::unordered_map> unify_to_matter_attribute_id_map { + { "Identify", Identify::Attributes::unify_to_matter_attribute_id_cluster_map }, + { "Groups", Groups::Attributes::unify_to_matter_attribute_id_cluster_map }, + { "Scenes", Scenes::Attributes::unify_to_matter_attribute_id_cluster_map }, + { "OnOff", OnOff::Attributes::unify_to_matter_attribute_id_cluster_map }, + { "Level", LevelControl::Attributes::unify_to_matter_attribute_id_cluster_map }, + { "FanControl", FanControl::Attributes::unify_to_matter_attribute_id_cluster_map }, + { "ColorControl", ColorControl::Attributes::unify_to_matter_attribute_id_cluster_map }, + { "IlluminanceMeasurement", IlluminanceMeasurement::Attributes::unify_to_matter_attribute_id_cluster_map }, + { "TemperatureMeasurement", TemperatureMeasurement::Attributes::unify_to_matter_attribute_id_cluster_map }, + { "PressureMeasurement", PressureMeasurement::Attributes::unify_to_matter_attribute_id_cluster_map }, + { "FlowMeasurement", FlowMeasurement::Attributes::unify_to_matter_attribute_id_cluster_map }, + { "OccupancySensing", OccupancySensing::Attributes::unify_to_matter_attribute_id_cluster_map }, +}; + + +// Command mapping Unify->Matter conversion +// Command structure for each cluster +namespace Identify { +namespace Commands { +static const std::unordered_map unify_to_matter_command_id_cluster_map { + { "Identify", Identify::Id }, + { "TriggerEffect", TriggerEffect::Id } +}; +} // namespace Commands +} // namespace Identify +namespace Groups { +namespace Commands { +static const std::unordered_map unify_to_matter_command_id_cluster_map { + { "AddGroup", AddGroup::Id }, + { "ViewGroup", ViewGroup::Id }, + { "GetGroupMembership", GetGroupMembership::Id }, + { "RemoveGroup", RemoveGroup::Id }, + { "RemoveAllGroups", RemoveAllGroups::Id }, + { "AddGroupIfIdentifying", AddGroupIfIdentifying::Id } +}; +} // namespace Commands +} // namespace Groups +namespace Scenes { +namespace Commands { +static const std::unordered_map unify_to_matter_command_id_cluster_map { + { "AddScene", AddScene::Id }, + { "ViewScene", ViewScene::Id }, + { "RemoveScene", RemoveScene::Id }, + { "RemoveAllScenes", RemoveAllScenes::Id }, + { "StoreScene", StoreScene::Id }, + { "RecallScene", RecallScene::Id }, + { "GetSceneMembership", GetSceneMembership::Id }, + { "EnhancedAddScene", EnhancedAddScene::Id }, + { "EnhancedViewScene", EnhancedViewScene::Id }, + { "CopyScene", CopyScene::Id }, +}; +} // namespace Commands +} // namespace Scenes +namespace OnOff { +namespace Commands { +static const std::unordered_map unify_to_matter_command_id_cluster_map { + { "Off", Off::Id }, + { "On", On::Id }, + { "Toggle", Toggle::Id }, + { "OffWithEffect", OffWithEffect::Id }, + { "OnWithRecallGlobalScene", OnWithRecallGlobalScene::Id }, + { "OnWithTimedOff", OnWithTimedOff::Id } +}; +} // namespace Commands +} // namespace OnOff +namespace LevelControl { +namespace Commands { +static const std::unordered_map unify_to_matter_command_id_cluster_map { + { "MoveToLevel", MoveToLevel::Id }, + { "Move", Move::Id }, + { "Step", Step::Id }, + { "Stop", Stop::Id }, + { "MoveToLevelWithOnOff", MoveToLevelWithOnOff::Id }, + { "MoveWithOnOff", MoveWithOnOff::Id }, + { "StepWithOnOff", StepWithOnOff::Id }, + { "StopWithOnOff", StopWithOnOff::Id }, +}; +} // namespace Commands +} // namespace Level +namespace ColorControl { +namespace Commands { +static const std::unordered_map unify_to_matter_command_id_cluster_map { + { "MoveToHue", MoveToHue::Id }, + { "MoveHue", MoveHue::Id }, + { "StepHue", StepHue::Id }, + { "MoveToSaturation", MoveToSaturation::Id }, + { "MoveSaturation", MoveSaturation::Id }, + { "StepSaturation", StepSaturation::Id }, + { "MoveToHueAndSaturation", MoveToHueAndSaturation::Id }, + { "MoveToColor", MoveToColor::Id }, + { "MoveColor", MoveColor::Id }, + { "StepColor", StepColor::Id }, + { "MoveToColorTemperature", MoveToColorTemperature::Id }, + { "EnhancedMoveToHue", EnhancedMoveToHue::Id }, + { "EnhancedMoveHue", EnhancedMoveHue::Id }, + { "EnhancedStepHue", EnhancedStepHue::Id }, + { "EnhancedMoveToHueAndSaturation", EnhancedMoveToHueAndSaturation::Id }, + { "ColorLoopSet", ColorLoopSet::Id }, + { "StopMoveStep", StopMoveStep::Id }, + { "MoveColorTemperature", MoveColorTemperature::Id }, + { "StepColorTemperature", StepColorTemperature::Id } +}; +} // namespace Commands +} // namespace ColorControl + +// Global map of each clusters commands +static const std::unordered_map> unify_to_matter_command_id_map { + { "Identify", Identify::Commands::unify_to_matter_command_id_cluster_map }, + { "Groups", Groups::Commands::unify_to_matter_command_id_cluster_map }, + { "Scenes", Scenes::Commands::unify_to_matter_command_id_cluster_map }, + { "OnOff", OnOff::Commands::unify_to_matter_command_id_cluster_map }, + { "Level", LevelControl::Commands::unify_to_matter_command_id_cluster_map }, + { "ColorControl", ColorControl::Commands::unify_to_matter_command_id_cluster_map }, +}; + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_translator.cpp new file mode 100644 index 00000000000000..d51968f79a7299 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_translator.cpp @@ -0,0 +1,179 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#include "matter_device_translator.hpp" +#include "matter_device_types_clusters_list_updated.inc" +#include "matter_device_mapper.inc" + +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; + + + +namespace unify::matter_bridge +{ +static uint8_t device_type_mapper_compare_cluster_lists( + const std::vector &unify_clusters, + const std::vector &matter_clusters) +{ + uint8_t count = 0; + for (const auto &unify_cluster: unify_clusters) { + // Find matching unify_cluster + const auto it + = std::find_if(matter_clusters.begin(), + matter_clusters.end(), + [unify_cluster](const char *matter_cluster) { + return strcmp(unify_cluster, matter_cluster) == 0; + }); + if (it != matter_clusters.end()) { + count = count + 1; + } + } + return count; +} + +/** + * @brief Cluster Score struct + * + * Holds the information on cluster scores used to determine possible device + * types in \ref get_device_types. + * + */ +struct cluster_score { + /// Number of unify clusters that didn't match matter clusters (0 means all + /// match). + unsigned int unify_miss_count; + /// Number of matter clusters that didn't match the unify clusters (0 means + /// all match). + unsigned int matter_miss_count; + chip::DeviceTypeId device_type_id; + cluster_score(unsigned int unify_miss_count, + unsigned int matter_miss_count, + chip::DeviceTypeId device_type_id) : + unify_miss_count(unify_miss_count), + matter_miss_count(matter_miss_count), + device_type_id(device_type_id) + {} +}; +/** + * The API provides possible matched matter device types from list of clusters. + */ +std::vector device_translator::get_device_types( + const std::vector &unify_cluster_list) const +{ + // contains scores that refelect if all list clusters present under a given + // device type + std::vector device_type_match_score; + + for (const auto &[matter_device_type_id, matter_device]: + matter_device_type_vs_clusters_map) { + uint8_t clusters_matched + = device_type_mapper_compare_cluster_lists(unify_cluster_list, + matter_device.first); + + unsigned int unify_miss_count + = unify_cluster_list.size() - clusters_matched; + unsigned int matter_miss_count + = matter_device.first.size() - clusters_matched; + device_type_match_score.emplace_back(unify_miss_count, + matter_miss_count, + matter_device_type_id); + } + std::sort(device_type_match_score.begin(), + device_type_match_score.end(), + [](const cluster_score &a, const cluster_score &b) { + // Sorting algorithm first sort based on unify_miss_count, if that + // match sort based on matter_miss_count. + if (a.unify_miss_count < b.unify_miss_count) { + return true; + } else if (b.unify_miss_count < a.unify_miss_count) { + return false; + } else { + // unify_miss_count match on a and b, now we sort based on + // matter_miss_count. + return a.matter_miss_count <= b.matter_miss_count; + } + }); + // Select possible device types based on score list. + std::vector possible_device_list; + const auto it_first = device_type_match_score.begin(); + if (it_first != device_type_match_score.end()) { + possible_device_list.push_back(it_first->device_type_id); + auto iter = it_first; + ++iter; + for (; iter != device_type_match_score.end(); ++iter) { + if ((it_first->unify_miss_count == iter->unify_miss_count) + && (it_first->matter_miss_count == iter->matter_miss_count)) { + possible_device_list.push_back(iter->device_type_id); + } + } + } + + return possible_device_list; +} + +std::optional + device_translator::get_device_name(chip::DeviceTypeId device_id) const +{ + const auto it = matter_device_type_vs_clusters_map.find(device_id); + if (it != matter_device_type_vs_clusters_map.end()) { + return it->second.second; + } else { + return std::nullopt; + } +} + +std::optional + device_translator::get_attribute_id(const std::string &cluster_name, + const std::string &attribute_name) const +{ + const auto attribute_map + = unify_to_matter_attribute_id_map.find(cluster_name); + if (attribute_map != unify_to_matter_attribute_id_map.end()) { + auto attribute_id = attribute_map->second.find(attribute_name); + if (attribute_id != attribute_map->second.end()) { + return attribute_id->second; + } + } + return std::nullopt; +} + +std::optional + device_translator::get_command_id(const std::string &cluster_name, + const std::string &command_name) const +{ + const auto command_map = unify_to_matter_command_id_map.find(cluster_name); + if (command_map != unify_to_matter_command_id_map.end()) { + const auto command_id = command_map->second.find(command_name); + if (command_id != command_map->second.end()) { + return command_id->second; + } + } + return std::nullopt; +} + +std::optional + device_translator::get_cluster_id(const std::string &cluster_name) const +{ + const auto cluster_map_iter = unify_cluster_id_map.find(cluster_name); + if (cluster_map_iter != unify_cluster_id_map.end()) { + return cluster_map_iter->second; + } + return std::nullopt; +} + +} // namespace unify::matter_bridge diff --git a/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_types_clusters_list.inc b/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_types_clusters_list.inc new file mode 100644 index 00000000000000..74858062668056 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_types_clusters_list.inc @@ -0,0 +1,61 @@ +// Following device type map is generated using matter_device_type_parse.py +#include +#include +#include +#include +static const std::map, const char *>> matter_device_type_vs_clusters_map = { + { 0x0000, {{"Basic", "Identify"}, "onoffswitch"} }, + { 0x0001, {{"Basic", "Identify"}, "levelcontrolswitch"} }, + { 0x0002, {{"Basic", "Identify", "OnOff", "Scenes", "Groups"}, "onnoffoutput"} }, + { 0x0003, {{"Basic", "Identify", "OnOff", "Level", "Scenes", "Groups"}, "levelcontrollableoutput"} }, + { 0x0004, {{"Basic", "Identify"}, "sceneselector"} }, + { 0x0005, {{"Basic", "Identify"}, "configurationtool"} }, + { 0x0006, {{"Basic", "Identify"}, "remotecontrol"} }, + { 0x0007, {{"Basic", "Identify"}, "combinedinterface"} }, + { 0x0008, {{"Basic", "Identify"}, "rangeextender"} }, + { 0x0009, {{"Basic", "Identify", "OnOff", "Scenes", "Groups"}, "mainspoweroutlet"} }, + { 0x000A, {{"Basic", "Identify", "DoorLock", "Scenes", "Groups"}, "doorlock"} }, + { 0x000B, {{"Basic", "Identify", "Time"}, "doorlockcontroller"} }, + { 0x000C, {{"Basic", "Identify", "Binary Input (Basic)"}, "simplesensor"} }, + { 0x000D, {{"Basic", "Identify", "Metering"}, "consumptionawarenessdevice"} }, + { 0x0050, {{"Basic", "Identify", "Time"}, "homegateway"} }, + { 0x0051, {{"Basic", "Identify", "OnOff", "Metering"}, "smartplug"} }, + { 0x0052, {{"Basic", "Identify", "Power Profile", "Appliance Statistics", "Appliance Control", "Appliance Identification", "Appliance Events and Alert"}, "whitegoods"} }, + { 0x0053, {{"Basic", "Identify", "Metering", "Meter Identification"}, "meterinterface"} }, + { 0x0200, {{"Basic", "Identify", "ShadeConfiguration", "OnOff", "Level", "Scenes", "Groups"}, "shade"} }, + { 0x0201, {{"Basic", "Identify"}, "shadecontroller"} }, + { 0x0202, {{"Basic", "Identify", "WindowCovering", "Scenes", "Groups"}, "windowcovering"} }, + { 0x0203, {{"Basic", "Identify"}, "windowcoveringcontroller"} }, + { 0x0300, {{"Basic", "Identify", "OnOff", "Thermostat"}, "heatingcoolingunit"} }, + { 0x0301, {{"Basic", "Identify", "Thermostat"}, "thermostat"} }, + { 0x0302, {{"Basic", "Identify", "TemperatureMeasurement"}, "tempsensor"} }, + { 0x0303, {{"Basic", "Identify", "PumpConfigurationAndControl", "OnOff", "Scenes", "Groups"}, "pump"} }, + { 0x0304, {{"Basic", "Identify"}, "pumpcontroller"} }, + { 0x0305, {{"Basic", "Identify", "PressureMeasurement"}, "pressuresensor"} }, + { 0x0306, {{"Basic", "Identify", "FlowMeasurement"}, "flowsensor"} }, + { 0x0400, {{"Basic", "Identify", "IASACE"}, "iascie"} }, + { 0x0401, {{"Basic", "Identify", "IASZone"}, "iasace"} }, + { 0x0402, {{"Basic", "Identify", "IASZone"}, "iaszone"} }, + { 0x0403, {{"Basic", "Identify", "IASWD", "IASZone"}, "iasW"} }, + { 0x0100, {{"Basic", "Identify", "Groups", "Scenes", "OnOff"}, "onofflight"} }, + { 0x0101, {{"Basic", "Identify", "Groups", "Scenes", "OnOff", "Level"}, "dimmablelight"} }, + { 0x0102, {{"Basic", "Identify", "Groups", "Scenes", "OnOff", "Level", "ColorControl"}, "colordimmablelight"} }, + { 0x0103, {{"Basic", "Identify"}, "onofflightswitch"} }, + { 0x0104, {{"Basic", "Identify"}, "dimmerswitch"} }, + { 0x0105, {{"Basic", "Identify"}, "colordimmerswitch"} }, + { 0x0106, {{"Basic", "Identify", "IlluminanceMeasurement"}, "lightsensor"} }, + { 0x0107, {{"Basic", "Identify", "OccupancySensing"}, "occupancysensor"} }, + { 0x0108, {{"Basic", "PowerConfiguration", "DeviceTemperatureConfiguration", "Identify", "Groups", "Scenes", "OnOff", "BallastConfiguration"}, "onoffballast"} }, + { 0x0109, {{"Basic", "PowerConfiguration", "DeviceTemperatureConfiguration", "Identify", "Groups", "Scenes", "OnOff", "BallastConfiguration", "Level"}, "dimmableballast"} }, + { 0x010A, {{"Basic", "Identify", "Groups", "Scenes", "OnOff"}, "onoffpluginunit"} }, + { 0x010B, {{"Basic", "Identify", "Groups", "Scenes", "OnOff", "Level"}, "dimmablepluginunit"} }, + { 0x010C, {{"Basic", "Identify", "Groups", "Scenes", "OnOff", "Level", "ColorControl"}, "colortemperaturelight"} }, + { 0x010D, {{"Basic", "Identify", "Groups", "Scenes", "OnOff", "Level", "ColorControl"}, "extendedcolorlight"} }, + { 0x010E, {{"Basic", "Identify", "IlluminanceLevelSensing"}, "lightlevelsensor"} }, + { 0x0800, {{"Basic", "Identify"}, "colorcontroller"} }, + { 0x0810, {{"Basic", "Identify"}, "colorscenecontroller"} }, + { 0x0820, {{"Basic", "Identify"}, "noncolorcontroller"} }, + { 0x0830, {{"Basic", "Identify"}, "noncolorscenecontroller"} }, + { 0x0840, {{"Basic", "Identify"}, "controlbridge"} }, + { 0x0850, {{"Basic", "Identify"}, "onoffsensor"} } +}; \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_types_clusters_list_updated.inc b/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_types_clusters_list_updated.inc new file mode 100644 index 00000000000000..934d2b9264cdee --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_types_clusters_list_updated.inc @@ -0,0 +1,62 @@ +// Following device type map is updated from the matter_device_types_clusters_list +// to ensure that the device list gives meaningful device types lits and that could be supported via Unify SDK. +#include +#include +#include +#include +static const std::map, const char *>> matter_device_type_vs_clusters_map = { + //{ 0x0000, {{"Basic", "Identify"}, "onoffswitch"} }, + //{ 0x0001, {{"Basic", "Identify"}, "levelcontrolswitch"} }, + //{ 0x0002, {{"Basic", "Identify", "OnOff", "Scenes", "Groups"}, "onnoffoutput"} }, + //{ 0x0003, {{"Basic", "Identify", "OnOff", "Level", "Scenes", "Groups"}, "levelcontrollableoutput"} }, + //{ 0x0004, {{"Basic", "Identify"}, "sceneselector"} }, + //{ 0x0005, {{"Basic", "Identify"}, "configurationtool"} }, + //{ 0x0006, {{"Basic", "Identify"}, "remotecontrol"} }, + //{ 0x0007, {{"Basic", "Identify"}, "combinedinterface"} }, + //{ 0x0008, {{"Basic", "Identify"}, "rangeextender"} }, + //{ 0x0009, {{"Basic", "Identify", "OnOff", "Scenes", "Groups"}, "mainspoweroutlet"} }, + { 0x000A, {{"Basic", "Identify", "DoorLock", "Scenes", "Groups"}, "doorlock"} }, + //{ 0x000B, {{"Basic", "Identify", "Time"}, "doorlockcontroller"} }, + { 0x000C, {{"Basic", "Identify", "Binary Input (Basic)"}, "simplesensor"} }, + { 0x000D, {{"Basic", "Identify", "Metering"}, "consumptionawarenessdevice"} }, + //{ 0x0050, {{"Basic", "Identify", "Time"}, "homegateway"} }, + { 0x0051, {{"Basic", "Identify", "OnOff", "Metering"}, "smartplug"} }, + { 0x0052, {{"Basic", "Identify", "Power Profile", "Appliance Statistics", "Appliance Control", "Appliance Identification", "Appliance Events and Alert"}, "whitegoods"} }, + { 0x0053, {{"Basic", "Identify", "Metering", "Meter Identification"}, "meterinterface"} }, + { 0x0200, {{"Basic", "Identify", "ShadeConfiguration", "OnOff", "Level", "Scenes", "Groups"}, "shade"} }, + //{ 0x0201, {{"Basic", "Identify"}, "shadecontroller"} }, + { 0x0202, {{"Basic", "Identify", "WindowCovering", "Scenes", "Groups"}, "windowcovering"} }, + //{ 0x0203, {{"Basic", "Identify"}, "windowcoveringcontroller"} }, + //{ 0x0300, {{"Basic", "Identify", "OnOff", "Thermostat"}, "heatingcoolingunit"} }, + { 0x0301, {{"Basic", "Identify", "Thermostat"}, "thermostat"} }, + { 0x0302, {{"Basic", "Identify", "TemperatureMeasurement"}, "tempsensor"} }, + { 0x0303, {{"Basic", "Identify", "PumpConfigurationAndControl", "OnOff", "Scenes", "Groups"}, "pump"} }, + //{ 0x0304, {{"Basic", "Identify"}, "pumpcontroller"} }, + { 0x0305, {{"Basic", "Identify", "PressureMeasurement"}, "pressuresensor"} }, + { 0x0306, {{"Basic", "Identify", "FlowMeasurement"}, "flowsensor"} }, + { 0x0400, {{"Basic", "Identify", "IASACE"}, "iascie"} }, + //{ 0x0401, {{"Basic", "Identify", "IASZone"}, "iasace"} }, + { 0x0402, {{"Basic", "Identify", "IASZone"}, "iaszone"} }, + { 0x0403, {{"Basic", "Identify", "IASWD", "IASZone"}, "iasW"} }, + { 0x0100, {{"Basic", "Identify", "Groups", "Scenes", "OnOff"}, "onofflight"} }, + { 0x0101, {{"Basic", "Identify", "Groups", "Scenes", "OnOff", "Level"}, "dimmablelight"} }, + { 0x0102, {{"Basic", "Identify", "Groups", "Scenes", "OnOff", "Level", "ColorControl"}, "colordimmablelight"} }, + //{ 0x0103, {{"Basic", "Identify"}, "onofflightswitch"} }, + //{ 0x0104, {{"Basic", "Identify"}, "dimmerswitch"} }, + //{ 0x0105, {{"Basic", "Identify"}, "colordimmerswitch"} }, + { 0x0106, {{"Basic", "Identify", "IlluminanceMeasurement"}, "lightsensor"} }, + { 0x0107, {{"Basic", "Identify", "OccupancySensing"}, "occupancysensor"} }, + { 0x0108, {{"Basic", "PowerConfiguration", "DeviceTemperatureConfiguration", "Identify", "Groups", "Scenes", "OnOff", "BallastConfiguration"}, "onoffballast"} }, + { 0x0109, {{"Basic", "PowerConfiguration", "DeviceTemperatureConfiguration", "Identify", "Groups", "Scenes", "OnOff", "BallastConfiguration", "Level"}, "dimmableballast"} }, + //{ 0x010A, {{"Basic", "Identify", "Groups", "Scenes", "OnOff"}, "onoffpluginunit"} }, + //{ 0x010B, {{"Basic", "Identify", "Groups", "Scenes", "OnOff", "Level"}, "dimmablepluginunit"} }, + //{ 0x010C, {{"Basic", "Identify", "Groups", "Scenes", "OnOff", "Level", "ColorControl"}, "colortemperaturelight"} }, + //{ 0x010D, {{"Basic", "Identify", "Groups", "Scenes", "OnOff", "Level", "ColorControl"}, "extendedcolorlight"} }, + { 0x010E, {{"Basic", "Identify", "IlluminanceLevelSensing"}, "lightlevelsensor"} }, + //{ 0x0800, {{"Basic", "Identify"}, "colorcontroller"} }, + //{ 0x0810, {{"Basic", "Identify"}, "colorscenecontroller"} }, + //{ 0x0820, {{"Basic", "Identify"}, "noncolorcontroller"} }, + //{ 0x0830, {{"Basic", "Identify"}, "noncolorscenecontroller"} }, + //{ 0x0840, {{"Basic", "Identify"}, "controlbridge"} }, + //{ 0x0850, {{"Basic", "Identify"}, "onoffsensor"} } +}; \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/dummy.cpp b/silabs_examples/unify-matter-bridge/linux/src/dummy.cpp new file mode 100644 index 00000000000000..9a79385dc78dfe --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/dummy.cpp @@ -0,0 +1,21 @@ + +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::DeviceLayer; + +/*constexpr EndpointId kNetworkCommissioningEndpointMain = 0; +NetworkCommissioning::LinuxEthernetDriver sLinuxEthernetDriver; +Clusters::NetworkCommissioning::Instance sEthernetNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, + &sLinuxEthernetDriver); +*/ +void ApplicationInit() +{ + // sEthernetNetworkCommissioningInstance.Init(); +} + +void MatterThreadNetworkDiagnosticsPluginServerInitCallback() {} + +void MatterWiFiNetworkDiagnosticsPluginServerInitCallback() {} \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter.h b/silabs_examples/unify-matter-bridge/linux/src/matter.h new file mode 100644 index 00000000000000..320acf8db57c2f --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter.h @@ -0,0 +1,58 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#ifndef MATTER_HEADER +#define MATTER_HEADER +// This is a generic include headers which includes all matter headers. order +// matters for the first include headers! +#include +#include + +#include "app/util/attribute-metadata.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include "LinuxCommissionableDataProvider.h" +#include +#include +//#include +#include +#include +#include +//#include +#include +#include +#include +#include +#endif \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config.c b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config.c new file mode 100644 index 00000000000000..1d45e1cb6e9e47 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config.c @@ -0,0 +1,79 @@ +/******************************************************************************* + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + ******************************************************************************/ + +#include "matter_bridge_config.h" +#include "config.h" +#include "matter_bridge_config_fixt.h" +#include "sl_log.h" +#include +#include +#include +#include +#include +#include + +#define LOG_TAG "matter_bridge_config" + +// List of default settings +#define CONFIG_KEY_INTERFACE "interface" +#define CONFIG_KEY_KVS_PATH "kvs" +#define CONFIG_KEY_VENDOR_ID "vendor" +#define CONFIG_KEY_PRODUCT_ID "product" +#define CONFIG_KEY_INTERFACE "interface" + +#ifdef __APPLE__ +#define DEFAULT_INTERFACE "en0" +#else +#define DEFAULT_INTERFACE "eth0" +#endif + +static matter_bridge_config_t config; + +int matter_bridge_config_init() +{ + memset(&config, 0, sizeof(config)); + config_status_t status = CONFIG_STATUS_OK; + status |= config_add_string(CONFIG_KEY_INTERFACE, "Ethernet interface to use", DEFAULT_INTERFACE); + status |= config_add_string(CONFIG_KEY_KVS_PATH, "Matter key value store path", "/var/chip_unify_bridge.kvs"); + status |= config_add_int(CONFIG_KEY_VENDOR_ID, "Vendor ID", 0xFFF1); + status |= config_add_int(CONFIG_KEY_PRODUCT_ID, "Product ID", 0x8001); + + return status != CONFIG_STATUS_OK; +} + +static int config_get_int_safe(const char * key) +{ + int val = 0; + if (SL_STATUS_OK != config_get_as_int(key, &val)) + { + sl_log_error(LOG_TAG, "Failed to get int for key: %s", key); + assert(false); + } + return val; +} + +sl_status_t matter_bridge_config_fixt_setup() +{ + config_status_t status = CONFIG_STATUS_OK; + config_get_as_string(CONFIG_KEY_INTERFACE, &config.interface); + config_get_as_string(CONFIG_KEY_KVS_PATH, &config.kvs_path); + config.vendor_id = config_get_int_safe(CONFIG_KEY_VENDOR_ID); + config.product_id = config_get_int_safe(CONFIG_KEY_PRODUCT_ID); + return status == CONFIG_STATUS_OK ? SL_STATUS_OK : SL_STATUS_FAIL; +} + +const matter_bridge_config_t * matter_bridge_get_config() +{ + return &config; +} diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config.h b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config.h new file mode 100644 index 00000000000000..7b86a7fdb08e74 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config.h @@ -0,0 +1,65 @@ +/****************************************************************************** + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @file matter_bridge_config.h + * @addtogroup matter_bridge_config Configuration Extension + * @ingroup components + * + * @brief Add the Matter Bridge-specific fixtures to the Unify \ref config system. + * + * @{ + */ + +#if !defined(MATTER_BRIDGE_CONFIG_H) +#define MATTER_BRIDGE_CONFIG_H + +#include + +#define CONFIG_KEY_BLE_DEVICE_ID "matter_bridge.ble-device" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + const char * interface; + const char * kvs_path; + uint16_t vendor_id; + uint16_t product_id; + +} matter_bridge_config_t; + +/** + * @brief Get the current configuration. This must only be called after + * matter_bridge_config_init. + */ +const matter_bridge_config_t * matter_bridge_get_config(); + +/** + * @brief Register Matter Bridge configurations in \ref config. + * + * This must be called before \ref uic_main. + * + * @returns 0 on success. + */ +int matter_bridge_config_init(); + +#ifdef __cplusplus +} +#endif + +/** @} end matter_bridge_config */ + +#endif // MATTER_BRIDGE_CONFIG_H diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config_fixt.h b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config_fixt.h new file mode 100644 index 00000000000000..eeaa21ecc443cd --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_config_fixt.h @@ -0,0 +1,48 @@ +/****************************************************************************** + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +/** + * @file matter_bridge_config_fixt.h + * @defgroup matter_bridge_config_fixture Matter Bridge Config Fixture + * @ingroup matter_bridge_config + * @brief Matter Bridge Configuration fixture. + * + * Fixture to initialize the matter_bridge_config from uic_main, + * to be used in \ref matter_bridge_config + * + * @{ + */ + +#ifndef MATTER_BRIDGE_CONFIG_FIXT_H +#define MATTER_BRIDGE_CONFIG_FIXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sl_status.h" +/** + * @brief Fixture for setting up the matter_bridge_config component. + * + * This will read configurations from \ref config, and store it in matter_bridge_config. + * + * @return SL_STATUS_OK for success, SL_STATUS_FAIL if an error occurred + */ +sl_status_t matter_bridge_config_fixt_setup(void); + +#ifdef __cplusplus +} +#endif + +/** @} end of matter_bridge_config */ +#endif // MATTER_BRIDGE_CONFIG_FIXT_H diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_main.cpp b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_main.cpp new file mode 100644 index 00000000000000..ac867b56fcbca0 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_main.cpp @@ -0,0 +1,155 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + +#include "matter.h" +#include + +#include +#include + +// Application library +#include "bridged_device_basic_info_attribute_translator.hpp" +#include "group_command_translator.hpp" +#include "identify_attribute_translator.hpp" +#include "identify_command_translator.hpp" +#include "level_attribute_translator.hpp" +#include "level_command_translator.hpp" +#include "matter_bridge_config.h" +#include "matter_bridge_config_fixt.h" +#include "matter_device_translator.hpp" +#include "matter_node_state_monitor.hpp" +#include "on_off_attribute_translator.hpp" +#include "on_off_command_translator.h" + +extern "C" { +// Unify library +#include "sl_log.h" +#include "sl_status.h" +#include "uic_init.h" +#include "uic_main.h" +#include "uic_main_loop.h" +} + +using namespace chip; +using namespace chip::app; +using namespace chip::Credentials; +using namespace chip::Inet; +using namespace chip::Transport; +using namespace chip::DeviceLayer; + +using namespace unify::matter_bridge; + +#define CMAKE_PROJECT_VERSION "1.0" + +constexpr const char * LOG_TAG = "unify_matter_bridge"; + +static bool matter_running; + +void init_ember_endpoints() +{ + PlatformMgr().ScheduleWork([](intptr_t) { + // Disable last fixed endpoint, which is used as a placeholder for all of the + // supported clusters so that ZAP will generated the requisite code. + emberAfEndpointEnableDisable(emberAfEndpointFromIndex(static_cast(emberAfFixedEndpointCount() - 1)), false); + }); +} + +static void stop_the_loop(intptr_t) +{ + PlatformMgr().StopEventLoopTask(); +} + +std::thread run_unify() +{ + std::thread unify_thread([]() { + while (matter_running) + { + PlatformMgr().LockChipStack(); + bool shutdown = !uic_main_loop_run(); + PlatformMgr().UnlockChipStack(); + uic_main_wait_for_file_descriptors(); + + if (shutdown) + { + PlatformMgr().ScheduleWork(stop_the_loop); + break; + } + } + }); + return unify_thread; +} + +int main(int argc, char * argv[]) +{ + if (matter_bridge_config_init()) + { + return -1; + } + + // Setup fixtures + uic_fixt_setup_step_t uic_fixt_setup_steps_list[] = { { matter_bridge_config_fixt_setup, "Matter Bridge config fixture" }, + { NULL, "Terminator" } }; + + uic_init(uic_fixt_setup_steps_list, argc, argv, CMAKE_PROJECT_VERSION); + + const char * __argv__[] = { "matter_bridge", nullptr }; + int __argc__ = sizeof(__argv__) / sizeof(const char *) - 1; + + auto & opt = LinuxDeviceOptions::GetInstance(); + auto cfg = matter_bridge_get_config(); + + opt.payload.commissioningFlow = CommissioningFlow::kStandard; + opt.payload.rendezvousInformation.Emplace().Set(RendezvousInformationFlag::kOnNetwork); + opt.mWiFi = false; + opt.mThread = false; + + opt.KVS = cfg->kvs_path; + opt.payload.productID = cfg->product_id; + opt.payload.vendorID = cfg->vendor_id; + + if (CHIP_NO_ERROR != InterfaceId::InterfaceNameToId(cfg->interface, opt.interfaceId)) + { + sl_log_error(LOG_TAG, "Unable to select interface %s", cfg->interface); + return -1; + } + VerifyOrDie(ChipLinuxAppInit(__argc__, const_cast(__argv__)) == 0); + + device_translator matter_device_translator; + matter_node_state_monitor node_state_monitor(matter_device_translator); + + // Initializing OnOff command handler + GroupClusterCommandHandler group_handler(node_state_monitor); + OnOffClusterCommandHandler on_cmd_handler(node_state_monitor); + OnOffAttributeAccess on_off_atttr_handler(node_state_monitor); + // Initializing Identify Cluster Commands handler + IdentifyClusterCommandHandler identify_cluster_commands_handler(node_state_monitor); + IdentifyAttributeAccess identify_attribute_handler(node_state_monitor); + // Initializing Bridged Device Basic Info attributes update handler + BridgedDeviceBasicInfoAttributeAccess bridge_device_basic_handler(node_state_monitor); + // Initializing Level Cluster handler + // LevelClusterCommandHandler level_cluster_commands_handler(node_state_monitor); + // LevelAttributeAccess level_attribute_handler(node_state_monitor); + + matter_running = true; + auto handle = run_unify(); + init_ember_endpoints(); + ChipLinuxAppMainLoop(); + matter_running = false; + handle.join(); + return 0; +} diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_data_storage.cpp b/silabs_examples/unify-matter-bridge/linux/src/matter_data_storage.cpp new file mode 100644 index 00000000000000..90b52003ec9bff --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_data_storage.cpp @@ -0,0 +1,109 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#include "matter_data_storage.hpp" +#include "sl_log.h" +#include +#include +#include + +constexpr const char * LOG_TAG = "matter_data_storage"; + +namespace unify::matter_bridge { + +matter_data_storage & matter_data_storage::instance() +{ + static matter_data_storage s; + return s; +} + +// Persist the assigned dynamic endpoint mapping +template <> +bool matter_data_storage::persist_data(endpoint_mapping & key_value) +{ + if (!key_value.matter_endpoint.has_value()) + { + sl_log_info(LOG_TAG, "The matter endpoint value is not provided."); + return false; + } + std::string key = std::string(key_value.unify_unid) + "-" + std::to_string(key_value.unify_endpoint); + if (chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Put(key.c_str(), key_value.matter_endpoint.value()) == + CHIP_NO_ERROR) + { + return true; + } + return false; +} + +// Persist the group mapping +template <> +bool matter_data_storage::persist_data(group_mapping & key_value) +{ + if (!key_value.unify_group_id.has_value()) + { + sl_log_info(LOG_TAG, "The unify group id is not provided"); + return false; + } + std::string key = std::to_string(key_value.matter_group_id); + if (chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Put(key.c_str(), key_value.unify_group_id.value()) == + CHIP_NO_ERROR) + { + return true; + } + return false; +} + +// Get the persisted dynamic endpoint +template <> +bool matter_data_storage::get_persisted_data(endpoint_mapping & key_value) +{ + std::string key = std::string(key_value.unify_unid) + "-" + std::to_string(key_value.unify_endpoint); + chip::EndpointId matter_endpoint; + if (chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Get(key.c_str(), &matter_endpoint) == CHIP_NO_ERROR) + { + key_value.matter_endpoint = matter_endpoint; + return true; + } + return false; +} + +// Get the persisted group mapping +template <> +bool matter_data_storage::get_persisted_data(group_mapping & key_value) +{ + std::string key = std::to_string(key_value.matter_group_id); + uint16_t unify_group_id; + if (chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Get(key.c_str(), &unify_group_id) == CHIP_NO_ERROR) + { + key_value.unify_group_id = unify_group_id; + return true; + } + return false; +} + +// remove the persisted dynamic endpoint mapping +template <> +void matter_data_storage::remove_persisted_data(endpoint_mapping & key) +{ + std::string keys = std::string(key.unify_unid) + "-" + std::to_string(key.unify_endpoint); + chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Delete(keys.c_str()); +} + +// remove the persisted group mapping +template <> +void matter_data_storage::remove_persisted_data(group_mapping & key) +{ + std::string keys = std::to_string(key.matter_group_id); + chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Delete(keys.c_str()); +} + +} // namespace unify::matter_bridge \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/context_builder.hpp b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/context_builder.hpp new file mode 100644 index 00000000000000..1616f2c3a5ea60 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/context_builder.hpp @@ -0,0 +1,136 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +#ifndef CONTEXT_BUILDER_HPP +#define CONTEXT_BUILDER_HPP +#include +#include +#include + +/** + * @brief Class that implements a builder pattern to dynamicly build a + * contigious list. When `build()` is called, the list will be copied to an + * unique vector so it can safely transfer ownership. + * + * The type that can be appended is generalized. e.g. this class can be reused + * to build list of your type of choice. + */ +template class builder +{ + public: + /** + * Appends an item to the internal list of the builder. This list will later be + * presented as an unique array. + * + * @param args all arguments required to construct an object of type T + */ + template builder &append(Args &&...args) + { + data.push_back(T {std::forward(args)...}); + return *this; + } + + /** + * Finalize the builder and call the on_done function. build() will copy the + * gathered list items and present it a contigious unique array. + */ + std::shared_ptr> build() const + { + return std::make_shared>(data); + } + + private: + std::vector data; +}; + +/** SFINAE declarations to compile time figure out if a certain template + * parameter is defined inside a variadic template list */ +template struct TypeInList; + +template struct TypeInList { + static constexpr bool value = std::is_same(); +}; + +template +struct TypeInList { + static constexpr bool value + = TypeInList::value ? true : TypeInList::value; +}; + +/** + * @brief This context object is a small wrapper around a user defined type + * `ContextType`. In this class you can register lists of other types that + * require to have the same lifetime as the `ContextType`. This is useful for + * when the `ContextType` has pointers to these other types as this class can + * give guarantee that the lifetime of `ContextType` always outlives the + * types it internally points to. + * + * Its not possible to register arbitrary types as associated lifetime objects. + * only the types that are passed in as template arguments are able to be + * registered. If you try to pass in another type, a static assert will fire + * during compilation. + * + * This class works for generic types, for a more concrete usecase take a look + * at matter_endpoint_builder + * + */ +template class lifetime_context +{ + public: + /** the variant type which defines which types the vector can hold. */ + using ContextVariant = std::variant>...>; + lifetime_context() = default; + + lifetime_context &operator=(const lifetime_context &other) = delete; + + /** @brief dereference operator to easily access the wrapped type + * `ContextType` */ + ContextType *operator*() + { + return &context; + } + + const ContextType *operator*() const + { + return &context; + } + + /** @brief dereference operator to easily access the wrapped type + * `ContextType` */ + ContextType *operator->() + { + return &context; + } + + /** @brief Function registers a list of elements of one of the defined types. + * By passing this list the ownership is transferred to this context class. + * This class gives a guarantee that the appended lists lifetime is at least + * equally as long as the contained `ContextType` + * @param lifetime a unique ptr to a list of elements + * */ + template + void add_lifetime(std::shared_ptr> &&lifetime) + { + static_assert(TypeInList::value, + "cannot add a type thats not declared as template type " + "for class lifetime_context"); + ContextVariant variant {std::move(lifetime)}; + lifetimes.push_back(std::move(variant)); + } + + private: + ContextType context; + std::vector lifetimes; +}; + +#endif \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_cluster_interactor.cpp b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_cluster_interactor.cpp new file mode 100644 index 00000000000000..6b559ce8ccea0f --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_cluster_interactor.cpp @@ -0,0 +1,156 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +#include "matter_cluster_interactor.hpp" +#include "matter_device_translator.hpp" +#include "matter_endpoint_builder.hpp" +#include "matter.h" +#include "sl_log.h" +constexpr const char *LOG_TAG = "cluster_interactor"; + +namespace +{ +/** + * @brief these clusters are default clusters that are required by matter? + * these clusters will be appended for each registered endpoint + */ +static void append_bridged_clusters( + unify::matter_bridge::matter_endpoint_builder &endpoint_builder) +{ + constexpr int kNodeLabelSize = 32; + constexpr int kDescriptorAttributeArraySize = 254; + constexpr int kFixedLabelAttributeArraySize = 254; + + auto descriptor_cluster + = endpoint_builder.register_cluster(ZCL_DESCRIPTOR_CLUSTER_ID); + descriptor_cluster.attributes.push_back( + EmberAfAttributeMetadata {ZCL_DEVICE_LIST_ATTRIBUTE_ID, + ZCL_ARRAY_ATTRIBUTE_TYPE, + kDescriptorAttributeArraySize, + 0, + ZAP_EMPTY_DEFAULT()}); + descriptor_cluster.attributes.push_back( + EmberAfAttributeMetadata {ZCL_SERVER_LIST_ATTRIBUTE_ID, + ZCL_ARRAY_ATTRIBUTE_TYPE, + kDescriptorAttributeArraySize, + 0, + ZAP_EMPTY_DEFAULT()}); + descriptor_cluster.attributes.push_back( + EmberAfAttributeMetadata {ZCL_CLIENT_LIST_ATTRIBUTE_ID, + ZCL_ARRAY_ATTRIBUTE_TYPE, + kDescriptorAttributeArraySize, + 0, + ZAP_EMPTY_DEFAULT()}); + descriptor_cluster.attributes.push_back( + EmberAfAttributeMetadata {ZCL_PARTS_LIST_ATTRIBUTE_ID, + ZCL_ARRAY_ATTRIBUTE_TYPE, + kDescriptorAttributeArraySize, + 0, + ZAP_EMPTY_DEFAULT()}); + + auto bridged_cluster + = endpoint_builder.register_cluster(ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_ID); + bridged_cluster.attributes.push_back( + EmberAfAttributeMetadata {ZCL_NODE_LABEL_ATTRIBUTE_ID, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + kNodeLabelSize, + 0, + ZAP_EMPTY_DEFAULT()}); + bridged_cluster.attributes.push_back( + EmberAfAttributeMetadata {ZCL_REACHABLE_ATTRIBUTE_ID, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + 1, + 0, + ZAP_EMPTY_DEFAULT()}); + + auto fixed_label_cluster + = endpoint_builder.register_cluster(ZCL_FIXED_LABEL_CLUSTER_ID); + bridged_cluster.attributes.push_back( + EmberAfAttributeMetadata {ZCL_LABEL_LIST_ATTRIBUTE_ID, + ZCL_ARRAY_ATTRIBUTE_TYPE, + kFixedLabelAttributeArraySize, + 0, + ZAP_EMPTY_DEFAULT()}); +} + +} // namespace + +namespace unify::matter_bridge +{ +cluster_interactor::cluster_interactor( + const device_translator &translator, + matter_endpoint_builder &endpoint_builder) : + translator(translator), endpoint_builder(endpoint_builder) +{} + +void cluster_interactor::build_matter_cluster( + const std::unordered_map &clusters) +{ + for (const auto &[cluster_name, cluster]: clusters) { + const auto cluster_id = translator.get_cluster_id(cluster_name); + if (!cluster_id) { + sl_log_info(LOG_TAG, "no cluster id known for %s", cluster_name.c_str()); + continue; + } else { + sl_log_info(LOG_TAG, "Mapping Custer %s", cluster_name.c_str()); + } + + auto cluster_builder + = endpoint_builder.register_cluster(cluster_id.value()); + for (const auto &incoming: cluster.supported_commands) { + auto command = translator.get_command_id(cluster_name, incoming); + if (command) { + cluster_builder.incoming_commands.push_back(command.value()); + } + } + + for (const auto &outgoing: cluster.generated_commands) { + auto command = translator.get_command_id(cluster_name, outgoing); + if (command) { + cluster_builder.outgoing_commands.push_back(command.value()); + } + } + + for (const auto &attribute: cluster.attributes) { + if (auto attribute_id + = translator.get_attribute_id(cluster_name, attribute)) { + // TODO: required an API to get the attribute types from the cluster+ attribute name. + // with its corresponding size + cluster_builder.attributes.emplace_back( + EmberAfAttributeMetadata {attribute_id.value(), + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + 1, + CLUSTER_MASK_SERVER, + ZAP_EMPTY_DEFAULT()}); + } + } + + clusterlist.push_back(cluster_name.c_str()); + } + append_bridged_clusters(endpoint_builder); +} + +std::optional cluster_interactor::get_matter_type() const +{ + std::vector possible_device_types + = translator.get_device_types(clusterlist); + if (possible_device_types.empty()) { + return std::nullopt; + } + // ToDo: Here we are returning the first device type; + // There should be a mechanism to find teh correct device type + // for the possible list of Device types. + return possible_device_types[0]; +} + +} // namespace unify::matter_bridge \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_cluster_interactor.hpp b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_cluster_interactor.hpp new file mode 100644 index 00000000000000..495523e3592e4e --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_cluster_interactor.hpp @@ -0,0 +1,46 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#ifndef MATTER_DEVICE_TRANSLATOR_INTERACTOR_HPP +#define MATTER_DEVICE_TRANSLATOR_INTERACTOR_HPP + +#include "matter.h" +#include +#include + +#include "unify_node_state_monitor.hpp" +#include "matter_device_translator.hpp" +#include "matter_endpoint_builder.hpp" +namespace unify::matter_bridge +{ +// class device_translator; +// class matter_endpoint_builder; + +class cluster_interactor +{ + public: + cluster_interactor(const device_translator &translator, + matter_endpoint_builder &endpoint_builder); + std::optional get_matter_type() const; + + void build_matter_cluster( + const std::unordered_map + &clusters); + + private: + const device_translator &translator; + matter_endpoint_builder &endpoint_builder; + std::vector clusterlist; +}; +} // namespace unify::matter_bridge + +#endif \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_context.hpp b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_context.hpp new file mode 100644 index 00000000000000..200eb704fc115f --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_context.hpp @@ -0,0 +1,80 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +#ifndef MATTER_CONTEXT_HPP +#define MATTER_CONTEXT_HPP + +#include "context_builder.hpp" +#include "matter.h" + +// Device Version for dynamic endpoints: +#define DEVICE_VERSION_DEFAULT 1 +#define DEVICE_TYPE_BRIDGED_NODE 0x0013 + +namespace unify::matter_bridge +{ +/** + * @brief This context object holds the actual `EmberAfEndpointType` that is + * passed to the matter API. Next to that it holds the lifetimes of memory + * that is used inside of this type. When this object goes out of scope, all + * memory gets released. Therefore its critical that this object lives + * longer as the references of the matter_endpoint inside the matter API. + * + * use a `ember_context_builder` to setup this object. + */ +class matter_endpoint_context : + public lifetime_context +{ + public: + matter_endpoint_context() = default; + + /** + * @brief Storage that will be passed on a matter declare dynamic endpoint. + * Its related to the number of clusters being declared. + */ + const chip::Span data_version_span() const + { + using BaseType = lifetime_context; + // This should be a const operation. For now we resize the data versions + // buffer here. Ideally this should have been done in the last non const + // operation of the context object. + auto& versions = (const_cast(this))->data_versions; + std::fill_n(std::back_inserter(versions), BaseType::operator*()->clusterCount + , 0); + + return chip::Span( + const_cast(versions.data()), + versions.size()*sizeof(chip::DataVersion) ); + } + + const chip::Span device_type_span(uint16_t matter_type) const + { + auto& device_types = (const_cast(this))->bridgedDeviceTypes; + device_types[0].deviceId = matter_type; + return chip::Span(bridgedDeviceTypes); + } + + private: + std::vector data_versions; + EmberAfDeviceType bridgedDeviceTypes[2] = { { 0, DEVICE_VERSION_DEFAULT }, + { DEVICE_TYPE_BRIDGED_NODE, DEVICE_VERSION_DEFAULT } }; +}; + +} // namespace unify::matter_bridge +#endif \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_endpoint_builder.cpp b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_endpoint_builder.cpp new file mode 100644 index 00000000000000..ccbbdd46f39637 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_endpoint_builder.cpp @@ -0,0 +1,79 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#include "matter_endpoint_builder.hpp" +#include "matter_device_translator.hpp" +#include "matter.h" +#include +#include + +#include "sl_log.h" + +namespace +{ +template +std::shared_ptr> make_shared(const std::vector &data) +{ + return std::make_shared>(data); +} +} // namespace +namespace unify::matter_bridge +{ +matter_cluster_builder::matter_cluster_builder( + const std::function &on_done) : + on_done(on_done) +{} + +matter_cluster_builder::~matter_cluster_builder() +{ + on_done(*this); +} + + +matter_cluster_builder + matter_endpoint_builder::register_cluster(const chip::ClusterId &cluster_id) + +{ + // when we gathered all attributes we can fill in the final cluster struct. + // this is done in this callback. + auto on_done = [&](const matter_cluster_builder &cluster_attributes) { + auto attributes = make_shared(cluster_attributes.attributes); + auto incoming_commands = make_shared(cluster_attributes.incoming_commands); + auto outgoing_commands = make_shared(cluster_attributes.outgoing_commands); + + clusters.emplace_back( + EmberAfCluster {cluster_id, + attributes.get()->data(), + static_cast(attributes.get()->size()), + static_cast(0), + static_cast(CLUSTER_MASK_SERVER), + nullptr, + incoming_commands->data(), + outgoing_commands->data()}); + + this->owned_ember_endpoint.add_lifetime(std::move(attributes)); + this->owned_ember_endpoint.add_lifetime(std::move(incoming_commands)); + this->owned_ember_endpoint.add_lifetime(std::move(outgoing_commands)); + }; + return matter_cluster_builder(on_done); +} + +const matter_endpoint_context matter_endpoint_builder::finalize() +{ + auto ember_clusters = make_shared(clusters); + this->owned_ember_endpoint->cluster = ember_clusters->data(); + this->owned_ember_endpoint->clusterCount = ember_clusters->size(); + this->owned_ember_endpoint.add_lifetime(std::move(ember_clusters)); + return this->owned_ember_endpoint; +} + +} // namespace unify::matter_bridge \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_endpoint_builder.hpp b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_endpoint_builder.hpp new file mode 100644 index 00000000000000..9902206859d316 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_endpoint_builder.hpp @@ -0,0 +1,79 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#ifndef MATTER_ENDPOINT_BUILDER_HPP +#define MATTER_ENDPOINT_BUILDER_HPP + +#include +#include +#include +#include +#include +#include +#include "matter_context.hpp" + +namespace unify::matter_bridge +{ +class matter_cluster_builder +{ + public: + matter_cluster_builder( + const std::function &on_done); + ~matter_cluster_builder(); + + std::vector incoming_commands; + std::vector outgoing_commands; + std::vector attributes; + + private: + const std::function on_done; +}; + +/** + * This class builds a dynamic matter endpoint context in a memory safe manner. + * it makes use of 2 `builder` classes, builder and + * builder in order to build matter attributes + * and subsequently matter clusters. + * + * When all clusters and attributes are added, the final context attribute can + * be retrieved by calling `build_and_get()`. + * + * Since a EmberAfEndpointType contains pointers to arrays of clusters and attributes, + * we need to guarantee that these arrays can never life shorter as the EmberAfEndpointType + * structure itself. The context object therefore holds lifetime references to these arrays + * to satisfy this requirement. Only the whole context can be removed or added. + * this way the lifetime of EmberAfEndpointType equals the life time of the arrays + * its referencing. + */ +class matter_endpoint_builder : private builder +{ + public: + /** + * @brief This function returns a builder object to append attributes for a + * given Cluster. note that cluster will be registered when the builder object + * goes out of scope or explicitly `build()` is called on it. + */ + matter_cluster_builder register_cluster(const chip::ClusterId &cluster_id); + + /** + * @brief finalize building dynamic matter endpoint and return the context + * object. This context object is constant, meaning it can not be changed. Via + * this way we know there cannot be tempored with its internal memory. + */ + const matter_endpoint_context finalize(); + + private: + std::vector clusters; + matter_endpoint_context owned_ember_endpoint; +}; +} // namespace unify::matter_bridge +#endif \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_node_state_monitor.cpp b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_node_state_monitor.cpp new file mode 100644 index 00000000000000..c24658b4677a9a --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_node_state_monitor/matter_node_state_monitor.cpp @@ -0,0 +1,207 @@ +/****************************************************************************** + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ +#include +#include +#include +#include "matter.h" +#include "matter_node_state_monitor.hpp" +#include "matter_cluster_interactor.hpp" +#include "matter_device_translator.hpp" +#include "matter_endpoint_builder.hpp" +#include "matter_data_storage.hpp" +#include "sl_log.h" +static constexpr uint8_t ZCL_NODE_STATE_NETWORK_STATUS_ONLINE_FUNCTIONAL = 0; +constexpr const char *LOG_TAG = "matter_node_state_monitor"; +namespace +{ +using namespace unify::matter_bridge; + +/** + * @brief the first endpoint ids inside matter are reserved for fixed endpoints. + * This function is able to return the next available endpoint which can be used + * to declare a dynamic endpoint with. + * + * @return the next available EndpointId which can be used for + */ +static chip::EndpointId get_next_ember_endpoint_id() +{ + static chip::EndpointId current_id = FIXED_ENDPOINT_COUNT; + + if (current_id >= MAX_ENDPOINT_COUNT) { + return 0xffff; + } else { + return current_id++; + } +} + +/** + * @brief registers a bridged_endpoint to matter. + */ +static void register_dynamic_endpoint(const bridged_endpoint &bridge) +{ + EmberAfStatus status = emberAfSetDynamicEndpoint( + bridge.index, + bridge.matter_endpoint, + const_cast(*bridge.ember_endpoint), + bridge.ember_endpoint.data_version_span(), + bridge.ember_endpoint.device_type_span(bridge.matter_type), + 0); + if (status != EMBER_ZCL_STATUS_SUCCESS) { + sl_log_error( + LOG_TAG, + "The unify node [%s] is not added on matter bridge as a dynamic endpoint", + bridge.unify_unid.c_str()); + } + if (status == EMBER_ZCL_STATUS_INSUFFICIENT_SPACE) { + sl_log_error(LOG_TAG, + "There are not sufficient space to add the unify node [%s] on " + "matter fabric domain", + bridge.unify_unid.c_str()); + } +} +} // namespace + +namespace unify::matter_bridge +{ +matter_node_state_monitor::matter_node_state_monitor( + const class device_translator &translator) : + matter_device_translator(translator) +{ + // Disable last fixed endpoint, which is used as a placeholder for all of the + // supported clusters so that ZAP will generated the requisite code. + emberAfEndpointEnableDisable( + emberAfEndpointFromIndex(emberAfFixedEndpointCount() - 1), + false); + + unify::node_state_monitor::node_state_monitor::get_instance().set_interface( + this); +} + +void matter_node_state_monitor::on_unify_node_added( + const unify::node_state_monitor::node &node) +{ + for (const auto &[ep_id, ep]: node.endpoints) { + uint8_t count_number_of_clusters_matched_to_matter = 0; + for (const auto &[cluster_name, cluster]: ep.clusters) { + if (matter_device_translator.get_cluster_id(cluster_name).has_value()) { + count_number_of_clusters_matched_to_matter++; + } + } + if (count_number_of_clusters_matched_to_matter == 0) { + continue; + } + matter_endpoint_builder builder; + cluster_interactor cluster_interactor(matter_device_translator, builder); + cluster_interactor.build_matter_cluster(ep.clusters); + auto matter_device_type = cluster_interactor.get_matter_type(); + if (!matter_device_type.has_value()) { + continue; + } + matter_endpoint_context ember_endpoint = builder.finalize(); + struct bridged_endpoint bridge(std::move(ember_endpoint)); + bridge.unify_unid = node.unid; + bridge.unify_endpoint = ep_id; + bridge.matter_type = matter_device_type.value(); + // check the unify node has already assigned dynamic endpoint from + // persisted storage. If it exists, use the persisted endpoint + // if not get the next available endpoint using 'get_next_ember_endpoint_id' + matter_data_storage::endpoint_mapping unify_node + = {bridge.unify_unid.c_str(), bridge.unify_endpoint}; + bool status_persisted_endpoint_map + = matter_data_storage::instance().get_persisted_data(unify_node); + if (status_persisted_endpoint_map) { + bridge.matter_endpoint = unify_node.matter_endpoint.value(); + } else { + bridge.matter_endpoint = get_next_ember_endpoint_id(); + matter_data_storage::endpoint_mapping endpoint_map_info + = {bridge.unify_unid.c_str(), + bridge.unify_endpoint, + bridge.matter_endpoint}; + matter_data_storage::instance().persist_data(endpoint_map_info); + } + bridge.index = bridge.matter_endpoint - emberAfFixedEndpointCount(); + auto new_ep + = bridged_endpoints.insert(make_pair(node.unid, std::move(bridge))); + register_dynamic_endpoint(new_ep->second); + invoke_listeners(new_ep->second, NODE_ADDED); + //When the node is online we also invoke that the node state is reachable + new_ep->second.reachable + = (node.state == ZCL_NODE_STATE_NETWORK_STATUS_ONLINE_FUNCTIONAL); + invoke_listeners(new_ep->second, update_t::NODE_STATE_CHANGED); + } +} // namespace unify::matter_bridge + +void matter_node_state_monitor::on_unify_node_removed(const std::string &unid) +{ + const auto &[start, end] = bridged_endpoints.equal_range(unid); + for (auto ep = start; ep != end; ep++) { + emberAfClearDynamicEndpoint(ep->second.index); + // delete the persisted endpoint map entry + matter_data_storage::endpoint_mapping unify_node + = {ep->second.unify_unid.c_str(), ep->second.unify_endpoint}; + matter_data_storage::instance().remove_persisted_data(unify_node); + invoke_listeners(ep->second, update_t::NODE_DELETED); + } + bridged_endpoints.erase(start, end); +} + +void matter_node_state_monitor::on_unify_node_state_changed( + const node_state_monitor::node &node) +{ + const auto &[start, end] = bridged_endpoints.equal_range(node.unid); + for (auto ep = start; ep != end; ep++) { + ep->second.reachable + = (node.state == ZCL_NODE_STATE_NETWORK_STATUS_ONLINE_FUNCTIONAL); + invoke_listeners(ep->second, update_t::NODE_STATE_CHANGED); + } +} + +const bridged_endpoint * + matter_node_state_monitor::bridged_endpoint(const std::string &unid, + int epid) const +{ + const auto &[start, end] = bridged_endpoints.equal_range(unid); + for (auto ep = start; ep != end; ep++) { + if (ep->second.unify_endpoint == epid) { + return &(ep->second); + } + } + return nullptr; +} + +const bridged_endpoint *matter_node_state_monitor::bridged_endpoint( + chip::EndpointId matter_endpoint) const +{ + for (const auto &[key, value]: bridged_endpoints) { + if (value.matter_endpoint == matter_endpoint) { + return &value; + } + } + return nullptr; +} + +void matter_node_state_monitor::invoke_listeners( + const struct bridged_endpoint &ep, update_t update) const +{ + for (const auto &listener: event_listeners) { + listener(ep, update); + } +} + +void matter_node_state_monitor::register_event_listener( + const event_listener_t &event_listener) +{ + event_listeners.push_back(event_listener); +} + +} // namespace unify::matter_bridge \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/third_party/connectedhomeip b/silabs_examples/unify-matter-bridge/linux/third_party/connectedhomeip new file mode 120000 index 00000000000000..11a54ed360106c --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../ \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/zap/addon-helper copy.js b/silabs_examples/unify-matter-bridge/linux/zap/addon-helper copy.js new file mode 100644 index 00000000000000..73dcfc8062a8ed --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap/addon-helper copy.js @@ -0,0 +1,113 @@ + +let pwd = process.env.PWD +// let zapPath = pwd + '/../third_party/connectedhomeip/third_party/zap/repo/src-electron/' +// const cHelper = require(zapPath + 'generator/helper-c.js') + +function toCamelCase(label, firstLower = true) { + let str = label.replace(/[+()&]/g, '').split(/ |_|-|\//) + let res = '' + for (let i = 0; i < str.length; i++) { + if (i == 0 && firstLower) { + res += str[i].charAt(0).toLowerCase() + } else { + res += str[i].charAt(0).toUpperCase() + } + // Acronyms, such as ZLL become lower-case. + if (str[i].length > 1 && str[i].toUpperCase() == str[i]) { + res += str[i].substring(1).toLowerCase() + } else { + res += str[i].substring(1) + } + } + return res +} + +// Only lowercase some acronyms not all, thanks for the consistency matter. +function lowerAcronyms(label) { + if (['RFID', 'PIN', "LED"].some(element => label.includes(element))) { + return label + } + + return label.replace(/(?<=[A-Z])[A-Z]+(?=[A-Z])/g, (c) => c.toLowerCase()) +} + +function asUpperCamelCase(label) +{ + let str = toCamelCase(label, false) + str = lowerAcronyms(label); + return str.replace(/[^A-Za-z0-9_]/g, ''); +} + + +let cluster_map = { + "Identify" : {matter_name:"Identify" }, + "OnOff" : { matter_name:"OnOff" }, + "Level" : { + matter_name: "LevelControl", + attribute_name_map: { }, + command_name_map: { } + }, +} + +// These clusters are not supported directly translating from Unify -> Matter +function chipSupportedCluster(clusterName) { + return clusterName in cluster_map +} + +// These attributes can't be translated from Unify to Matter +function chipSupportedAttribute(cluster, attribute) { + if(!chipSupportedCluster(cluster)) return false; + + if(attribute in cluster_map[cluster].attribute_name_map ) { + return cluster_map[cluster].attribute_name_map[attribute] != null + } else { + return true + } +} + +// These commands can't be translated from Unify to Matter +function chipSupportedCommands(cluster, command) { + if (command.includes("Response")) { + return false + } +} + +function chipCommandsConversion(command) { + return asUpperCamelCase(command) +} + +// Conversion of attribute names format from Unify to Matter for those not helped by functions. +function chipAttributeConversion(cluster,attributeName) { + if( attributeName in cluster_map[cluster].attribute_name_map) { + return cluster_map[cluster].attribute_name_map[attributeName] + } else { + return asUpperCamelCase(attributeName) + } +} + +function chipSupportedClusterWithCommands(cluster) { + if (!chipSupportedCluster(cluster)) { + return false + } else { + return true + } +} + +// Cluster conversions of name format from Unify to Matter +function chipClusterConversion(clusterName) { + return asUpperCamelCase (cluster_map[clusterName].matter_name) +} + +function toLowerCase(string) { + return string.toLowerCase() +} + +exports.asUpperCamelCase = asUpperCamelCase +exports.chipClusterConversion = chipClusterConversion +exports.chipSupportedCluster = chipSupportedCluster +exports.toLowerCase = toLowerCase +exports.chipAttributeConversion = chipAttributeConversion +exports.chipCommandsConversion = chipCommandsConversion +exports.chipSupportedAttribute = chipSupportedAttribute +exports.chipSupportedCommands = chipSupportedCommands +exports.chipSupportedClusterWithCommands = chipSupportedClusterWithCommands diff --git a/silabs_examples/unify-matter-bridge/linux/zap/addon-helper.js b/silabs_examples/unify-matter-bridge/linux/zap/addon-helper.js new file mode 100644 index 00000000000000..6e28e583d7edd1 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap/addon-helper.js @@ -0,0 +1,172 @@ + +let pwd = process.env.PWD +// let zapPath = pwd + '/../third_party/connectedhomeip/third_party/zap/repo/src-electron/' +// const cHelper = require(zapPath + 'generator/helper-c.js') + +function toCamelCase(label, firstLower = true) { + let str = label.replace(/[+()&]/g, '').split(/ |_|-|\//) + let res = '' + for (let i = 0; i < str.length; i++) { + if (i == 0 && firstLower) { + res += str[i].charAt(0).toLowerCase() + } else { + res += str[i].charAt(0).toUpperCase() + } + // Acronyms, such as ZLL become lower-case. + if (str[i].length > 1 && str[i].toUpperCase() == str[i]) { + res += str[i].substring(1).toLowerCase() + } else { + res += str[i].substring(1) + } + } + return res +} + +// Only lowercase some acronyms not all, thanks for the consistency matter. +function lowerAcronyms(label) { + if (['RFID', 'PIN', "LED"].some(element => label.includes(element))) { + return label + } + + return label.replace(/(?<=[A-Z])[A-Z]+(?=[A-Z])/g, (c) => c.toLowerCase()) +} + +function asUpperCamelCase(label) +{ + let str = toCamelCase(label, false) + str = lowerAcronyms(label); + return str.replace(/[^A-Za-z0-9_]/g, ''); +} + +// These clusters are not supported directly translating from Unify -> Matter +function chipSupportedCluster(clusterName) { + let clusters = { + "Identify":{}, + "Groups":{}, + "Scenes":{}, + "OnOff":{}, + "Level":{}, + //"DoorLock":{}, + "FanControl":{}, + "ColorControl":{}, + "IlluminanceMeasurement":{}, + "TemperatureMeasurement":{}, + "PressureMeasurement":{}, + "FlowMeasurement":{}, + "OccupancySensing":{}, + "IasZone":{}, + "IaswD":{}, + }; + return clusterName in clusters +} + +// These attributes can't be translated from Unify to Matter +function chipSupportedAttribute(cluster, attribute) { + if(!chipSupportedCluster(cluster)) return false; + + switch (cluster + "_" + attribute) { + case "DoorLock_SecurityLevel": return false + case "ColorControl_Options": return false + default: return true + } +} + +// These commands can't be translated from Unify to Matter +function chipSupportedCommands(cluster, command) { + if(!chipSupportedCluster(cluster)) return false; + if (command.includes("Response")) { + return false + } + + switch (cluster + "_" + command) { + case "Level_MoveToClosestFrequency": return false + case "DoorLock_Toggle": return false + case "Identify_IdentifyQuery": return false + default: return true + } +} + +function chipCommandsConversion(command) { + if (command.includes("Weekday")) { + command = command.replace("Weekday", "WeekDay") + } + + + switch (command) { + default: return asUpperCamelCase(command) + } +} + +// Conversion of attribute names format from Unify to Matter for those not helped by functions. +function chipAttributeConversion(attributeName) { + switch (attributeName) { + case "MainsVoltageDwellTripPoint": return "MainsVoltageDwellTrip" + case "BatteryAHrRating": return "BatteryAhrRating" + case "Battery2AHrRating": return "Battery2AhrRating" + case "Battery3AHrRating": return "Battery3AhrRating" + case "RequirePINforRFOperation": return "RequirePINforRemoteOperation" + case "RFOperationEventMask": return "RFIDOperationEventMask" + case "RFProgrammingEventMask": return "RFIDProgrammingEventMask" + case "WindowCoveringType": return "WindowCovering" + case "ConfigOrStatus": return "ConfigStatus" + case "ACCapacity": return "AcCapacity" + case "ZoneID": return "ZoneId" + case "ColorTemperatureMireds": return "ColorTemperature" + case "IASCIEAddress": return "IasCieAddress" + default: return asUpperCamelCase(attributeName) + } +} + +function chipSupportedClusterWithCommands(cluster) { + if (!chipSupportedCluster(cluster)) { + return false + } + + switch (cluster) { + case "TemperatureMeasurement": return false + case "OccupancySensing": return false + case "FlowMeasurement": return false + case "PressureMeasurement": return false + case "TemperatureMeasurement": return false + case "IlluminanceMeasurement": return false + case "DehumidificationControl": return false + case "ThermostatUserInterfaceConfiguration": return false + case "FanControl": return false + case "PumpConfigurationAndControl": return false + case "PowerConfiguration": return false + case "DeviceTemperatureConfiguration": return false + case "Time": return false + case "ShadeConfiguration": return false + case "PowerConfiguration": return false + case "Time": return false + case "ShadeConfiguration": return false + default: return true + } +} + +// Cluster conversions of name format from Unify to Matter +function chipClusterConversion(clusterName) { + switch (clusterName) { + case "Level": return "LevelControl" + case "RelativityHumidity": return "RelativityHumidityMeasurement" + case "IASWD": return "IasWd" + case "IASZone": return "IasZone" + case "Basic": return "ApplicationBasic" + //case "PowerConfiguration": return "PowerSourceConfiguration" + default: return asUpperCamelCase(clusterName) + } +} + +function toLowerCase(string) { + return string.toLowerCase() +} + +exports.asUpperCamelCase = asUpperCamelCase +exports.chipClusterConversion = chipClusterConversion +exports.chipSupportedCluster = chipSupportedCluster +exports.toLowerCase = toLowerCase +exports.chipAttributeConversion = chipAttributeConversion +exports.chipCommandsConversion = chipCommandsConversion +exports.chipSupportedAttribute = chipSupportedAttribute +exports.chipSupportedCommands = chipSupportedCommands +exports.chipSupportedClusterWithCommands = chipSupportedClusterWithCommands diff --git a/silabs_examples/unify-matter-bridge/linux/zap/gen-templates.json b/silabs_examples/unify-matter-bridge/linux/zap/gen-templates.json new file mode 100644 index 00000000000000..425134104306fc --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap/gen-templates.json @@ -0,0 +1,16 @@ +{ + "name": "Matter bridge mappings", + "version": "v1", + "override": "../../../../components/uic_dotdot/zap/addon-override.js", + "helpers": [ + "addon-helper.js", + "../../../../components/uic_dotdot/zap/addon-helper.js" + ], + "templates": [ + { + "path": "matter_device_mapper.inc.zapt", + "name": "Type mappings for clusters values in Unify to Matter clusters", + "output": "matter_device_mapper.inc" + } + ] +} \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/zap/matter_device_mapper.inc.zapt b/silabs_examples/unify-matter-bridge/linux/zap/matter_device_mapper.inc.zapt new file mode 100644 index 00000000000000..35526a2ee5078f --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap/matter_device_mapper.inc.zapt @@ -0,0 +1,112 @@ +/****************************************************************************** + * # License + * Copyright 2021 Silicon Laboratories Inc. www.silabs.com + ****************************************************************************** + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + *****************************************************************************/ + +// This file is generated automatically. Don't try to change something here. +// To add support for new clusters, modify addon-helper.js in uic/applications/matter_bridge/src/zap + +// Component include +#include + +// Standard library +#include +#include +#include + +// Matter includes +#include +#include +#include + +// Cluster mapping Unify->Matter conversion +namespace chip { +namespace app { +namespace Clusters { + +static const std::unordered_map unify_cluster_id_map { + {{#zcl_clusters}} + {{#if (chipSupportedCluster label)}} + { "{{asUpperCamelCase label}}", {{chipClusterConversion label}}::Id}{{listComma this}} + {{/if}} + {{/zcl_clusters}} +}; + +// Attribute mapping Unify->Matter conversion +// Attribute structure for each cluster +{{#zcl_clusters}} +{{#zcl_attributes_server}} +{{#if (chipSupportedCluster parent.label)}} +{{#first}} +namespace {{chipClusterConversion parent.label}} { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { +{{/first}} +{{#if (chipSupportedAttribute parent.label label)}} + { "{{asUpperCamelCase label}}", {{chipAttributeConversion label}}::Id }{{listComma this}} +{{/if}} +{{#last}} +}; +} // namespace Attributes +} // namespace {{asUpperCamelCase parent.label false}} +{{/last}} +{{/if}} +{{/zcl_attributes_server}} +{{/zcl_clusters}} + +// Global map of each clusters attributes +static const std::unordered_map> unify_to_matter_attribute_id_map { +{{#zcl_clusters}} +{{#if (chipSupportedCluster label)}} + { "{{asUpperCamelCase label}}", {{chipClusterConversion label}}::Attributes::unify_to_matter_attribute_id_cluster_map }{{listComma this}} +{{/if}} +{{#last}} +}; +{{/last}} +{{/zcl_clusters}} + + +// Command mapping Unify->Matter conversion +// Command structure for each cluster +{{#zcl_clusters}} +{{#zcl_commands}} +{{#if (chipSupportedCluster parent.label)}} +{{#first}} +namespace {{chipClusterConversion parent.label}} { +namespace Commands { +static const std::unordered_map unify_to_matter_command_id_cluster_map { +{{/first}} +{{#if (chipSupportedCommands parent.label label)}} + { "{{asUpperCamelCase label}}", {{chipCommandsConversion label}}::Id }{{listComma this}} +{{/if}} +{{#last}} +}; +} // namespace Commands +} // namespace {{asUpperCamelCase parent.label false}} +{{/last}} +{{/if}} +{{/zcl_commands}} +{{/zcl_clusters}} + +// Global map of each clusters commands +static const std::unordered_map> unify_to_matter_command_id_map { +{{#zcl_clusters}} +{{#if (chipSupportedClusterWithCommands label)}} + { "{{asUpperCamelCase label}}", {{chipClusterConversion label}}::Commands::unify_to_matter_command_id_cluster_map }{{listComma this}} +{{/if}} +{{#last}} +}; +{{/last}} +{{/zcl_clusters}} + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/silabs_examples/unify-matter-bridge/readme_building.md b/silabs_examples/unify-matter-bridge/readme_building.md new file mode 100644 index 00000000000000..df21364311eab4 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/readme_building.md @@ -0,0 +1,67 @@ +# Building the Unify Matter Bridge + +Pay attention to if the command should be executed on the host machine or inside +of the docker build environment. A `docker/$` means inside the docker and +docker left out means on your host machine. + +# Download the uic repo + +```bash +matter$ git clone ssh://git@stash.silabs.com/uic/uic.git --recursive ../uic +``` + +# Build the docker container + +```bash +matter$ docker build -t unify-matter silabs_examples/unify-matter-bridge/docker/ +``` + +Starting the docker: + +```bash +matter$ docker run -it -v $PWD:/matter -v $PWD/../uic:/uic unify-matter +``` + +# Buiding libunify + +The Unify Matter Bridge is depending on the libunify library from the Unify +project. + +This library must first be compiled for the target system + +```bash +docker/uic$ cmake -DCMAKE_INSTALL_PREFIX=$PWD/stage -GNinja -B unify_build/ -S components +docker/uic$ cmake --build unify_build +docker/uic$ cmake --install unify_build --prefix $PWD/stage +``` + +Setup pkg-config to look at the stage folder + +```bash +docker/uic$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$PWD/stage/share/pkgconfig +``` + +# Setup the matter build environment + +Now setup the matter environment. + +Checking out submodules in the matter repo needs to be done on the host machine. + +```bash +matter$ ./scripts/checkout_submodules.py --platform linux +``` + +After having all the necessary submodules source the environment of matter with +the below command. Be aware that it will show an error but disregard this. + +```bash +docker$ ./scripts/build/gn_bootstrap.sh +``` + +Compile the Unify bridge + +```bash +docker$ cd silabs_examples/unify-matter-bridge/linux/ +docker$ gn gen out/host +docker$ ninja -C out/host +``` diff --git a/silabs_examples/unify-matter-bridge/readme_user.md b/silabs_examples/unify-matter-bridge/readme_user.md new file mode 100644 index 00000000000000..1bed5670ebb199 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/readme_user.md @@ -0,0 +1,184 @@ +# Matter Bridge User's Guide + +This guide describes how to use the unify matter bridge. + +The unify matter bridge is a Unify IoT service that allows control of Unify +devices from a matter fabric. The bridge translates matter cluster commands and +attributes accesses into the corresponding Unify MQTT publish messages. The +bridge also caches the state of Unify node attributes and make those attribute +readable on the matter fabric. + +## Command line arguments + +Using the _--help_ the following help text appear + +```bash +Usage: ./applications/matter_bridge/unify_matter_bridge [Options] + +Options: + --conf arg (=/etc/uic/uic.cfg) Config file in YAML format. UIC_CONF + env variable can be set to override the + default config file path + --help Print this help message and quit + --dump-config Dumps the current configuration on a + YAML config file format that can be + passed to --conf option + --version Print version information and quit + +Following options can also be in a Config file. + Options and values passed on command line here take precedence over the options and values in config file: + --log.level arg (=i) Log Level (d,i,w,e,c) + --log.tag_level arg Tag based log level + Format: :, + :, ... + --interface arg (=en0) Ethernet interface to use + --kvs arg (=/tmp/chip_unify_bridge.kvs) + Matter key value store path + --vendor arg (=65521) Vendor ID + --product arg (=32769) Product ID + --mqtt.host arg (=localhost) MQTT broker hostname or IP + --mqtt.port arg (=1883) MQTT broker port + --mqtt.cafile arg Path to file containing the PEM encoded + CA certificate to connect to Mosquitto + MQTT broker for TLS encryption + --mqtt.certfile arg Path to file containing the PEM encoded + client certificate to connect to + Mosquitto MQTT broker for TLS + encryption + --mqtt.keyfile arg Path to a file containing the PEM + encoded unencrypted private key for + this client + --mqtt.client_id arg (=unify_matter_bridge_71460) + Set the MQTT client ID of the + application. +``` + +## How it works + +The Unify Matter Bridge acts as a Unify IoT service. The Unify data model +is largely based on the same data model as Matter, making the job of the Unify +Matter Bridge relatively simple. There is almost a 1-1 correspondence between +the Matter commands and attributes and the Unify command and attributes. + +## Using the matter bridge + +As a prerequisite for the matter bridge to work at least one Unify protocol +controller should be set up and running. Read the [Unify User Guide](../../doc/user_guide.md) +for information on how to set this up. + +Once a protocol controller is running on the system the matter bridge can be +started, by executing the following command + +```bash +sudo systemctl start uic-matter-bridge +```` + +To monitor the log output of the bridge use this command: + +```bash +journalctl -f -u uic-matter-bridge +``` + +### Commissioning the bridge to a network + +The first time the bridge starts it will automatically go into commissioning mode, after +10 minutes the bridge will exit commissioning mode again. If the bridge has not been +commissioned within this window the application must be restarted to open the commissioning window again. + +The Unify Matter Bridge uses the "On Network" commissioning method, ie there is no +Bluetooth or WiFI involved. + +To obtain the QR commissioning code run the following command: + +```bash +journalctl -u uic-matter-bridge | grep qrcode | tail -1 +Aug 04 14:15:01 raspberrypi unify_matter_bridge[1967]: [1659615301.367723][1967:1967] CHIP:SVR: https://dhrishi.github.io/connectedhomeip/qrcode.html?data=MT%3A-24J029Q00KA0648G00 +``` + +Open the printed link in a browser to get the QR code. It should be noted that the commissioner +must be on the same network as the raspberry pi. Also, note that by default the bridge binds +to the eth0 interface. If another interface is to be used this must be set using the +`--interface` command argument. + +In case of commission with the matter chip tool, the raw QR code string should be obtained: + +```bash +journalctl -u uic-matter-bridge | grep QRCode | tail -1 +Aug 04 14:15:01 raspberrypi unify_matter_bridge[1967]: [1659615301.367669][1967:1967] CHIP:SVR: SetupQRCode: [MT:-24J029Q00KA0648G00] +``` + +### Testing the bridge using the chip tool + +To commission the matter bridge with the `chip-tool` and assign the bridge node id 1 +run the following command: + +```bash +chip-tool pairing qrcode 1 MT:-24J0AFN00KA0648G00 +``` + +To send a command OnOff cluster Toggle command to an endpoint on the bridge + +```bash +chip-tool onoff toggle 1 2 +``` + +Here the bridge is node matter fabric node id 1 and the bridged endpoint is 2 + +For further information on how to use the `chip-tool` see the [chip-tool manual](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/chip_tool_guide.md) +on the Matter website. + +### Sending a group command + +The matter bridge has support for forwarding group messages from the matter fabric to Unify +Nodes. The protocol controllers will send the group messages as actual group cast messages +on the destination network(Z-Wave/ZigBee). + +To send a group command, the group keys must first be set up in the bridge, again here +the bridge is assumed to be node id 1, we add the keyset id 42 to group id 1: + +```bash +chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null },{"fabricIndex": 1, "privilege": 4, "authMode": 3, "subjects": [1], "targets": null }]' 1 0 +chip-tool groupkeymanagement key-set-write '{"groupKeySetID": 42, "groupKeySecurityPolicy": 0, "epochKey0": "d0d1d2d3d4d5d6d7d8d9dadbdcdddedf", "epochStartTime0": 2220000,"epochKey1": "d1d1d2d3d4d5d6d7d8d9dadbdcdddedf", "epochStartTime1": 2220001,"epochKey2": "d2d1d2d3d4d5d6d7d8d9dadbdcdddedf", "epochStartTime2": 2220002 }' 1 0 +chip-tool groupkeymanagement write group-key-map '[{"groupId": 1, "groupKeySetID": 42, "fabricIndex": 1}]' 1 0 +``` + +Now we can add bridge endpoint 2 to group id 0x0001 + +```bash +chip-tool groups add-group 0x0001 grp1 1 2 +``` + +Now we need to program the chip tool: + +```bash +chip-tool groupsettings add-group grp1 0x0002 +chip-tool groupsettings add-keysets 0x0042 0 0x000000000021dfe0 hex:d0d1d2d3d4d5d6d7d8d9dadbdcdddedf +chip-tool groupsettings bind-keyset 0x0001 0x0042 +``` + +As Matter is based on IPv6 and the group message will be sent as a multicast message, +we need to set up a multicast route to tell the Linux kernel what interface the +group message needs to be sent to. + +```bash +sudo route add -6 ff35:40:fd00::/24 dev eth0 +``` + +Finally, a multicast command may be sent using the chip-tool + +```bash +// Send actual multicast command +./chip-tool onoff toggle 0xffffffffffff0001 1 +``` + +## Supported Clusters + +The Unify Matter bridge currently supports the mapping of the following clusters + +| Cluster | +|---------------------| +| Bridged Device Info | +| Group | +| Identify | +| Level | +| OnOff | diff --git a/silabs_examples/unify-matter-bridge/release_notes.md b/silabs_examples/unify-matter-bridge/release_notes.md new file mode 100644 index 00000000000000..f09e53780f1ecf --- /dev/null +++ b/silabs_examples/unify-matter-bridge/release_notes.md @@ -0,0 +1,20 @@ +# Matter Bridge Release Notes + +## [0.1] - Aug 8th 2022 + +- The bridge service does not persists mapping between endpoint numbers and unify UNIDs. As a consequence the endpoints may swap ids on each program startup. + +- Group mapping does not check for existing unify groups. As a consequence the matter bridge may use an already assigned unify group. + +- The bridge service does not persists its matter fabric credentials between system reboots. After RPi reboot, the bridge will always be noncommissioned. This can be fix by choosing a proper location for the KVS file using the `--kvs` command line flag. + +- The Bridge has only support for a limited number of clusters, but it will present device types of with unsupported cluster never the less. The bridge supported mapping of the following clusters: + - Bridge Device Information + - Level + - OnOff + - Identify + - Group + +- Endpoint 0 of the bridge shows support for the Identify cluster, but the identify commands has no effects. + +- The version chip-tool provided with the unify matter bridge is unable to send group cast messages. As a workaround the chip-tool from the matter master branch can be used. diff --git a/silabs_examples/unify-matter-bridge/run_zap.sh b/silabs_examples/unify-matter-bridge/run_zap.sh new file mode 100755 index 00000000000000..31f4a6563e085d --- /dev/null +++ b/silabs_examples/unify-matter-bridge/run_zap.sh @@ -0,0 +1,5 @@ +d=$(pwd) +mkdir -p ${d}/linux/third_party/connectedhomeip/zzz_generated/unify-matter-bridge/zap-generated +./linux/third_party/connectedhomeip/scripts/tools/zap/generate.py \ + -o ${d}/linux/third_party/connectedhomeip/zzz_generated/unify-matter-bridge/zap-generated \ + ${d}/unify-matter-bridge-common/unify-matter-bridge.zap diff --git a/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/BUILD.gn b/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/BUILD.gn new file mode 100644 index 00000000000000..ba1be4eecd3ac8 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2020 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("//build_overrides/chip.gni") + +import("${chip_root}/src/app/chip_data_model.gni") + +chip_data_model("unify-matter-bridge-common") { + zap_file = "unify-matter-bridge.zap" + + zap_pregenerated_dir = + "${chip_root}/zzz_generated/unify-matter-bridge/zap-generated" + is_server = true +} diff --git a/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/include/CHIPProjectAppConfig.h b/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/include/CHIPProjectAppConfig.h new file mode 100644 index 00000000000000..036cbda81ad736 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/include/CHIPProjectAppConfig.h @@ -0,0 +1,34 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +// overrides CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT in CHIPProjectConfig +#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT 16 + +// include the CHIPProjectConfig from config/standalone +#include diff --git a/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/unify-matter-bridge.matter b/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/unify-matter-bridge.matter new file mode 100644 index 00000000000000..88a75f3af55671 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/unify-matter-bridge.matter @@ -0,0 +1,1442 @@ +// This IDL was generated automatically by ZAP. +// It is for view/code review purposes only. + +struct LabelStruct { + char_string<16> label = 0; + char_string<16> value = 1; +} + +server cluster Identify = 3 { + enum IdentifyEffectIdentifier : ENUM8 { + kBlink = 0; + kBreathe = 1; + kOkay = 2; + kChannelChange = 11; + kFinishEffect = 254; + kStopEffect = 255; + } + + enum IdentifyEffectVariant : ENUM8 { + kDefault = 0; + } + + enum IdentifyIdentifyType : ENUM8 { + kNone = 0; + kVisibleLight = 1; + kVisibleLED = 2; + kAudibleBeep = 3; + kDisplay = 4; + kActuator = 5; + } + + attribute int16u identifyTime = 0; + readonly attribute int16u clusterRevision = 65533; + + request struct IdentifyRequest { + INT16U identifyTime = 0; + } + + command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; +} + +server cluster Groups = 4 { + bitmap GroupClusterFeature : BITMAP32 { + kGroupNames = 0x1; + } + + readonly attribute bitmap8 nameSupport = 0; + readonly attribute int16u clusterRevision = 65533; + + request struct AddGroupRequest { + group_id groupId = 0; + CHAR_STRING groupName = 1; + } + + request struct ViewGroupRequest { + group_id groupId = 0; + } + + request struct GetGroupMembershipRequest { + group_id groupList[] = 0; + } + + request struct RemoveGroupRequest { + group_id groupId = 0; + } + + request struct AddGroupIfIdentifyingRequest { + group_id groupId = 0; + CHAR_STRING groupName = 1; + } + + response struct AddGroupResponse = 0 { + ENUM8 status = 0; + group_id groupId = 1; + } + + response struct ViewGroupResponse = 1 { + ENUM8 status = 0; + group_id groupId = 1; + CHAR_STRING groupName = 2; + } + + response struct GetGroupMembershipResponse = 2 { + nullable INT8U capacity = 0; + group_id groupList[] = 1; + } + + response struct RemoveGroupResponse = 3 { + ENUM8 status = 0; + group_id groupId = 1; + } + + fabric command access(invoke: manage) AddGroup(AddGroupRequest): AddGroupResponse = 0; + fabric command ViewGroup(ViewGroupRequest): ViewGroupResponse = 1; + fabric command GetGroupMembership(GetGroupMembershipRequest): GetGroupMembershipResponse = 2; + fabric command access(invoke: manage) RemoveGroup(RemoveGroupRequest): RemoveGroupResponse = 3; + fabric command access(invoke: manage) RemoveAllGroups(): DefaultSuccess = 4; + fabric command access(invoke: manage) AddGroupIfIdentifying(AddGroupIfIdentifyingRequest): DefaultSuccess = 5; +} + +server cluster Scenes = 5 { + bitmap ScenesCopyMode : BITMAP8 { + kCopyAllScenes = 0x1; + } + + struct ExtensionFieldSet { + cluster_id clusterId = 0; + AttributeValuePair attributeValueList[] = 1; + } + + struct AttributeValuePair { + optional attrib_id attributeId = 0; + int8u attributeValue[] = 1; + } + + readonly attribute int8u sceneCount = 0; + readonly attribute int8u currentScene = 1; + readonly attribute group_id currentGroup = 2; + readonly attribute boolean sceneValid = 3; + readonly attribute bitmap8 nameSupport = 4; + readonly attribute int16u clusterRevision = 65533; + + request struct AddSceneRequest { + group_id groupId = 0; + INT8U sceneId = 1; + INT16U transitionTime = 2; + CHAR_STRING sceneName = 3; + ExtensionFieldSet extensionFieldSets[] = 4; + } + + request struct ViewSceneRequest { + group_id groupId = 0; + INT8U sceneId = 1; + } + + request struct RemoveSceneRequest { + group_id groupId = 0; + INT8U sceneId = 1; + } + + request struct RemoveAllScenesRequest { + group_id groupId = 0; + } + + request struct StoreSceneRequest { + group_id groupId = 0; + INT8U sceneId = 1; + } + + request struct RecallSceneRequest { + group_id groupId = 0; + INT8U sceneId = 1; + optional nullable INT16U transitionTime = 2; + } + + request struct GetSceneMembershipRequest { + group_id groupId = 0; + } + + response struct AddSceneResponse = 0 { + ENUM8 status = 0; + group_id groupId = 1; + INT8U sceneId = 2; + } + + response struct ViewSceneResponse = 1 { + ENUM8 status = 0; + group_id groupId = 1; + INT8U sceneId = 2; + optional INT16U transitionTime = 3; + optional CHAR_STRING sceneName = 4; + optional ExtensionFieldSet extensionFieldSets[] = 5; + } + + response struct RemoveSceneResponse = 2 { + ENUM8 status = 0; + group_id groupId = 1; + INT8U sceneId = 2; + } + + response struct RemoveAllScenesResponse = 3 { + ENUM8 status = 0; + group_id groupId = 1; + } + + response struct StoreSceneResponse = 4 { + ENUM8 status = 0; + group_id groupId = 1; + INT8U sceneId = 2; + } + + response struct GetSceneMembershipResponse = 6 { + ENUM8 status = 0; + nullable INT8U capacity = 1; + group_id groupId = 2; + optional INT8U sceneList[] = 3; + } + + fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; + fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; + fabric command access(invoke: manage) RemoveScene(RemoveSceneRequest): RemoveSceneResponse = 2; + fabric command access(invoke: manage) RemoveAllScenes(RemoveAllScenesRequest): RemoveAllScenesResponse = 3; + fabric command access(invoke: manage) StoreScene(StoreSceneRequest): StoreSceneResponse = 4; + fabric command RecallScene(RecallSceneRequest): DefaultSuccess = 5; + fabric command GetSceneMembership(GetSceneMembershipRequest): GetSceneMembershipResponse = 6; +} + +server cluster OnOff = 6 { + enum OnOffDelayedAllOffEffectVariant : ENUM8 { + kFadeToOffIn0p8Seconds = 0; + kNoFade = 1; + k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds = 2; + } + + enum OnOffDyingLightEffectVariant : ENUM8 { + k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second = 0; + } + + enum OnOffEffectIdentifier : ENUM8 { + kDelayedAllOff = 0; + kDyingLight = 1; + } + + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + + bitmap OnOffControl : BITMAP8 { + kAcceptOnlyWhenOn = 0x1; + } + + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + + bitmap SceneFeatures : BITMAP32 { + kSceneNames = 0x1; + } + + readonly attribute boolean onOff = 0; + readonly attribute int16u clusterRevision = 65533; + + command Off(): DefaultSuccess = 0; + command On(): DefaultSuccess = 1; + command Toggle(): DefaultSuccess = 2; +} + +server cluster LevelControl = 8 { + enum MoveMode : ENUM8 { + kUp = 0; + kDown = 1; + } + + enum StepMode : ENUM8 { + kUp = 0; + kDown = 1; + } + + bitmap LevelControlFeature : BITMAP32 { + kOnOff = 0x1; + kLighting = 0x2; + kFrequency = 0x4; + } + + readonly attribute nullable int8u currentLevel = 0; + readonly attribute int16u remainingTime = 1; + readonly attribute int8u minLevel = 2; + readonly attribute int8u maxLevel = 3; + readonly attribute int16u currentFrequency = 4; + readonly attribute int16u minFrequency = 5; + readonly attribute int16u maxFrequency = 6; + attribute bitmap8 options = 15; + attribute int16u onOffTransitionTime = 16; + attribute nullable int8u onLevel = 17; + attribute nullable int16u onTransitionTime = 18; + attribute nullable int16u offTransitionTime = 19; + attribute nullable int8u defaultMoveRate = 20; + attribute access(write: manage) nullable int8u startUpCurrentLevel = 16384; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct MoveToLevelRequest { + INT8U level = 0; + nullable INT16U transitionTime = 1; + BITMAP8 optionsMask = 2; + BITMAP8 optionsOverride = 3; + } + + request struct MoveRequest { + MoveMode moveMode = 0; + nullable INT8U rate = 1; + BITMAP8 optionsMask = 2; + BITMAP8 optionsOverride = 3; + } + + request struct StepRequest { + StepMode stepMode = 0; + INT8U stepSize = 1; + nullable INT16U transitionTime = 2; + BITMAP8 optionsMask = 3; + BITMAP8 optionsOverride = 4; + } + + request struct StopRequest { + BITMAP8 optionsMask = 0; + BITMAP8 optionsOverride = 1; + } + + request struct MoveToLevelWithOnOffRequest { + INT8U level = 0; + nullable INT16U transitionTime = 1; + BITMAP8 optionsMask = 2; + BITMAP8 optionsOverride = 3; + } + + request struct MoveWithOnOffRequest { + MoveMode moveMode = 0; + nullable INT8U rate = 1; + BITMAP8 optionsMask = 2; + BITMAP8 optionsOverride = 3; + } + + request struct StepWithOnOffRequest { + StepMode stepMode = 0; + INT8U stepSize = 1; + nullable INT16U transitionTime = 2; + BITMAP8 optionsMask = 3; + BITMAP8 optionsOverride = 4; + } + + request struct StopWithOnOffRequest { + BITMAP8 optionsMask = 0; + BITMAP8 optionsOverride = 1; + } + + command MoveToLevel(MoveToLevelRequest): DefaultSuccess = 0; + command Move(MoveRequest): DefaultSuccess = 1; + command Step(StepRequest): DefaultSuccess = 2; + command Stop(StopRequest): DefaultSuccess = 3; + command MoveToLevelWithOnOff(MoveToLevelWithOnOffRequest): DefaultSuccess = 4; + command MoveWithOnOff(MoveWithOnOffRequest): DefaultSuccess = 5; + command StepWithOnOff(StepWithOnOffRequest): DefaultSuccess = 6; + command StopWithOnOff(StopWithOnOffRequest): DefaultSuccess = 7; +} + +server cluster Descriptor = 29 { + struct DeviceType { + devtype_id type = 0; + int16u revision = 1; + } + + readonly attribute DeviceType deviceList[] = 0; + readonly attribute CLUSTER_ID serverList[] = 1; + readonly attribute CLUSTER_ID clientList[] = 2; + readonly attribute ENDPOINT_NO partsList[] = 3; + readonly attribute int16u clusterRevision = 65533; +} + +client cluster Binding = 30 { +} + +server cluster Binding = 30 { +} + +client cluster AccessControl = 31 { + enum AuthMode : ENUM8 { + kPase = 1; + kCase = 2; + kGroup = 3; + } + + enum ChangeTypeEnum : ENUM8 { + kChanged = 0; + kAdded = 1; + kRemoved = 2; + } + + enum Privilege : ENUM8 { + kView = 1; + kProxyView = 2; + kOperate = 3; + kManage = 4; + kAdminister = 5; + } + + struct AccessControlEntry { + Privilege privilege = 1; + AuthMode authMode = 2; + nullable int64u subjects[] = 3; + nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; + } + + struct Target { + nullable cluster_id cluster = 0; + nullable endpoint_no endpoint = 1; + nullable devtype_id deviceType = 2; + } + + struct ExtensionEntry { + octet_string<128> data = 1; + fabric_idx fabricIndex = 254; + } + + info event access(read: administer) AccessControlEntryChanged = 0 { + nullable node_id adminNodeID = 1; + nullable INT16U adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable AccessControlEntry latestValue = 4; + fabric_idx fabricIndex = 254; + } + + info event access(read: administer) AccessControlExtensionChanged = 1 { + nullable node_id adminNodeID = 1; + nullable INT16U adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable ExtensionEntry latestValue = 4; + fabric_idx fabricIndex = 254; + } + + attribute access(read: administer, write: administer) AccessControlEntry acl[] = 0; + attribute access(read: administer, write: administer) ExtensionEntry extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; +} + +server cluster AccessControl = 31 { + enum AuthMode : ENUM8 { + kPase = 1; + kCase = 2; + kGroup = 3; + } + + enum ChangeTypeEnum : ENUM8 { + kChanged = 0; + kAdded = 1; + kRemoved = 2; + } + + enum Privilege : ENUM8 { + kView = 1; + kProxyView = 2; + kOperate = 3; + kManage = 4; + kAdminister = 5; + } + + struct AccessControlEntry { + Privilege privilege = 1; + AuthMode authMode = 2; + nullable int64u subjects[] = 3; + nullable Target targets[] = 4; + fabric_idx fabricIndex = 254; + } + + struct Target { + nullable cluster_id cluster = 0; + nullable endpoint_no endpoint = 1; + nullable devtype_id deviceType = 2; + } + + struct ExtensionEntry { + octet_string<128> data = 1; + fabric_idx fabricIndex = 254; + } + + info event access(read: administer) AccessControlEntryChanged = 0 { + nullable node_id adminNodeID = 1; + nullable INT16U adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable AccessControlEntry latestValue = 4; + fabric_idx fabricIndex = 254; + } + + info event access(read: administer) AccessControlExtensionChanged = 1 { + nullable node_id adminNodeID = 1; + nullable INT16U adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable ExtensionEntry latestValue = 4; + fabric_idx fabricIndex = 254; + } + + attribute access(read: administer, write: administer) AccessControlEntry acl[] = 0; + attribute access(read: administer, write: administer) ExtensionEntry extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; +} + +server cluster Basic = 40 { + struct CapabilityMinimaStruct { + int16u caseSessionsPerFabric = 0; + int16u subscriptionsPerFabric = 1; + } + + critical event StartUp = 0 { + INT32U softwareVersion = 0; + } + + critical event ShutDown = 1 { + } + + info event Leave = 2 { + fabric_idx fabricIndex = 0; + } + + info event ReachableChanged = 3 { + boolean reachableNewValue = 0; + } + + readonly attribute int16u dataModelRevision = 0; + readonly attribute char_string<32> vendorName = 1; + readonly attribute vendor_id vendorID = 2; + readonly attribute char_string<32> productName = 3; + readonly attribute int16u productID = 4; + attribute access(write: manage) char_string<32> nodeLabel = 5; + attribute access(write: administer) char_string<2> location = 6; + readonly attribute int16u hardwareVersion = 7; + readonly attribute char_string<64> hardwareVersionString = 8; + readonly attribute int32u softwareVersion = 9; + readonly attribute char_string<64> softwareVersionString = 10; + readonly attribute char_string<16> manufacturingDate = 11; + readonly attribute char_string<32> partNumber = 12; + readonly attribute long_char_string<256> productURL = 13; + readonly attribute char_string<64> productLabel = 14; + readonly attribute char_string<32> serialNumber = 15; + attribute access(write: manage) boolean localConfigDisabled = 16; + readonly attribute boolean reachable = 17; + readonly attribute char_string<32> uniqueID = 18; + readonly attribute CapabilityMinimaStruct capabilityMinima = 19; + readonly attribute int16u clusterRevision = 65533; +} + +server cluster LocalizationConfiguration = 43 { + readonly attribute CHAR_STRING supportedLocales[] = 1; + readonly attribute int16u clusterRevision = 65533; +} + +server cluster TimeFormatLocalization = 44 { + enum CalendarType : ENUM8 { + kBuddhist = 0; + kChinese = 1; + kCoptic = 2; + kEthiopian = 3; + kGregorian = 4; + kHebrew = 5; + kIndian = 6; + kIslamic = 7; + kJapanese = 8; + kKorean = 9; + kPersian = 10; + kTaiwanese = 11; + } + + enum HourFormat : ENUM8 { + k12hr = 0; + k24hr = 1; + } + + attribute HourFormat hourFormat = 0; + attribute CalendarType activeCalendarType = 1; + readonly attribute CalendarType supportedCalendarTypes[] = 2; + readonly attribute int16u clusterRevision = 65533; +} + +server cluster UnitLocalization = 45 { + enum TempUnit : ENUM8 { + kFahrenheit = 0; + kCelsius = 1; + kKelvin = 2; + } + + bitmap UnitLocalizationFeature : BITMAP32 { + kTemperatureUnit = 0x1; + } + + attribute TempUnit temperatureUnit = 0; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +server cluster GeneralCommissioning = 48 { + enum CommissioningError : ENUM8 { + kOk = 0; + kValueOutsideRange = 1; + kInvalidAuthentication = 2; + kNoFailSafe = 3; + kBusyWithOtherAdmin = 4; + } + + enum RegulatoryLocationType : ENUM8 { + kIndoor = 0; + kOutdoor = 1; + kIndoorOutdoor = 2; + } + + struct BasicCommissioningInfo { + int16u failSafeExpiryLengthSeconds = 0; + int16u maxCumulativeFailsafeSeconds = 1; + } + + attribute access(write: administer) int64u breadcrumb = 0; + readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; + readonly attribute RegulatoryLocationType regulatoryConfig = 2; + readonly attribute RegulatoryLocationType locationCapability = 3; + readonly attribute boolean supportsConcurrentConnection = 4; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ArmFailSafeRequest { + INT16U expiryLengthSeconds = 0; + INT64U breadcrumb = 1; + } + + request struct SetRegulatoryConfigRequest { + RegulatoryLocationType newRegulatoryConfig = 0; + CHAR_STRING countryCode = 1; + INT64U breadcrumb = 2; + } + + response struct ArmFailSafeResponse = 1 { + CommissioningError errorCode = 0; + CHAR_STRING debugText = 1; + } + + response struct SetRegulatoryConfigResponse = 3 { + CommissioningError errorCode = 0; + CHAR_STRING debugText = 1; + } + + response struct CommissioningCompleteResponse = 5 { + CommissioningError errorCode = 0; + CHAR_STRING debugText = 1; + } + + command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; + command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; + fabric command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4; +} + +server cluster NetworkCommissioning = 49 { + enum NetworkCommissioningStatus : ENUM8 { + kSuccess = 0; + kOutOfRange = 1; + kBoundsExceeded = 2; + kNetworkIDNotFound = 3; + kDuplicateNetworkID = 4; + kNetworkNotFound = 5; + kRegulatoryError = 6; + kAuthFailure = 7; + kUnsupportedSecurity = 8; + kOtherConnectionFailure = 9; + kIPV6Failed = 10; + kIPBindFailed = 11; + kUnknownError = 12; + } + + enum WiFiBand : ENUM8 { + k2g4 = 0; + k3g65 = 1; + k5g = 2; + k6g = 3; + k60g = 4; + } + + bitmap NetworkCommissioningFeature : BITMAP32 { + kWiFiNetworkInterface = 0x1; + kThreadNetworkInterface = 0x2; + kEthernetNetworkInterface = 0x4; + } + + bitmap WiFiSecurity : BITMAP8 { + kUnencrypted = 0x1; + kWepPersonal = 0x2; + kWpaPersonal = 0x4; + kWpa2Personal = 0x8; + kWpa3Personal = 0x10; + } + + struct NetworkInfo { + octet_string<32> networkID = 0; + boolean connected = 1; + } + + struct WiFiInterfaceScanResult { + WiFiSecurity security = 0; + octet_string<32> ssid = 1; + octet_string<6> bssid = 2; + int16u channel = 3; + WiFiBand wiFiBand = 4; + int8s rssi = 5; + } + + struct ThreadInterfaceScanResult { + int16u panId = 0; + int64u extendedPanId = 1; + char_string<16> networkName = 2; + int16u channel = 3; + int8u version = 4; + octet_string<8> extendedAddress = 5; + int8s rssi = 6; + int8u lqi = 7; + } + + readonly attribute access(read: administer) int8u maxNetworks = 0; + readonly attribute access(read: administer) NetworkInfo networks[] = 1; + readonly attribute int8u scanMaxTimeSeconds = 2; + readonly attribute int8u connectMaxTimeSeconds = 3; + attribute access(write: administer) boolean interfaceEnabled = 4; + readonly attribute access(read: administer) nullable NetworkCommissioningStatus lastNetworkingStatus = 5; + readonly attribute access(read: administer) nullable octet_string<32> lastNetworkID = 6; + readonly attribute access(read: administer) nullable int32s lastConnectErrorValue = 7; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ScanNetworksRequest { + optional nullable OCTET_STRING ssid = 0; + optional INT64U breadcrumb = 1; + } + + request struct RemoveNetworkRequest { + OCTET_STRING networkID = 0; + optional INT64U breadcrumb = 1; + } + + request struct ConnectNetworkRequest { + OCTET_STRING networkID = 0; + optional INT64U breadcrumb = 1; + } + + request struct ReorderNetworkRequest { + OCTET_STRING networkID = 0; + INT8U networkIndex = 1; + optional INT64U breadcrumb = 2; + } + + response struct ScanNetworksResponse = 1 { + NetworkCommissioningStatus networkingStatus = 0; + optional CHAR_STRING debugText = 1; + optional WiFiInterfaceScanResult wiFiScanResults[] = 2; + optional ThreadInterfaceScanResult threadScanResults[] = 3; + } + + response struct NetworkConfigResponse = 5 { + NetworkCommissioningStatus networkingStatus = 0; + optional CHAR_STRING debugText = 1; + optional INT8U networkIndex = 2; + } + + response struct ConnectNetworkResponse = 7 { + NetworkCommissioningStatus networkingStatus = 0; + optional CHAR_STRING debugText = 1; + nullable INT32S errorValue = 2; + } + + command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; + command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; + command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; + command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; +} + +server cluster DiagnosticLogs = 50 { + enum LogsIntent : ENUM8 { + kEndUserSupport = 0; + kNetworkDiag = 1; + kCrashLogs = 2; + } + + enum LogsStatus : ENUM8 { + kSuccess = 0; + kExhausted = 1; + kNoLogs = 2; + kBusy = 3; + kDenied = 4; + } + + enum LogsTransferProtocol : ENUM8 { + kResponsePayload = 0; + kBdx = 1; + } + + + request struct RetrieveLogsRequestRequest { + LogsIntent intent = 0; + LogsTransferProtocol requestedProtocol = 1; + OCTET_STRING transferFileDesignator = 2; + } + + command RetrieveLogsRequest(RetrieveLogsRequestRequest): RetrieveLogsResponse = 0; +} + +server cluster GeneralDiagnostics = 51 { + enum BootReasonType : ENUM8 { + kUnspecified = 0; + kPowerOnReboot = 1; + kBrownOutReset = 2; + kSoftwareWatchdogReset = 3; + kHardwareWatchdogReset = 4; + kSoftwareUpdateCompleted = 5; + kSoftwareReset = 6; + } + + enum HardwareFaultType : ENUM8 { + kUnspecified = 0; + kRadio = 1; + kSensor = 2; + kResettableOverTemp = 3; + kNonResettableOverTemp = 4; + kPowerSource = 5; + kVisualDisplayFault = 6; + kAudioOutputFault = 7; + kUserInterfaceFault = 8; + kNonVolatileMemoryError = 9; + kTamperDetected = 10; + } + + enum InterfaceType : ENUM8 { + kUnspecified = 0; + kWiFi = 1; + kEthernet = 2; + kCellular = 3; + kThread = 4; + } + + enum NetworkFaultType : ENUM8 { + kUnspecified = 0; + kHardwareFailure = 1; + kNetworkJammed = 2; + kConnectionFailed = 3; + } + + enum RadioFaultType : ENUM8 { + kUnspecified = 0; + kWiFiFault = 1; + kCellularFault = 2; + kThreadFault = 3; + kNFCFault = 4; + kBLEFault = 5; + kEthernetFault = 6; + } + + struct NetworkInterfaceType { + char_string<32> name = 0; + boolean isOperational = 1; + nullable boolean offPremiseServicesReachableIPv4 = 2; + nullable boolean offPremiseServicesReachableIPv6 = 3; + octet_string<8> hardwareAddress = 4; + octet_string IPv4Addresses[] = 5; + octet_string IPv6Addresses[] = 6; + InterfaceType type = 7; + } + + critical event HardwareFaultChange = 0 { + HardwareFaultType current[] = 0; + HardwareFaultType previous[] = 1; + } + + critical event RadioFaultChange = 1 { + RadioFaultType current[] = 0; + RadioFaultType previous[] = 1; + } + + critical event NetworkFaultChange = 2 { + NetworkFaultType current[] = 0; + NetworkFaultType previous[] = 1; + } + + critical event BootReason = 3 { + BootReasonType bootReason = 0; + } + + readonly attribute NetworkInterfaceType networkInterfaces[] = 0; + readonly attribute int16u rebootCount = 1; + readonly attribute int64u upTime = 2; + readonly attribute int32u totalOperationalHours = 3; + readonly attribute enum8 bootReasons = 4; + readonly attribute ENUM8 activeHardwareFaults[] = 5; + readonly attribute ENUM8 activeRadioFaults[] = 6; + readonly attribute ENUM8 activeNetworkFaults[] = 7; + readonly attribute int16u clusterRevision = 65533; +} + +server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + + struct ThreadMetrics { + int64u id = 0; + optional char_string<8> name = 1; + optional int32u stackFreeCurrent = 2; + optional int32u stackFreeMinimum = 3; + optional int32u stackSize = 4; + } + + info event SoftwareFault = 0 { + INT64U id = 0; + optional CHAR_STRING name = 1; + optional OCTET_STRING faultRecording = 2; + } + + readonly attribute ThreadMetrics threadMetrics[] = 0; + readonly attribute int64u currentHeapFree = 1; + readonly attribute int64u currentHeapUsed = 2; + readonly attribute int64u currentHeapHighWatermark = 3; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +server cluster EthernetNetworkDiagnostics = 55 { + enum PHYRateType : ENUM8 { + k10m = 0; + k100m = 1; + k1000m = 2; + k25g = 3; + k5g = 4; + k10g = 5; + k40g = 6; + k100g = 7; + k200g = 8; + k400g = 9; + } + + readonly attribute nullable PHYRateType PHYRate = 0; + readonly attribute nullable boolean fullDuplex = 1; + readonly attribute int64u packetRxCount = 2; + readonly attribute int64u packetTxCount = 3; + readonly attribute int64u txErrCount = 4; + readonly attribute int64u collisionCount = 5; + readonly attribute int64u overrunCount = 6; + readonly attribute nullable boolean carrierDetect = 7; + readonly attribute int64u timeSinceReset = 8; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +server cluster Switch = 59 { + info event SwitchLatched = 0 { + INT8U newPosition = 0; + } + + info event InitialPress = 1 { + INT8U newPosition = 0; + } + + info event LongPress = 2 { + INT8U newPosition = 0; + } + + info event ShortRelease = 3 { + INT8U previousPosition = 0; + } + + info event LongRelease = 4 { + INT8U previousPosition = 0; + } + + info event MultiPressOngoing = 5 { + INT8U newPosition = 0; + INT8U currentNumberOfPressesCounted = 1; + } + + info event MultiPressComplete = 6 { + INT8U newPosition = 0; + INT8U totalNumberOfPressesCounted = 1; + } + + readonly attribute int8u numberOfPositions = 0; + readonly attribute int8u currentPosition = 1; + readonly attribute int8u multiPressMax = 2; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +server cluster AdministratorCommissioning = 60 { + enum CommissioningWindowStatus : ENUM8 { + kWindowNotOpen = 0; + kEnhancedWindowOpen = 1; + kBasicWindowOpen = 2; + } + + enum StatusCode : ENUM8 { + kBusy = 2; + kPAKEParameterError = 3; + kWindowNotOpen = 4; + } + + readonly attribute CommissioningWindowStatus windowStatus = 0; + readonly attribute nullable fabric_idx adminFabricIndex = 1; + readonly attribute nullable int16u adminVendorId = 2; + readonly attribute int16u clusterRevision = 65533; + + request struct OpenCommissioningWindowRequest { + INT16U commissioningTimeout = 0; + OCTET_STRING PAKEVerifier = 1; + INT16U discriminator = 2; + INT32U iterations = 3; + OCTET_STRING salt = 4; + } + + request struct OpenBasicCommissioningWindowRequest { + INT16U commissioningTimeout = 0; + } + + timed command access(invoke: administer) OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; + timed command access(invoke: administer) OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; + timed command access(invoke: administer) RevokeCommissioning(): DefaultSuccess = 2; +} + +server cluster OperationalCredentials = 62 { + enum OperationalCertStatus : ENUM8 { + kSuccess = 0; + kInvalidPublicKey = 1; + kInvalidNodeOpId = 2; + kInvalidNOC = 3; + kMissingCsr = 4; + kTableFull = 5; + kInvalidAdminSubject = 6; + kFabricConflict = 9; + kLabelConflict = 10; + kInvalidFabricIndex = 11; + } + + struct NOCStruct { + octet_string noc = 1; + nullable octet_string icac = 2; + fabric_idx fabricIndex = 254; + } + + struct FabricDescriptor { + octet_string<65> rootPublicKey = 1; + vendor_id vendorId = 2; + fabric_id fabricId = 3; + node_id nodeId = 4; + char_string<32> label = 5; + fabric_idx fabricIndex = 254; + } + + readonly attribute access(read: administer) NOCStruct NOCs[] = 0; + readonly attribute FabricDescriptor fabrics[] = 1; + readonly attribute int8u supportedFabrics = 2; + readonly attribute int8u commissionedFabrics = 3; + readonly attribute OCTET_STRING trustedRootCertificates[] = 4; + readonly attribute int8u currentFabricIndex = 5; + readonly attribute int16u clusterRevision = 65533; + + request struct AttestationRequestRequest { + OCTET_STRING attestationNonce = 0; + } + + request struct CertificateChainRequestRequest { + INT8U certificateType = 0; + } + + request struct CSRRequestRequest { + OCTET_STRING CSRNonce = 0; + optional boolean isForUpdateNOC = 1; + } + + request struct AddNOCRequest { + OCTET_STRING NOCValue = 0; + optional OCTET_STRING ICACValue = 1; + OCTET_STRING IPKValue = 2; + Int64u caseAdminSubject = 3; + VENDOR_ID adminVendorId = 4; + } + + request struct UpdateNOCRequest { + OCTET_STRING NOCValue = 0; + optional OCTET_STRING ICACValue = 1; + } + + request struct UpdateFabricLabelRequest { + CHAR_STRING label = 0; + } + + request struct RemoveFabricRequest { + fabric_idx fabricIndex = 0; + } + + request struct AddTrustedRootCertificateRequest { + OCTET_STRING rootCertificate = 0; + } + + response struct AttestationResponse = 1 { + OCTET_STRING attestationElements = 0; + OCTET_STRING signature = 1; + } + + response struct CertificateChainResponse = 3 { + OCTET_STRING certificate = 0; + } + + response struct CSRResponse = 5 { + OCTET_STRING NOCSRElements = 0; + OCTET_STRING attestationSignature = 1; + } + + response struct NOCResponse = 8 { + OperationalCertStatus statusCode = 0; + optional fabric_idx fabricIndex = 1; + optional CHAR_STRING debugText = 2; + } + + command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; + command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; + command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4; + command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6; + fabric command access(invoke: administer) UpdateNOC(UpdateNOCRequest): NOCResponse = 7; + fabric command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; + command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10; + command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; +} + +server cluster GroupKeyManagement = 63 { + enum GroupKeySecurityPolicy : ENUM8 { + kTrustFirst = 0; + kCacheAndSync = 1; + } + + struct GroupKeyMapStruct { + group_id groupId = 1; + int16u groupKeySetID = 2; + fabric_idx fabricIndex = 254; + } + + struct GroupInfoMapStruct { + group_id groupId = 1; + endpoint_no endpoints[] = 2; + optional char_string<16> groupName = 3; + fabric_idx fabricIndex = 254; + } + + struct GroupKeySetStruct { + int16u groupKeySetID = 0; + GroupKeySecurityPolicy groupKeySecurityPolicy = 1; + nullable octet_string<16> epochKey0 = 2; + nullable epoch_us epochStartTime0 = 3; + nullable octet_string<16> epochKey1 = 4; + nullable epoch_us epochStartTime1 = 5; + nullable octet_string<16> epochKey2 = 6; + nullable epoch_us epochStartTime2 = 7; + } + + attribute access(write: manage) GroupKeyMapStruct groupKeyMap[] = 0; + readonly attribute GroupInfoMapStruct groupTable[] = 1; + readonly attribute int16u maxGroupsPerFabric = 2; + readonly attribute int16u maxGroupKeysPerFabric = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute int16u clusterRevision = 65533; + + request struct KeySetWriteRequest { + GroupKeySetStruct groupKeySet = 0; + } + + request struct KeySetReadRequest { + INT16U groupKeySetID = 0; + } + + request struct KeySetRemoveRequest { + INT16U groupKeySetID = 0; + } + + request struct KeySetReadAllIndicesRequest { + INT16U groupKeySetIDs[] = 0; + } + + response struct KeySetReadResponse = 2 { + GroupKeySetStruct groupKeySet = 0; + } + + response struct KeySetReadAllIndicesResponse = 5 { + INT16U groupKeySetIDs[] = 0; + } + + fabric command access(invoke: administer) KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; + fabric command access(invoke: administer) KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; + fabric command access(invoke: administer) KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; + fabric command access(invoke: administer) KeySetReadAllIndices(KeySetReadAllIndicesRequest): KeySetReadAllIndicesResponse = 4; +} + +server cluster FixedLabel = 64 { + readonly attribute LabelStruct labelList[] = 0; + readonly attribute int16u clusterRevision = 65533; +} + +server cluster UserLabel = 65 { + attribute access(write: manage) LabelStruct labelList[] = 0; + readonly attribute int16u clusterRevision = 65533; +} + +endpoint 0 { + device type bridge = 14; + binding cluster AccessControl; + + server cluster Identify { + } + + server cluster Groups { + } + + server cluster Descriptor { + callback attribute deviceList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute clusterRevision default = 1; + } + + server cluster Binding { + } + + server cluster AccessControl { + callback attribute acl; + callback attribute extension; + callback attribute subjectsPerAccessControlEntry default = 4; + callback attribute targetsPerAccessControlEntry default = 3; + callback attribute accessControlEntriesPerFabric default = 3; + callback attribute attributeList; + ram attribute clusterRevision default = 1; + } + + server cluster Basic { + callback attribute dataModelRevision default = 10; + callback attribute vendorName; + callback attribute vendorID; + callback attribute productName; + callback attribute productID; + persist attribute nodeLabel; + callback attribute location default = "XX"; + callback attribute hardwareVersion; + callback attribute hardwareVersionString; + callback attribute softwareVersion; + callback attribute softwareVersionString; + callback attribute manufacturingDate default = "20210614123456ZZ"; + callback attribute partNumber; + callback attribute productURL; + callback attribute productLabel; + callback attribute serialNumber; + persist attribute localConfigDisabled; + ram attribute reachable default = 1; + callback attribute uniqueID; + callback attribute capabilityMinima; + ram attribute clusterRevision default = 1; + } + + server cluster LocalizationConfiguration { + callback attribute supportedLocales default = en-US; + ram attribute clusterRevision default = 1; + } + + server cluster TimeFormatLocalization { + persist attribute hourFormat; + persist attribute activeCalendarType; + callback attribute supportedCalendarTypes; + ram attribute clusterRevision default = 1; + } + + server cluster UnitLocalization { + persist attribute temperatureUnit; + ram attribute featureMap default = 0x1; + ram attribute clusterRevision default = 1; + } + + server cluster GeneralCommissioning { + ram attribute breadcrumb; + callback attribute basicCommissioningInfo; + callback attribute regulatoryConfig; + callback attribute locationCapability; + callback attribute supportsConcurrentConnection default = 1; + ram attribute featureMap default = 6; + ram attribute clusterRevision default = 1; + } + + server cluster NetworkCommissioning { + ram attribute maxNetworks; + callback attribute networks; + ram attribute scanMaxTimeSeconds; + ram attribute connectMaxTimeSeconds; + ram attribute interfaceEnabled; + ram attribute lastNetworkingStatus; + ram attribute lastNetworkID; + ram attribute lastConnectErrorValue; + ram attribute featureMap default = 4; + ram attribute clusterRevision default = 1; + } + + server cluster DiagnosticLogs { + } + + server cluster GeneralDiagnostics { + callback attribute networkInterfaces; + callback attribute rebootCount; + callback attribute upTime; + callback attribute totalOperationalHours; + callback attribute bootReasons; + callback attribute activeHardwareFaults; + callback attribute activeRadioFaults; + callback attribute activeNetworkFaults; + ram attribute clusterRevision default = 1; + } + + server cluster SoftwareDiagnostics { + callback attribute threadMetrics; + callback attribute currentHeapFree; + callback attribute currentHeapUsed; + callback attribute currentHeapHighWatermark; + ram attribute featureMap default = 1; + ram attribute clusterRevision default = 1; + } + + server cluster EthernetNetworkDiagnostics { + callback attribute PHYRate; + callback attribute fullDuplex; + callback attribute packetRxCount; + callback attribute packetTxCount; + callback attribute txErrCount; + callback attribute collisionCount; + callback attribute overrunCount; + callback attribute carrierDetect; + callback attribute timeSinceReset; + ram attribute featureMap default = 3; + ram attribute clusterRevision default = 1; + } + + server cluster AdministratorCommissioning { + callback attribute windowStatus; + callback attribute adminFabricIndex default = 1; + callback attribute adminVendorId; + ram attribute clusterRevision default = 1; + } + + server cluster OperationalCredentials { + callback attribute NOCs; + callback attribute fabrics; + callback attribute supportedFabrics; + callback attribute commissionedFabrics; + callback attribute trustedRootCertificates; + callback attribute currentFabricIndex; + ram attribute clusterRevision default = 1; + } + + server cluster GroupKeyManagement { + callback attribute groupKeyMap; + callback attribute groupTable; + callback attribute maxGroupsPerFabric; + callback attribute maxGroupKeysPerFabric; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute clusterRevision default = 1; + } + + server cluster FixedLabel { + callback attribute labelList; + ram attribute clusterRevision default = 1; + } + + server cluster UserLabel { + callback attribute labelList; + ram attribute clusterRevision default = 1; + } +} +endpoint 1 { + device type dimmablelight = 257; + binding cluster Binding; + + server cluster Identify { + ram attribute identifyTime; + ram attribute clusterRevision default = 4; + } + + server cluster Groups { + ram attribute nameSupport; + ram attribute clusterRevision default = 4; + } + + server cluster Scenes { + ram attribute sceneCount; + ram attribute currentScene; + ram attribute currentGroup; + ram attribute sceneValid; + ram attribute nameSupport; + ram attribute clusterRevision default = 4; + } + + server cluster OnOff { + ram attribute onOff; + ram attribute clusterRevision default = 4; + } + + server cluster LevelControl { + persist attribute currentLevel; + ram attribute remainingTime; + ram attribute minLevel; + ram attribute maxLevel default = 0xFE; + ram attribute currentFrequency; + ram attribute minFrequency; + ram attribute maxFrequency; + ram attribute options; + ram attribute onOffTransitionTime; + ram attribute onLevel default = 0xFE; + ram attribute onTransitionTime; + ram attribute offTransitionTime; + ram attribute defaultMoveRate; + persist attribute startUpCurrentLevel default = 255; + ram attribute featureMap default = 3; + ram attribute clusterRevision default = 5; + } + + server cluster Descriptor { + callback attribute deviceList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute clusterRevision default = 1; + } + + server cluster Switch { + ram attribute numberOfPositions default = 2; + ram attribute currentPosition default = 1; + ram attribute multiPressMax default = 2; + ram attribute featureMap; + ram attribute clusterRevision default = 1; + } + + server cluster FixedLabel { + callback attribute labelList; + ram attribute clusterRevision default = 1; + } +} + + diff --git a/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/unify-matter-bridge.zap b/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/unify-matter-bridge.zap new file mode 100644 index 00000000000000..35794fc119a06a --- /dev/null +++ b/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/unify-matter-bridge.zap @@ -0,0 +1,5777 @@ +{ + "featureLevel": 75, + "creator": "zap", + "keyValuePairs": [ + { + "key": "commandDiscovery", + "value": "1" + }, + { + "key": "defaultResponsePolicy", + "value": "always" + }, + { + "key": "manufacturerCodes", + "value": "0x1002" + } + ], + "package": [ + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", + "category": "matter", + "version": 1, + "description": "Matter SDK ZCL data" + }, + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" + } + ], + "endpointTypes": [ + { + "name": "MA-bridge", + "deviceTypeName": "MA-bridge", + "deviceTypeCode": 14, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [] + }, + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "device list", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "server list", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "client list", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "parts list", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Binding", + "code": 30, + "mfgCode": null, + "define": "BINDING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [] + }, + { + "name": "Binding", + "code": 30, + "mfgCode": null, + "define": "BINDING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [] + }, + { + "name": "Access Control", + "code": 31, + "mfgCode": null, + "define": "ACCESS_CONTROL_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Access Control", + "code": 31, + "mfgCode": null, + "define": "ACCESS_CONTROL_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "ACL", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Extension", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SubjectsPerAccessControlEntry", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetsPerAccessControlEntry", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AccessControlEntriesPerFabric", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Basic", + "code": 40, + "mfgCode": null, + "define": "BASIC_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Basic", + "code": 40, + "mfgCode": null, + "define": "BASIC_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "DataModelRevision", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "10", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorName", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorID", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "vendor_id", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductName", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductID", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NodeLabel", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "NVM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Location", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "XX", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersion", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersionString", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersion", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersionString", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ManufacturingDate", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "20210614123456ZZ", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartNumber", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductURL", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "long_char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductLabel", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SerialNumber", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LocalConfigDisabled", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "NVM", + "singleton": 1, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Reachable", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "CapabilityMinimaStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Localization Configuration", + "code": 43, + "mfgCode": null, + "define": "LOCALIZATION_CONFIGURATION_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [] + }, + { + "name": "Localization Configuration", + "code": 43, + "mfgCode": null, + "define": "LOCALIZATION_CONFIGURATION_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "SupportedLocales", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "en-US", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Time Format Localization", + "code": 44, + "mfgCode": null, + "define": "TIME_FORMAT_LOCALIZATION_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [] + }, + { + "name": "Time Format Localization", + "code": 44, + "mfgCode": null, + "define": "TIME_FORMAT_LOCALIZATION_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "HourFormat", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "HourFormat", + "included": 1, + "storageOption": "NVM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveCalendarType", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "CalendarType", + "included": 1, + "storageOption": "NVM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportedCalendarTypes", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Unit Localization", + "code": 45, + "mfgCode": null, + "define": "UNIT_LOCALIZATION_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [] + }, + { + "name": "Unit Localization", + "code": 45, + "mfgCode": null, + "define": "UNIT_LOCALIZATION_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "TemperatureUnit", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "TempUnit", + "included": 1, + "storageOption": "NVM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "General Commissioning", + "code": 48, + "mfgCode": null, + "define": "GENERAL_COMMISSIONING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "ArmFailSafe", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "SetRegulatoryConfig", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "CommissioningComplete", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "General Commissioning", + "code": 48, + "mfgCode": null, + "define": "GENERAL_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ArmFailSafeResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "SetRegulatoryConfigResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "CommissioningCompleteResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "Breadcrumb", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "BasicCommissioningInfo", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "BasicCommissioningInfo", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RegulatoryConfig", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "RegulatoryLocationType", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LocationCapability", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "RegulatoryLocationType", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportsConcurrentConnection", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "6", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "ScanNetworks", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "AddOrUpdateWiFiNetwork", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 0 + }, + { + "name": "AddOrUpdateThreadNetwork", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 0 + }, + { + "name": "RemoveNetwork", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ConnectNetwork", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ReorderNetwork", + "code": 8, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ScanNetworksResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "NetworkConfigResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ConnectNetworkResponse", + "code": 7, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "MaxNetworks", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Networks", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ScanMaxTimeSeconds", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ConnectMaxTimeSeconds", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "InterfaceEnabled", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastNetworkingStatus", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "NetworkCommissioningStatus", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastNetworkID", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastConnectErrorValue", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int32s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Diagnostic Logs", + "code": 50, + "mfgCode": null, + "define": "DIAGNOSTIC_LOGS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "RetrieveLogsRequest", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [] + }, + { + "name": "General Diagnostics", + "code": 51, + "mfgCode": null, + "define": "GENERAL_DIAGNOSTICS_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "General Diagnostics", + "code": 51, + "mfgCode": null, + "define": "GENERAL_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "NetworkInterfaces", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RebootCount", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpTime", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TotalOperationalHours", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BootReasons", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "enum8", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveHardwareFaults", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveRadioFaults", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveNetworkFaults", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Software Diagnostics", + "code": 52, + "mfgCode": null, + "define": "SOFTWARE_DIAGNOSTICS_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "ResetWatermarks", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Software Diagnostics", + "code": 52, + "mfgCode": null, + "define": "SOFTWARE_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "ThreadMetrics", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapFree", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapUsed", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapHighWatermark", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Thread Network Diagnostics", + "code": 53, + "mfgCode": null, + "define": "THREAD_NETWORK_DIAGNOSTICS_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [] + }, + { + "name": "Thread Network Diagnostics", + "code": 53, + "mfgCode": null, + "define": "THREAD_NETWORK_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "channel", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RoutingRole", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "RoutingRole", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NetworkName", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PanId", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ExtendedPanId", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "MeshLocalPrefix", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "OverrunCount", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NeighborTableList", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RouteTableList", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartitionId", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "weighting", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "DataVersion", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "StableDataVersion", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LeaderRouterId", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "DetachedRoleCount", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ChildRoleCount", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RouterRoleCount", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LeaderRoleCount", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "AttachAttemptCount", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartitionIdChangeCount", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "BetterPartitionAttachAttemptCount", + "code": 20, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ParentChangeCount", + "code": 21, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxTotalCount", + "code": 22, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxUnicastCount", + "code": 23, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBroadcastCount", + "code": 24, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxAckRequestedCount", + "code": 25, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxAckedCount", + "code": 26, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxNoAckRequestedCount", + "code": 27, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDataCount", + "code": 28, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDataPollCount", + "code": 29, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBeaconCount", + "code": 30, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBeaconRequestCount", + "code": 31, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxOtherCount", + "code": 32, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxRetryCount", + "code": 33, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDirectMaxRetryExpiryCount", + "code": 34, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxIndirectMaxRetryExpiryCount", + "code": 35, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrCcaCount", + "code": 36, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrAbortCount", + "code": 37, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrBusyChannelCount", + "code": 38, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxTotalCount", + "code": 39, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxUnicastCount", + "code": 40, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBroadcastCount", + "code": 41, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDataCount", + "code": 42, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDataPollCount", + "code": 43, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBeaconCount", + "code": 44, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBeaconRequestCount", + "code": 45, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxOtherCount", + "code": 46, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxAddressFilteredCount", + "code": 47, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDestAddrFilteredCount", + "code": 48, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDuplicatedCount", + "code": 49, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrNoFrameCount", + "code": 50, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrUnknownNeighborCount", + "code": 51, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrInvalidSrcAddrCount", + "code": 52, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrSecCount", + "code": 53, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrFcsCount", + "code": 54, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrOtherCount", + "code": 55, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ActiveTimestamp", + "code": 56, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PendingTimestamp", + "code": 57, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "delay", + "code": 58, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SecurityPolicy", + "code": 59, + "mfgCode": null, + "side": "server", + "type": "SecurityPolicy", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ChannelMask", + "code": 60, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "OperationalDatasetComponents", + "code": 61, + "mfgCode": null, + "side": "server", + "type": "OperationalDatasetComponents", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ActiveNetworkFaultsList", + "code": 62, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "15", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "WiFi Network Diagnostics", + "code": 54, + "mfgCode": null, + "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "WiFi Network Diagnostics", + "code": 54, + "mfgCode": null, + "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "bssid", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SecurityType", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "SecurityType", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "WiFiVersion", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "WiFiVersionType", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ChannelNumber", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Rssi", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int8s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "BeaconLostCount", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BeaconRxCount", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PacketMulticastRxCount", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PacketMulticastTxCount", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PacketUnicastRxCount", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PacketUnicastTxCount", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentMaxRate", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OverrunCount", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Ethernet Network Diagnostics", + "code": 55, + "mfgCode": null, + "define": "ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "ResetCounts", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Ethernet Network Diagnostics", + "code": 55, + "mfgCode": null, + "define": "ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "PHYRate", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "PHYRateType", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FullDuplex", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PacketRxCount", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PacketTxCount", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrCount", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CollisionCount", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "OverrunCount", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CarrierDetect", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TimeSinceReset", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "AdministratorCommissioning", + "code": 60, + "mfgCode": null, + "define": "ADMINISTRATOR_COMMISSIONING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "OpenCommissioningWindow", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "OpenBasicCommissioningWindow", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "RevokeCommissioning", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "AdministratorCommissioning", + "code": 60, + "mfgCode": null, + "define": "ADMINISTRATOR_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "WindowStatus", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AdminFabricIndex", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "fabric_idx", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AdminVendorId", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Operational Credentials", + "code": 62, + "mfgCode": null, + "define": "OPERATIONAL_CREDENTIALS_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "AttestationRequest", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "CertificateChainRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "CSRRequest", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "AddNOC", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "UpdateNOC", + "code": 7, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "UpdateFabricLabel", + "code": 9, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "RemoveFabric", + "code": 10, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "AddTrustedRootCertificate", + "code": 11, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Operational Credentials", + "code": 62, + "mfgCode": null, + "define": "OPERATIONAL_CREDENTIALS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AttestationResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "CertificateChainResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "CSRResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "NOCResponse", + "code": 8, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "NOCs", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Fabrics", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SupportedFabrics", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CommissionedFabrics", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TrustedRootCertificates", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CurrentFabricIndex", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "fabric_idx", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Group Key Management", + "code": 63, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "KeySetWrite", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "KeySetRead", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "KeySetRemove", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "KeySetReadAllIndices", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [] + }, + { + "name": "Group Key Management", + "code": 63, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "KeySetReadResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "KeySetReadAllIndicesResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "GroupKeyMap", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GroupTable", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxGroupsPerFabric", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxGroupKeysPerFabric", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Fixed Label", + "code": 64, + "mfgCode": null, + "define": "FIXED_LABEL_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [] + }, + { + "name": "Fixed Label", + "code": 64, + "mfgCode": null, + "define": "FIXED_LABEL_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "label list", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "User Label", + "code": 65, + "mfgCode": null, + "define": "USER_LABEL_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [] + }, + { + "name": "User Label", + "code": 65, + "mfgCode": null, + "define": "USER_LABEL_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "label list", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + } + ] + }, + { + "name": "MA-dimmablelight", + "deviceTypeName": "MA-dimmablelight", + "deviceTypeCode": 257, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "identify time", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "AddGroup", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ViewGroup", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetGroupMembership", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveGroup", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveAllGroups", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "AddGroupIfIdentifying", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AddGroupResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ViewGroupResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetGroupMembershipResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveGroupResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "name support", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "bitmap8", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Scenes", + "code": 5, + "mfgCode": null, + "define": "SCENES_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "AddScene", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ViewScene", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveScene", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveAllScenes", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "StoreScene", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RecallScene", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetSceneMembership", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Scenes", + "code": 5, + "mfgCode": null, + "define": "SCENES_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AddSceneResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ViewSceneResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveSceneResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveAllScenesResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "StoreSceneResponse", + "code": 4, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetSceneMembershipResponse", + "code": 6, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "SceneCount", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CurrentScene", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CurrentGroup", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "group_id", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SceneValid", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NameSupport", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "bitmap8", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "On/Off", + "code": 6, + "mfgCode": null, + "define": "ON_OFF_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "Off", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "On", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "Toggle", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "On/Off", + "code": 6, + "mfgCode": null, + "define": "ON_OFF_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "OnOff", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Level Control", + "code": 8, + "mfgCode": null, + "define": "LEVEL_CONTROL_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "MoveToLevel", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "Move", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "Step", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "Stop", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "MoveToLevelWithOnOff", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "MoveWithOnOff", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "StepWithOnOff", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "StopWithOnOff", + "code": 7, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "5", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Level Control", + "code": 8, + "mfgCode": null, + "define": "LEVEL_CONTROL_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "current level", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "NVM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "remaining time", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "min level", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "max level", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFE", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "current frequency", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "min frequency", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "max frequency", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "options", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "bitmap8", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "on off transition time", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "on level", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFE", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "on transition time", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "off transition time", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "default move rate", + "code": 20, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "start up current level", + "code": 16384, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "NVM", + "singleton": 0, + "bounded": 0, + "defaultValue": "255", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "5", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "device list", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "server list", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "client list", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "parts list", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Binding", + "code": 30, + "mfgCode": null, + "define": "BINDING_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [] + }, + { + "name": "Binding", + "code": 30, + "mfgCode": null, + "define": "BINDING_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [] + }, + { + "name": "Basic", + "code": 40, + "mfgCode": null, + "define": "BASIC_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Basic", + "code": 40, + "mfgCode": null, + "define": "BASIC_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "DataModelRevision", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "10", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorName", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorID", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "vendor_id", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductName", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductID", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NodeLabel", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "NVM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Location", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "XX", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersion", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersionString", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersion", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersionString", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ManufacturingDate", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "20210614123456ZZ", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartNumber", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductURL", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "long_char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductLabel", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SerialNumber", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LocalConfigDisabled", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "NVM", + "singleton": 1, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Reachable", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "CapabilityMinimaStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "number of positions", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current position", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "multi press max", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Fixed Label", + "code": 64, + "mfgCode": null, + "define": "FIXED_LABEL_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Fixed Label", + "code": 64, + "mfgCode": null, + "define": "FIXED_LABEL_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "label list", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + } + ] + } + ], + "endpoints": [ + { + "endpointTypeName": "MA-bridge", + "endpointTypeIndex": 0, + "profileId": 259, + "endpointId": 0, + "networkId": 0, + "endpointVersion": 1, + "deviceIdentifier": 14 + }, + { + "endpointTypeName": "MA-dimmablelight", + "endpointTypeIndex": 1, + "profileId": 259, + "endpointId": 1, + "networkId": 0, + "endpointVersion": 1, + "deviceIdentifier": 257 + } + ], + "log": [] +} \ No newline at end of file diff --git a/zzz_generated/unify-matter-bridge/zap-generated/CHIPClientCallbacks.h b/zzz_generated/unify-matter-bridge/zap-generated/CHIPClientCallbacks.h new file mode 100644 index 00000000000000..8c19024e86dfdc --- /dev/null +++ b/zzz_generated/unify-matter-bridge/zap-generated/CHIPClientCallbacks.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 + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// List specific responses +typedef void (*AccessControlAclListAttributeCallback)( + void * context, + const chip::app::DataModel::DecodableList & + data); +typedef void (*AccessControlExtensionListAttributeCallback)( + void * context, + const chip::app::DataModel::DecodableList & data); +typedef void (*AccessControlAttributeListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); diff --git a/zzz_generated/unify-matter-bridge/zap-generated/CHIPClusters.h b/zzz_generated/unify-matter-bridge/zap-generated/CHIPClusters.h new file mode 100644 index 00000000000000..ca9ff71b7644f9 --- /dev/null +++ b/zzz_generated/unify-matter-bridge/zap-generated/CHIPClusters.h @@ -0,0 +1,52 @@ +/* + * + * 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 BindingCluster : public ClusterBase +{ +public: + BindingCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : + ClusterBase(exchangeManager, session, app::Clusters::Binding::Id, endpoint) + {} + ~BindingCluster() {} +}; + +class DLL_EXPORT AccessControlCluster : public ClusterBase +{ +public: + AccessControlCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : + ClusterBase(exchangeManager, session, app::Clusters::AccessControl::Id, endpoint) + {} + ~AccessControlCluster() {} +}; + +} // namespace Controller +} // namespace chip diff --git a/zzz_generated/unify-matter-bridge/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/unify-matter-bridge/zap-generated/IMClusterCommandHandler.cpp new file mode 100644 index 00000000000000..7d5c98cdc61fa8 --- /dev/null +++ b/zzz_generated/unify-matter-bridge/zap-generated/IMClusterCommandHandler.cpp @@ -0,0 +1,842 @@ +/* + * + * 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 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 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; + } + 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::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 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; + } + 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; + } + 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 Scenes { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::AddScene::Id: { + Commands::AddScene::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfScenesClusterAddSceneCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::ViewScene::Id: { + Commands::ViewScene::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfScenesClusterViewSceneCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::RemoveScene::Id: { + Commands::RemoveScene::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfScenesClusterRemoveSceneCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::RemoveAllScenes::Id: { + Commands::RemoveAllScenes::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfScenesClusterRemoveAllScenesCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::StoreScene::Id: { + Commands::StoreScene::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfScenesClusterStoreSceneCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::RecallScene::Id: { + Commands::RecallScene::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfScenesClusterRecallSceneCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::GetSceneMembership::Id: { + Commands::GetSceneMembership::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfScenesClusterGetSceneMembershipCallback(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 Scenes + +} // 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::DiagnosticLogs::Id: + Clusters::DiagnosticLogs::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::OnOff::Id: + Clusters::OnOff::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::OperationalCredentials::Id: + Clusters::OperationalCredentials::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::Scenes::Id: + Clusters::Scenes::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/zzz_generated/unify-matter-bridge/zap-generated/PluginApplicationCallbacks.h b/zzz_generated/unify-matter-bridge/zap-generated/PluginApplicationCallbacks.h new file mode 100644 index 00000000000000..0131ce32038531 --- /dev/null +++ b/zzz_generated/unify-matter-bridge/zap-generated/PluginApplicationCallbacks.h @@ -0,0 +1,50 @@ +/* + * + * 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 \ + MatterIdentifyPluginServerInitCallback(); \ + MatterGroupsPluginServerInitCallback(); \ + MatterScenesPluginServerInitCallback(); \ + MatterOnOffPluginServerInitCallback(); \ + MatterLevelControlPluginServerInitCallback(); \ + MatterDescriptorPluginServerInitCallback(); \ + MatterBindingPluginClientInitCallback(); \ + MatterBindingPluginServerInitCallback(); \ + MatterAccessControlPluginClientInitCallback(); \ + MatterAccessControlPluginServerInitCallback(); \ + MatterBasicPluginServerInitCallback(); \ + MatterLocalizationConfigurationPluginServerInitCallback(); \ + MatterTimeFormatLocalizationPluginServerInitCallback(); \ + MatterUnitLocalizationPluginServerInitCallback(); \ + MatterGeneralCommissioningPluginServerInitCallback(); \ + MatterNetworkCommissioningPluginServerInitCallback(); \ + MatterDiagnosticLogsPluginServerInitCallback(); \ + MatterGeneralDiagnosticsPluginServerInitCallback(); \ + MatterSoftwareDiagnosticsPluginServerInitCallback(); \ + MatterEthernetNetworkDiagnosticsPluginServerInitCallback(); \ + MatterSwitchPluginServerInitCallback(); \ + MatterAdministratorCommissioningPluginServerInitCallback(); \ + MatterOperationalCredentialsPluginServerInitCallback(); \ + MatterGroupKeyManagementPluginServerInitCallback(); \ + MatterFixedLabelPluginServerInitCallback(); \ + MatterUserLabelPluginServerInitCallback(); diff --git a/zzz_generated/unify-matter-bridge/zap-generated/access.h b/zzz_generated/unify-matter-bridge/zap-generated/access.h new file mode 100644 index 00000000000000..d83c0d03fdd189 --- /dev/null +++ b/zzz_generated/unify-matter-bridge/zap-generated/access.h @@ -0,0 +1,272 @@ +/* + * + * 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 { \ + /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: view */ \ + 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: General Commissioning, Attribute: Breadcrumb, 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 */ \ + 62, /* Cluster: Operational Credentials, Attribute: NOCs, Privilege: administer */ \ + /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: view */ \ + /* Cluster: User Label, Attribute: label list, Privilege: view */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: view */ \ + 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: General Commissioning, Attribute: Breadcrumb, 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 */ \ + 0, /* Cluster: Operational Credentials, Attribute: NOCs, Privilege: administer */ \ + /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: view */ \ + /* Cluster: User Label, Attribute: label list, Privilege: view */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: view */ \ + 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: General Commissioning, Attribute: Breadcrumb, 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 */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Operational Credentials, Attribute: NOCs, Privilege: administer */ \ + /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: view */ \ + /* Cluster: User Label, Attribute: label list, Privilege: view */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 8, /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: manage */ \ + 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 */ \ + 48, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \ + 49, /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: administer */ \ + 63, /* Cluster: Group Key Management, Attribute: GroupKeyMap, 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 { \ + 16384, /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: manage */ \ + 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 */ \ + 0, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \ + 4, /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: administer */ \ + 0, /* Cluster: Group Key Management, Attribute: GroupKeyMap, 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 { \ + kMatterAccessPrivilegeManage, /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: manage */ \ + 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 */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: administer */ \ + kMatterAccessPrivilegeManage, /* Cluster: Group Key Management, Attribute: GroupKeyMap, 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 { \ + 3, /* Cluster: Identify, Command: Identify, Privilege: manage */ \ + 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 */ \ + 5, /* Cluster: Scenes, Command: AddScene, Privilege: manage */ \ + 5, /* Cluster: Scenes, Command: RemoveScene, Privilege: manage */ \ + 5, /* Cluster: Scenes, Command: RemoveAllScenes, Privilege: manage */ \ + 5, /* Cluster: Scenes, Command: StoreScene, Privilege: manage */ \ + 48, /* Cluster: General Commissioning, Command: ArmFailSafe, Privilege: administer */ \ + 48, /* Cluster: General Commissioning, Command: SetRegulatoryConfig, Privilege: administer */ \ + 48, /* Cluster: General Commissioning, Command: CommissioningComplete, Privilege: administer */ \ + 49, /* Cluster: Network Commissioning, Command: ScanNetworks, 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 */ \ + 60, /* Cluster: AdministratorCommissioning, Command: OpenCommissioningWindow, Privilege: administer */ \ + 60, /* Cluster: AdministratorCommissioning, Command: OpenBasicCommissioningWindow, Privilege: administer */ \ + 60, /* Cluster: AdministratorCommissioning, Command: RevokeCommissioning, 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 */ \ + 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 */ \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ + 0, /* Cluster: Identify, Command: Identify, Privilege: manage */ \ + 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: Scenes, Command: AddScene, Privilege: manage */ \ + 2, /* Cluster: Scenes, Command: RemoveScene, Privilege: manage */ \ + 3, /* Cluster: Scenes, Command: RemoveAllScenes, Privilege: manage */ \ + 4, /* Cluster: Scenes, Command: StoreScene, Privilege: manage */ \ + 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: Network Commissioning, Command: ScanNetworks, 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: AdministratorCommissioning, Command: OpenCommissioningWindow, Privilege: administer */ \ + 1, /* Cluster: AdministratorCommissioning, Command: OpenBasicCommissioningWindow, Privilege: administer */ \ + 2, /* Cluster: AdministratorCommissioning, Command: RevokeCommissioning, 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 */ \ + 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 */ \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ + kMatterAccessPrivilegeManage, /* Cluster: Identify, Command: Identify, Privilege: manage */ \ + 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: Scenes, Command: AddScene, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Scenes, Command: RemoveScene, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Scenes, Command: RemoveAllScenes, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Scenes, Command: StoreScene, Privilege: manage */ \ + 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: Network Commissioning, Command: ScanNetworks, 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: AdministratorCommissioning, Command: OpenCommissioningWindow, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: AdministratorCommissioning, Command: OpenBasicCommissioningWindow, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: AdministratorCommissioning, Command: RevokeCommissioning, 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: 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 */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// 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/zzz_generated/unify-matter-bridge/zap-generated/af-gen-event.h b/zzz_generated/unify-matter-bridge/zap-generated/af-gen-event.h new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/zzz_generated/unify-matter-bridge/zap-generated/callback-stub.cpp b/zzz_generated/unify-matter-bridge/zap-generated/callback-stub.cpp new file mode 100644 index 00000000000000..8d1c280a4b11a5 --- /dev/null +++ b/zzz_generated/unify-matter-bridge/zap-generated/callback-stub.cpp @@ -0,0 +1,319 @@ +/* + * + * 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_BINDING_CLUSTER_ID: + emberAfBindingClusterInitCallback(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_ON_OFF_CLUSTER_ID: + emberAfOnOffClusterInitCallback(endpoint); + break; + case ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID: + emberAfOperationalCredentialsClusterInitCallback(endpoint); + break; + case ZCL_SCENES_CLUSTER_ID: + emberAfScenesClusterInitCallback(endpoint); + break; + case ZCL_SOFTWARE_DIAGNOSTICS_CLUSTER_ID: + emberAfSoftwareDiagnosticsClusterInitCallback(endpoint); + break; + case ZCL_SWITCH_CLUSTER_ID: + emberAfSwitchClusterInitCallback(endpoint); + break; + case ZCL_TIME_FORMAT_LOCALIZATION_CLUSTER_ID: + emberAfTimeFormatLocalizationClusterInitCallback(endpoint); + break; + case ZCL_UNIT_LOCALIZATION_CLUSTER_ID: + emberAfUnitLocalizationClusterInitCallback(endpoint); + break; + case ZCL_USER_LABEL_CLUSTER_ID: + emberAfUserLabelClusterInitCallback(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)) emberAfBindingClusterInitCallback(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)) emberAfOnOffClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfOperationalCredentialsClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfScenesClusterInitCallback(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)) emberAfTimeFormatLocalizationClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfUnitLocalizationClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfUserLabelClusterInitCallback(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/zzz_generated/unify-matter-bridge/zap-generated/endpoint_config.h b/zzz_generated/unify-matter-bridge/zap-generated/endpoint_config.h new file mode 100644 index 00000000000000..562619f52f2380 --- /dev/null +++ b/zzz_generated/unify-matter-bridge/zap-generated/endpoint_config.h @@ -0,0 +1,906 @@ +/* + * + * 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: General Commissioning (server), big-endian */ \ + \ + /* 0 - Breadcrumb, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + } + +#else // !BIGENDIAN_CPU +#define GENERATED_DEFAULTS \ + { \ + \ + /* Endpoint: 0, Cluster: General Commissioning (server), little-endian */ \ + \ + /* 0 - Breadcrumb, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + } + +#endif // BIGENDIAN_CPU + +#define GENERATED_DEFAULTS_COUNT (1) + +#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 3 +#define GENERATED_MIN_MAX_DEFAULTS \ + { \ + \ + /* Endpoint: 0, Cluster: Time Format Localization (server) */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x1 }, /* HourFormat */ \ + \ + /* Endpoint: 0, Cluster: Unit Localization (server) */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x2 }, /* TemperatureUnit */ \ + \ + /* Endpoint: 1, Cluster: Level Control (server) */ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x3 } /* Options */ \ + } + +#define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask +// This is an array of EmberAfAttributeMetadata structures. +#define GENERATED_ATTRIBUTE_COUNT 144 +#define GENERATED_ATTRIBUTES \ + { \ + \ + /* 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), 2, 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), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* SubjectsPerAccessControlEntry */ \ + { 0x00000003, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TargetsPerAccessControlEntry */ \ + { 0x00000004, ZAP_TYPE(INT16U), 2, 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), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ + { 0x00000001, ZAP_TYPE(CHAR_STRING), 33, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ + { 0x00000002, ZAP_TYPE(VENDOR_ID), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* VendorID */ \ + { 0x00000003, ZAP_TYPE(CHAR_STRING), 33, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ProductName */ \ + { 0x00000004, ZAP_TYPE(INT16U), 2, 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), 3, \ + ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* Location */ \ + { 0x00000007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* HardwareVersion */ \ + { 0x00000008, ZAP_TYPE(CHAR_STRING), 65, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* HardwareVersionString */ \ + { 0x00000009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* SoftwareVersion */ \ + { 0x0000000A, ZAP_TYPE(CHAR_STRING), 65, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* SoftwareVersionString */ \ + { 0x0000000B, ZAP_TYPE(CHAR_STRING), 17, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ManufacturingDate */ \ + { 0x0000000C, ZAP_TYPE(CHAR_STRING), 33, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* PartNumber */ \ + { 0x0000000D, ZAP_TYPE(LONG_CHAR_STRING), 258, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ProductURL */ \ + { 0x0000000E, ZAP_TYPE(CHAR_STRING), 65, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* ProductLabel */ \ + { 0x0000000F, ZAP_TYPE(CHAR_STRING), 33, 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), 33, 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: Localization Configuration (server) */ \ + { 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: Unit 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(1) }, /* TemperatureUnit */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0x1) }, /* 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(0) }, /* Breadcrumb */ \ + { 0x00000001, ZAP_TYPE(STRUCT), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* BasicCommissioningInfo */ \ + { 0x00000002, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RegulatoryConfig */ \ + { 0x00000003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* LocationCapability */ \ + { 0x00000004, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* SupportsConcurrentConnection */ \ + { 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(4) }, /* 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), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RebootCount */ \ + { 0x00000002, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* UpTime */ \ + { 0x00000003, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* TotalOperationalHours */ \ + { 0x00000004, ZAP_TYPE(ENUM8), 1, 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), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CurrentHeapFree */ \ + { 0x00000002, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CurrentHeapUsed */ \ + { 0x00000003, ZAP_TYPE(INT64U), 8, 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: Ethernet Network Diagnostics (server) */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 8, 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(ENUM8), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ + { 0x00000001, ZAP_TYPE(FABRIC_IDX), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* AdminFabricIndex */ \ + { 0x00000002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + 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), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedFabrics */ \ + { 0x00000003, ZAP_TYPE(INT8U), 1, 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(INT8U), 1, 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), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* MaxGroupsPerFabric */ \ + { 0x00000003, ZAP_TYPE(INT16U), 2, 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 */ \ + { 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: Scenes (server) */ \ + { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* SceneCount */ \ + { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* CurrentScene */ \ + { 0x00000002, ZAP_TYPE(GROUP_ID), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* CurrentGroup */ \ + { 0x00000003, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* SceneValid */ \ + { 0x00000004, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* NameSupport */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ + \ + /* Endpoint: 1, Cluster: On/Off (server) */ \ + { 0x00000000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* OnOff */ \ + { 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_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0x00) }, /* CurrentLevel */ \ + { 0x00000001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* RemainingTime */ \ + { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* MinLevel */ \ + { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xFE) }, /* MaxLevel */ \ + { 0x00000004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* CurrentFrequency */ \ + { 0x00000005, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* MinFrequency */ \ + { 0x00000006, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* MaxFrequency */ \ + { 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) }, /* OnOffTransitionTime */ \ + { 0x00000011, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0xFE) }, /* OnLevel */ \ + { 0x00000012, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* OnTransitionTime */ \ + { 0x00000013, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* OffTransitionTime */ \ + { 0x00000014, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* DefaultMoveRate */ \ + { 0x00004000, ZAP_TYPE(INT8U), 1, \ + ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(255) }, /* StartUpCurrentLevel */ \ + { 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), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ClusterRevision */ \ + \ + /* Endpoint: 1, Cluster: Switch (server) */ \ + { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* number of positions */ \ + { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* current position */ \ + { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* multi press max */ \ + { 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: 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 */ \ + } + +// 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 chipFuncArrayIdentifyServer[] = { \ + (EmberAfGenericClusterFunction) emberAfIdentifyClusterServerInitCallback, \ + (EmberAfGenericClusterFunction) MatterIdentifyClusterServerAttributeChangedCallback, \ + }; \ + 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 chipFuncArrayScenesServer[] = { \ + (EmberAfGenericClusterFunction) emberAfScenesClusterServerInitCallback, \ + }; \ + const EmberAfGenericClusterFunction chipFuncArrayOnOffServer[] = { \ + (EmberAfGenericClusterFunction) emberAfOnOffClusterServerInitCallback, \ + }; \ + const EmberAfGenericClusterFunction chipFuncArrayLevelControlServer[] = { \ + (EmberAfGenericClusterFunction) emberAfLevelControlClusterServerInitCallback, \ + }; + +// clang-format off +#define GENERATED_COMMANDS { \ + /* Endpoint: 0, Cluster: General Commissioning (server) */\ + /* AcceptedCommandList (index=0) */ \ + 0x00000000 /* ArmFailSafe */, \ + 0x00000002 /* SetRegulatoryConfig */, \ + 0x00000004 /* CommissioningComplete */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=4)*/ \ + 0x00000001 /* ArmFailSafeResponse */, \ + 0x00000003 /* SetRegulatoryConfigResponse */, \ + 0x00000005 /* CommissioningCompleteResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Network Commissioning (server) */\ + /* AcceptedCommandList (index=8) */ \ + 0x00000000 /* ScanNetworks */, \ + 0x00000004 /* RemoveNetwork */, \ + 0x00000006 /* ConnectNetwork */, \ + 0x00000008 /* ReorderNetwork */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=13)*/ \ + 0x00000001 /* ScanNetworksResponse */, \ + 0x00000005 /* NetworkConfigResponse */, \ + 0x00000007 /* ConnectNetworkResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Diagnostic Logs (server) */\ + /* AcceptedCommandList (index=17) */ \ + 0x00000000 /* RetrieveLogsRequest */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=19)*/ \ + 0x00000001 /* RetrieveLogsResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */\ + /* AcceptedCommandList (index=21) */ \ + 0x00000000 /* OpenCommissioningWindow */, \ + 0x00000001 /* OpenBasicCommissioningWindow */, \ + 0x00000002 /* RevokeCommissioning */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Operational Credentials (server) */\ + /* AcceptedCommandList (index=25) */ \ + 0x00000000 /* AttestationRequest */, \ + 0x00000002 /* CertificateChainRequest */, \ + 0x00000004 /* CSRRequest */, \ + 0x00000006 /* AddNOC */, \ + 0x00000007 /* UpdateNOC */, \ + 0x00000009 /* UpdateFabricLabel */, \ + 0x0000000A /* RemoveFabric */, \ + 0x0000000B /* AddTrustedRootCertificate */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=34)*/ \ + 0x00000001 /* AttestationResponse */, \ + 0x00000003 /* CertificateChainResponse */, \ + 0x00000005 /* CSRResponse */, \ + 0x00000008 /* NOCResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Group Key Management (server) */\ + /* AcceptedCommandList (index=39) */ \ + 0x00000000 /* KeySetWrite */, \ + 0x00000001 /* KeySetRead */, \ + 0x00000003 /* KeySetRemove */, \ + 0x00000004 /* KeySetReadAllIndices */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=44)*/ \ + 0x00000002 /* KeySetReadResponse */, \ + 0x00000005 /* KeySetReadAllIndicesResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 1, Cluster: Identify (server) */\ + /* AcceptedCommandList (index=47) */ \ + 0x00000000 /* Identify */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 1, Cluster: Groups (server) */\ + /* AcceptedCommandList (index=49) */ \ + 0x00000000 /* AddGroup */, \ + 0x00000001 /* ViewGroup */, \ + 0x00000002 /* GetGroupMembership */, \ + 0x00000003 /* RemoveGroup */, \ + 0x00000004 /* RemoveAllGroups */, \ + 0x00000005 /* AddGroupIfIdentifying */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=56)*/ \ + 0x00000000 /* AddGroupResponse */, \ + 0x00000001 /* ViewGroupResponse */, \ + 0x00000002 /* GetGroupMembershipResponse */, \ + 0x00000003 /* RemoveGroupResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 1, Cluster: Scenes (server) */\ + /* AcceptedCommandList (index=61) */ \ + 0x00000000 /* AddScene */, \ + 0x00000001 /* ViewScene */, \ + 0x00000002 /* RemoveScene */, \ + 0x00000003 /* RemoveAllScenes */, \ + 0x00000004 /* StoreScene */, \ + 0x00000005 /* RecallScene */, \ + 0x00000006 /* GetSceneMembership */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=69)*/ \ + 0x00000000 /* AddSceneResponse */, \ + 0x00000001 /* ViewSceneResponse */, \ + 0x00000002 /* RemoveSceneResponse */, \ + 0x00000003 /* RemoveAllScenesResponse */, \ + 0x00000004 /* StoreSceneResponse */, \ + 0x00000006 /* GetSceneMembershipResponse */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 1, Cluster: On/Off (server) */\ + /* AcceptedCommandList (index=76) */ \ + 0x00000000 /* Off */, \ + 0x00000001 /* On */, \ + 0x00000002 /* Toggle */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 1, Cluster: Level Control (server) */\ + /* AcceptedCommandList (index=80) */ \ + 0x00000000 /* MoveToLevel */, \ + 0x00000001 /* Move */, \ + 0x00000002 /* Step */, \ + 0x00000003 /* Stop */, \ + 0x00000004 /* MoveToLevelWithOnOff */, \ + 0x00000005 /* MoveWithOnOff */, \ + 0x00000006 /* StepWithOnOff */, \ + 0x00000007 /* StopWithOnOff */, \ + chip::kInvalidCommandId /* end of list */, \ +} + +// clang-format on + +#define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask +#define GENERATED_CLUSTER_COUNT 30 + +// clang-format off +#define GENERATED_CLUSTERS { \ + { \ + /* Endpoint: 0, Cluster: Identify (server) */ \ + .clusterId = 0x00000003, \ + .attributes = ZAP_ATTRIBUTE_INDEX(0), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayIdentifyServer, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Groups (server) */ \ + .clusterId = 0x00000004, \ + .attributes = ZAP_ATTRIBUTE_INDEX(0), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayGroupsServer, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Descriptor (server) */ \ + .clusterId = 0x0000001D, \ + .attributes = ZAP_ATTRIBUTE_INDEX(0), \ + .attributeCount = 5, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Binding (server) */ \ + .clusterId = 0x0000001E, \ + .attributes = ZAP_ATTRIBUTE_INDEX(5), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Access Control (client) */ \ + .clusterId = 0x0000001F, \ + .attributes = ZAP_ATTRIBUTE_INDEX(5), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Access Control (server) */ \ + .clusterId = 0x0000001F, \ + .attributes = ZAP_ATTRIBUTE_INDEX(5), \ + .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(11), \ + .attributeCount = 21, \ + .clusterSize = 37, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayBasicServer, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Localization Configuration (server) */ \ + .clusterId = 0x0000002B, \ + .attributes = ZAP_ATTRIBUTE_INDEX(32), \ + .attributeCount = 2, \ + .clusterSize = 2, \ + .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(34), \ + .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: Unit Localization (server) */ \ + .clusterId = 0x0000002D, \ + .attributes = ZAP_ATTRIBUTE_INDEX(38), \ + .attributeCount = 3, \ + .clusterSize = 7, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: General Commissioning (server) */ \ + .clusterId = 0x00000030, \ + .attributes = ZAP_ATTRIBUTE_INDEX(41), \ + .attributeCount = 7, \ + .clusterSize = 14, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 0 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 4 ) ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ + .clusterId = 0x00000031, \ + .attributes = ZAP_ATTRIBUTE_INDEX(48), \ + .attributeCount = 10, \ + .clusterSize = 48, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 8 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 13 ) ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Diagnostic Logs (server) */ \ + .clusterId = 0x00000032, \ + .attributes = ZAP_ATTRIBUTE_INDEX(58), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 17 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 19 ) ,\ + },\ + { \ + /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ + .clusterId = 0x00000033, \ + .attributes = ZAP_ATTRIBUTE_INDEX(58), \ + .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(67), \ + .attributeCount = 6, \ + .clusterSize = 6, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ + .clusterId = 0x00000037, \ + .attributes = ZAP_ATTRIBUTE_INDEX(73), \ + .attributeCount = 11, \ + .clusterSize = 6, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ + .clusterId = 0x0000003C, \ + .attributes = ZAP_ATTRIBUTE_INDEX(84), \ + .attributeCount = 4, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 21 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ + .clusterId = 0x0000003E, \ + .attributes = ZAP_ATTRIBUTE_INDEX(88), \ + .attributeCount = 7, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 25 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 34 ) ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Group Key Management (server) */ \ + .clusterId = 0x0000003F, \ + .attributes = ZAP_ATTRIBUTE_INDEX(95), \ + .attributeCount = 5, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 39 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 44 ) ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Fixed Label (server) */ \ + .clusterId = 0x00000040, \ + .attributes = ZAP_ATTRIBUTE_INDEX(100), \ + .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(102), \ + .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(104), \ + .attributeCount = 2, \ + .clusterSize = 4, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayIdentifyServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 47 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Groups (server) */ \ + .clusterId = 0x00000004, \ + .attributes = ZAP_ATTRIBUTE_INDEX(106), \ + .attributeCount = 2, \ + .clusterSize = 3, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayGroupsServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 49 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 56 ) ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Scenes (server) */ \ + .clusterId = 0x00000005, \ + .attributes = ZAP_ATTRIBUTE_INDEX(108), \ + .attributeCount = 6, \ + .clusterSize = 8, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayScenesServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 61 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 69 ) ,\ + },\ + { \ + /* Endpoint: 1, Cluster: On/Off (server) */ \ + .clusterId = 0x00000006, \ + .attributes = ZAP_ATTRIBUTE_INDEX(114), \ + .attributeCount = 2, \ + .clusterSize = 3, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayOnOffServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 76 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Level Control (server) */ \ + .clusterId = 0x00000008, \ + .attributes = ZAP_ATTRIBUTE_INDEX(116), \ + .attributeCount = 16, \ + .clusterSize = 27, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + .functions = chipFuncArrayLevelControlServer, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 80 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Descriptor (server) */ \ + .clusterId = 0x0000001D, \ + .attributes = ZAP_ATTRIBUTE_INDEX(132), \ + .attributeCount = 5, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Binding (client) */ \ + .clusterId = 0x0000001E, \ + .attributes = ZAP_ATTRIBUTE_INDEX(137), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Switch (server) */ \ + .clusterId = 0x0000003B, \ + .attributes = ZAP_ATTRIBUTE_INDEX(137), \ + .attributeCount = 5, \ + .clusterSize = 9, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 1, Cluster: Fixed Label (server) */ \ + .clusterId = 0x00000040, \ + .attributes = ZAP_ATTRIBUTE_INDEX(142), \ + .attributeCount = 2, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .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), 21, 138 }, { ZAP_CLUSTER_INDEX(21), 9, 56 }, \ + } + +// 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 (194) + +// 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 \ + { \ + { 0x000E, 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/zzz_generated/unify-matter-bridge/zap-generated/gen_config.h b/zzz_generated/unify-matter-bridge/zap-generated/gen_config.h new file mode 100644 index 00000000000000..f98196cb04a938 --- /dev/null +++ b/zzz_generated/unify-matter-bridge/zap-generated/gen_config.h @@ -0,0 +1,198 @@ +/* + * + * 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_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT (2) +#define EMBER_AF_GROUPS_CLUSTER_SERVER_ENDPOINT_COUNT (2) +#define EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_DESCRIPTOR_CLUSTER_SERVER_ENDPOINT_COUNT (2) +#define EMBER_AF_BINDING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_BINDING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_ACCESS_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_ACCESS_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_LOCALIZATION_CONFIGURATION_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_TIME_FORMAT_LOCALIZATION_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_UNIT_LOCALIZATION_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_DIAGNOSTIC_LOGS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_GENERAL_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_SOFTWARE_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_ADMINISTRATOR_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_FIXED_LABEL_CLUSTER_SERVER_ENDPOINT_COUNT (2) +#define EMBER_AF_USER_LABEL_CLUSTER_SERVER_ENDPOINT_COUNT (1) + +/**** Cluster Plugins ****/ + +// 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 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 Scenes cluster is included +#define ZCL_USING_SCENES_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_SCENES_SERVER +#define EMBER_AF_PLUGIN_SCENES +// User options for server plugin Scenes +// Cluster spec 1.4.8.2 +#ifdef CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#define MATTER_SCENES_TABLE_SIZE CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#else +#define MATTER_SCENES_TABLE_SIZE 16 +#endif + +// 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 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 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 client side of the Binding cluster is included +#define ZCL_USING_BINDING_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_BINDING_CLIENT + +// Use this macro to check if the server side of the Binding cluster is included +#define ZCL_USING_BINDING_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_BINDING_SERVER +#define EMBER_AF_PLUGIN_BINDING + +// Use this macro to check if the client side of the Access Control cluster is included +#define ZCL_USING_ACCESS_CONTROL_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_ACCESS_CONTROL_CLIENT + +// 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 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 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 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 Unit Localization cluster is included +#define ZCL_USING_UNIT_LOCALIZATION_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_UNIT_LOCALIZATION_SERVER +#define EMBER_AF_PLUGIN_UNIT_LOCALIZATION + +// 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 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 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 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 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 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 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 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 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 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 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 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 diff --git a/zzz_generated/unify-matter-bridge/zap-generated/gen_tokens.h b/zzz_generated/unify-matter-bridge/zap-generated/gen_tokens.h new file mode 100644 index 00000000000000..dcc229f5b2c306 --- /dev/null +++ b/zzz_generated/unify-matter-bridge/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)