diff --git a/Jenkinsfile b/Jenkinsfile index 8bf3094edd9308..a48b7c7c1ac01d 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -45,12 +45,14 @@ def initWorkspaceAndScm() sh 'git submodule set-url ./third_party/silabs/gecko_sdk https://stash.silabs.com/scm/embsw/gecko_sdk_release.git' // Matter Init --Checkout relevant submodule - sh 'scripts/checkout_submodules.py --shallow --recursive --platform efr32' + sh 'scripts/checkout_submodules.py --shallow --recursive --platform efr32 linux' dir('third_party/silabs/matter_support/matter/efr32'){ stash name: 'BootLoader', includes: 'bootloader_binaries/*.*' } + sh 'du -sk' + } dir(buildOverlayDir+'/matter-scripts'){ @@ -72,7 +74,14 @@ def initWorkspaceAndScm() userRemoteConfigs : [[credentialsId: 'svc_gsdk', url: 'https://stash.silabs.com/scm/wmn_sqa/sqa-tools.git']]] } - + dir(buildOverlayDir+"/overlay/unify"){ + checkout scm: [$class: 'GitSCM', + branches: [[name: 'ver_1.2.1-103-g34db9516-unify-matter-bridge']], + extensions: [[$class: 'CloneOption', depth: 1, noTags: false, reference: '', shallow: true], + [$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, + recursiveSubmodules: true, reference: '', shallow: true, trackingSubmodules: false]], + userRemoteConfigs: [[credentialsId: 'svc_gsdk', url: 'https://bitbucket-cph.silabs.com/scm/stash/uic/uic.git']]] + } } def runInWorkspace(Map args, Closure cl) @@ -282,6 +291,58 @@ def buildChipTool() } } +def buildUnifyBridge() +{ + actionWithRetry { + node(buildFarmLargeLabel) + { + def workspaceTmpDir = createWorkspaceOverlay(advanceStageMarker.getBuildStagesList(), + buildOverlayDir) + def dirPath = workspaceTmpDir + createWorkspaceOverlay.overlayMatterPath + def unifyCheckoutDir = workspaceTmpDir + "/overlay/unify" + def saveDir = 'matter/out/' + try { + def unify_bridge_docker = docker.image('nexus.silabs.net/unify-cache/unify-matter:1.0.1-armhf') + dir(dirPath) + { + unify_bridge_docker.inside("-u root -v${unifyCheckoutDir}:/unify") + { + withEnv(['PW_ENVIRONMENT_ROOT='+dirPath]) + { + echo "Build libunify" + sh 'cd /unify && cmake -DCMAKE_INSTALL_PREFIX=$PWD/stage -GNinja -DCMAKE_TOOLCHAIN_FILE=../cmake/armhf_debian.cmake -B build_unify_armhf/ -S components' + sh 'cd /unify && cmake --build build_unify_armhf' + sh 'cd /unify && cmake --install build_unify_armhf --prefix $PWD/stage' + + echo "Build Unify Matter Bridge" + sh 'rm -rf ./.environment' + sh 'git config --global --add safe.directory $(pwd)' + sh 'git config --global --add safe.directory $(pwd)/third_party/pigweed/repo' + dir ("silabs_examples/unify-matter-bridge/linux") + { + def out_path = "../../../out/silabs_examples/unify-matter-bridge/armhf_debian_buster" + def pkg_config_export = "export PKG_CONFIG_PATH=:/unify/stage/share/pkgconfig:/usr/lib/arm-linux-gnueabihf/pkgconfig" + sh "../../../scripts/run_in_build_env.sh \"${pkg_config_export}; gn gen ${out_path} --args='target_cpu=\\\"arm\\\"'\"" + sh "../../../scripts/run_in_build_env.sh \"${pkg_config_export}; ninja -C ${out_path}\"" + } + } + } + } + } catch (e) { + deactivateWorkspaceOverlay(advanceStageMarker.getBuildStagesList(), + workspaceTmpDir, + "matter", + '-name no-files') + throw e + } + deactivateWorkspaceOverlay(advanceStageMarker.getBuildStagesList(), + workspaceTmpDir, + saveDir, + '-name unify-matter-bridge') + } + } +} + def exportIoTReports() { actionWithRetry { @@ -783,6 +844,11 @@ def pipeline() { advanceStageMarker() + //--------------------------------------------------------------------- + // Build Unify Matter Bridge + //--------------------------------------------------------------------- + parallelNodesBuild["Unify Matter Bridge"] = {this.buildUnifyBridge()} + //--------------------------------------------------------------------- // Build OpenThread Examples //--------------------------------------------------------------------- diff --git a/silabs_examples/unify-matter-bridge/LICENSE.md b/silabs_examples/unify-matter-bridge/LICENSE.md new file mode 100644 index 00000000000000..35b759774978be --- /dev/null +++ b/silabs_examples/unify-matter-bridge/LICENSE.md @@ -0,0 +1,8 @@ +**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. diff --git a/silabs_examples/unify-matter-bridge/docker/Dockerfile b/silabs_examples/unify-matter-bridge/docker/Dockerfile index ad6c3cdb9599a0..0b56e48982f3cc 100644 --- a/silabs_examples/unify-matter-bridge/docker/Dockerfile +++ b/silabs_examples/unify-matter-bridge/docker/Dockerfile @@ -1,33 +1,77 @@ -ARG VERSION=latest -FROM connectedhomeip/chip-build:${VERSION} +FROM debian:buster + +ENV DEBIAN_FRONTEND=noninteractive + +SHELL ["/bin/bash", "-c"] + +ARG ARCH="armhf" + +ARG TARGET_DEPS="libavahi-client-dev libssl-dev libsystemd-dev libwrap0-dev uthash-dev \ + libsqlite3-dev libedit-dev libyaml-cpp0.6 libmosquitto-dev\ + libreadline-dev libncurses5-dev libncursesw5-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 procps libmbedtls-dev libglib2.0-dev" + +ARG HOST_DEPS="ninja-build git git-lfs curl pkg-config \ + ruby ruby-dev \ + gcc g++ gdb-multiarch \ + build-essential \ + clang nlohmann-json3-dev \ + libdbus-glib-1-dev libssl-dev libgirepository1.0-dev" + +# configure additional arches in dpkg/apt +RUN for arch in ${ARCH} ; do \ + dpkg --add-architecture $arch ; \ + echo $arch ; \ + done + +RUN apt-get update \ + && apt-get install --no-install-recommends -y curl gnupg2 ca-certificates \ + && apt-get update \ + && apt-get install --no-install-recommends -y \ + ${HOST_DEPS} \ + $(for dep in ${TARGET_DEPS} ; do \ + for arch in ${ARCH} ; do echo $dep:$arch ; done ; \ + done) \ + $(for arch in ${ARCH} ; do echo crossbuild-essential-${arch} ; done)\ + && rm -rf /var/lib/apt/lists/* + +# Install python 3.9 +RUN curl -L https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh --output /tmp/Miniconda.sh \ + && cd /tmp \ + && echo 78f39f9bae971ec1ae7969f0516017f2413f17796670f7040725dd83fcff5689 Miniconda.sh > /tmp/Miniconda.sh.sha256 \ + && sha256sum -c /tmp/Miniconda.sh.sha256 \ + && bash /tmp/Miniconda.sh -b -p /usr/local/miniconda \ + && /usr/local/miniconda/condabin/conda init bash \ + && ln -sf /usr/local/miniconda/bin/python3.9 /usr/bin/python3 \ + && ln -sf /usr/local/miniconda/bin/pip3 /usr/bin/pip3 # Rust Version to install -ENV RUST_VERSION=1.60.0 +ENV RUST_VERSION=1.64.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}\ + && if [[ $ARCH == *"armhf"* ]]; then export RUST_TRIPLES="$RUST_TRIPLES armv7-unknown-linux-gnueabihf"; fi \ + && if [[ $ARCH == *"amd64"* ]]; then export RUST_TRIPLES="$RUST_TRIPLES x86_64-unknown-linux-gnu"; fi \ + && ./sh.rustup.rs -y --profile minimal --target ${RUST_TRIPLES} --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 +# Install cmake 1.19.2 +RUN curl -L https://github.com/Kitware/CMake/releases/download/v3.19.2/cmake-3.19.2-Linux-x86_64.sh --output /tmp/cmake-3.19.2-Linux-x86_64.sh \ + && cd /tmp \ + && echo 2fc84c1bd5a5fa8850426905a76147fbf897cf67ef324b009bcdb7eceafa9662 cmake-3.19.2-Linux-x86_64.sh > /tmp/cmake-3.19.2-Linux-x86_64.sh.sha256 \ + && sha256sum -c cmake-3.19.2-Linux-x86_64.sh.sha256 \ + && chmod +x /tmp/cmake*.sh \ + && /tmp/cmake*.sh --prefix=/usr/local --skip-license \ + && rm /tmp/cmake* \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/.gn b/silabs_examples/unify-matter-bridge/linux/.gn index 70728706ea4a14..25f6ec73d28d65 100644 --- a/silabs_examples/unify-matter-bridge/linux/.gn +++ b/silabs_examples/unify-matter-bridge/linux/.gn @@ -1,18 +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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** import("//build_overrides/build.gni") +import("//build_overrides/pigweed.gni") # The location of the build configuration file. buildconfig = "${build_root}/config/BUILDCONFIG.gn" @@ -21,5 +21,7 @@ buildconfig = "${build_root}/config/BUILDCONFIG.gn" check_system_includes = true default_args = { + pw_unit_test_AUTOMATIC_RUNNER = "$dir_pigweed/targets/host/run_test" + import("//args.gni") } diff --git a/silabs_examples/unify-matter-bridge/linux/BUILD.gn b/silabs_examples/unify-matter-bridge/linux/BUILD.gn index b4b7f6e2c82cf9..5dd3ff6f8478b8 100644 --- a/silabs_examples/unify-matter-bridge/linux/BUILD.gn +++ b/silabs_examples/unify-matter-bridge/linux/BUILD.gn @@ -1,6 +1,21 @@ +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** + import("//build_overrides/chip.gni") import("${chip_root}/build/chip/tools.gni") +import("${chip_root}/build/chip/tests.gni") import("${chip_root}/build/config/linux/pkg_config.gni") +import("${chip_root}/build/config/compiler/compiler.gni") assert(chip_build_tools) @@ -8,46 +23,74 @@ pkg_config("unify") { packages = [ "libunify" ] } -executable("unify-matter-bridge") { +config("unify-config") { include_dirs = [ "src", "src/cluster_translator", "src/device_type_mapper", "src/matter_node_state_monitor", + "src/matter_wrappers", "include", + "zap-handlers/gen" ] + ldflags = [ "-lboost_system" ] + +} + +static_library("unify-matter-bridge-lib") { + 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_bridge_cli.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", + "zap-handlers/gen/command_translator.cpp", + "zap-handlers/gen/attribute_translator.cpp", + "zap-handlers/gen/unify_accessors.cpp", + "src/uic_mqtt_wrapper.cpp" ] - deps = [ + public_deps = [ "${chip_root}/examples/platform/linux:app-main", "//../unify-matter-bridge-common", ] - configs += [ ":unify" ] + + output_dir = root_out_dir + + public_configs = [ ":unify-config" , ":unify" ] + +} + +executable("unify-matter-bridge") { + sources = [ + "src/matter_bridge_main.cpp", + ] + + deps = [ + ":unify-matter-bridge-lib" + ] } group("linux") { deps = [ ":unify-matter-bridge" ] } + + +if (chip_build_tests) { + group("check") { + deps = [ + "//src/tests", + ] + } +} diff --git a/silabs_examples/unify-matter-bridge/linux/args.gni b/silabs_examples/unify-matter-bridge/linux/args.gni index df05cd7f1c6c62..a8420b7d23decc 100644 --- a/silabs_examples/unify-matter-bridge/linux/args.gni +++ b/silabs_examples/unify-matter-bridge/linux/args.gni @@ -1,16 +1,15 @@ -# 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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** import("//build_overrides/chip.gni") @@ -21,18 +20,16 @@ chip_project_config_include = "" chip_system_project_config_include = "" chip_project_config_include_dirs = - [ "${chip_root}/examples/tv-app/tv-common/include" ] + [ "//../unify-matter-bridge-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 +chip_build_libshell = false +chip_enable_additional_data_advertising = false +chip_enable_rotating_device_id = false cpp_standard = "c++17" - enable_pic = false +is_debug = true 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 index 323b150ed3399a..f0342b4cb0a82c 100644 --- a/silabs_examples/unify-matter-bridge/linux/build_overrides/build.gni +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/build.gni @@ -1,16 +1,15 @@ -# 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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** declare_args() { # Root directory for build files. diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/chip.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/chip.gni index 23aafc1df7b3cd..c4c7744442f26b 100644 --- a/silabs_examples/unify-matter-bridge/linux/build_overrides/chip.gni +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/chip.gni @@ -1,16 +1,15 @@ -# 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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** declare_args() { # Root directory for CHIP. diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/jsoncpp.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/jsoncpp.gni new file mode 100644 index 00000000000000..3f799db8fb5910 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/jsoncpp.gni @@ -0,0 +1,16 @@ +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** + +declare_args() { + jsoncpp_root = "//third_party/connectedhomeip/third_party/jsoncpp" +} diff --git a/silabs_examples/unify-matter-bridge/linux/build_overrides/nlassert.gni b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlassert.gni index 30e8c701634664..ce3d99a6e9547d 100644 --- a/silabs_examples/unify-matter-bridge/linux/build_overrides/nlassert.gni +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlassert.gni @@ -1,16 +1,15 @@ -# 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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** declare_args() { # Root directory for 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 index 155d765597d110..60fb476cccb37f 100644 --- a/silabs_examples/unify-matter-bridge/linux/build_overrides/nlfaultinjection.gni +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlfaultinjection.gni @@ -1,16 +1,15 @@ -# 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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** declare_args() { # Root directory for 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 index f7d5ee6117e826..1aae2a1ea0fa6d 100644 --- a/silabs_examples/unify-matter-bridge/linux/build_overrides/nlio.gni +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlio.gni @@ -1,16 +1,15 @@ -# 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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** declare_args() { # Root directory for 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 index ed017adc65f04a..463176791dd201 100644 --- a/silabs_examples/unify-matter-bridge/linux/build_overrides/nlunit_test.gni +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/nlunit_test.gni @@ -1,16 +1,15 @@ -# 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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** declare_args() { # Root directory for 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 index 10edfdf202e885..de37961076174e 100644 --- a/silabs_examples/unify-matter-bridge/linux/build_overrides/openthread.gni +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/openthread.gni @@ -1,16 +1,15 @@ -# 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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** 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 index 2ed583ff245c14..b30de22bead4e4 100644 --- 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 @@ -1,16 +1,15 @@ -# 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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** 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 index 0aaf7c4d226844..9a7970fefe0d71 100644 --- a/silabs_examples/unify-matter-bridge/linux/build_overrides/pigweed.gni +++ b/silabs_examples/unify-matter-bridge/linux/build_overrides/pigweed.gni @@ -1,16 +1,15 @@ -# 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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** declare_args() { # Location of the Pigweed repository. 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 index aa0b45e4af9767..0126a295c236b7 100644 --- a/silabs_examples/unify-matter-bridge/linux/include/attribute_state_cache.hpp +++ b/silabs_examples/unify-matter-bridge/linux/include/attribute_state_cache.hpp @@ -23,59 +23,173 @@ #ifndef ATTRIBUTE_STATE_CASH_H #define ATTRIBUTE_STATE_CASH_H -#include +#include #include -#include +#include #include -#include +#include #include "matter.h" +#include +#include #include - -using value_t - = std::variant; +#include +#include +using value_t = std::variant, std::vector>; using AttrPath_t = chip::app::ConcreteAttributePath; + + +namespace unify::matter_bridge { + //This is template is used to compile time determine if type is a chip::Span<> + // This is done using a SFINAE pattern + template + struct is_span : std::false_type {}; + + template + struct is_span> : std::true_type {}; +} + 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"); +public: + attribute_state_cache(){}; + ~attribute_state_cache(){}; + + // Get the attribute_state_cache class instance + static attribute_state_cache & get_instance(); + + /** + * @brief save 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) + { + if constexpr (std::is_enum::value) + { + attribute_state_container[attributePath] = static_cast>(data); + } else if constexpr (unify::matter_bridge::is_span::value) { + std::vector v(data.size()); + std::copy(data.begin(), data.end(), std::back_inserter(v)); + set(attributePath, v); + } + else + { + attribute_state_container[attributePath] = data; + } + } + + + /** + * @brief Setter for Nullable + * + * If the object does not have a value this is a NOP + * + * @tparam T + * @param attributePath + * @param data + */ + template + void set(const AttrPath_t & attributePath, const chip::app::DataModel::Nullable & data) + { + if (data.HasValidValue()) + { + set(attributePath, data.Value()); + } + } + + /** + * @brief Get the attribute state from a memory, returns direct reference to the stored object. + * + * @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"); + } + } + + /** + * @brief Generic getter for all all attribute types, the stored value will be + * copied to value + * + * @tparam T + * @param attributePath + * @param value + * @return true + * @return false + */ + template + bool inline get(const AttrPath_t & attributePath, T & value) const + { + auto iter = attribute_state_container.find(attributePath); + if (iter != attribute_state_container.end()) + { + if constexpr (std::is_enum::value) + { + auto v = std::get>(iter->second); + value = static_cast(v); + } + else if constexpr (std::is_array::value) + { + return get_array(attributePath, value); + } else if constexpr (unify::matter_bridge::is_span::value) + { + return false; //TODO this should really be a check for is_chip_span + } + else + { + value = std::get(iter->second); + } + return true; + } + else + { + return false; + } + } + + +private: + /** + * @brief Getter for an array type + * + * @tparam T + * @tparam N + * @param attributePath + * @return true + * @return false + */ + template + bool inline get_array(const AttrPath_t & attributePath, T (&value)[N]) const + { + std::vector v; + if (get(attributePath, v)) + { + if (v.size() == N) + { + std::copy(v.begin(), v.end(), &value[0]); + return true; + } + } + return false; } - } - private: - // Attribute State Container - std::map attribute_state_container; + // Attribute State Container + std::map attribute_state_container; }; -#endif //ATTRIBUTE_STATE_CASH_H +#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 index f9cb7dddb1ebd1..730c6f853acda8 100644 --- a/silabs_examples/unify-matter-bridge/linux/include/matter_cluster_translator.hpp +++ b/silabs_examples/unify-matter-bridge/linux/include/matter_cluster_translator.hpp @@ -19,54 +19,54 @@ * * @{ */ - + #ifndef MATTER_CLUSTER_TRANSLATOR_HPP #define MATTER_CLUSTER_TRANSLATOR_HPP -#include #include +#include - -namespace unify::matter_bridge +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 { - /** - * 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 + * + * @param command_handler + * @param attribute_access * @return true on success */ - bool register_cluster(chip::ClusterId, const CommandHandlerInterface& command_handler, const AttributeAccessInterface& attribute_access); - } - + bool register_cluster(chip::ClusterId, const CommandHandlerInterface & command_handler, + const AttributeAccessInterface & attribute_access); } -#endif //MATTER_CLUSTER_TRANSLATOR_HPP + +} // namespace unify::matter_bridge +#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 index 4054f9ac4c80c3..3d6ef951a43872 100644 --- a/silabs_examples/unify-matter-bridge/linux/include/matter_data_storage.hpp +++ b/silabs_examples/unify-matter-bridge/linux/include/matter_data_storage.hpp @@ -22,54 +22,58 @@ #ifndef MATTER_DATA_STORAGE_HPP #define MATTER_DATA_STORAGE_HPP -#include #include "matter.h" +#include #include -namespace unify::matter_bridge -{ +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); +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); + /** + * @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(); + static matter_data_storage & instance(); }; -} // namespace unify::matter_bridge -#endif //MATTER_DATA_STORAGE_HPP - /** @} end matter_data_storage */ +} // 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 index 5b9b49c59ba214..1c456690f6d080 100644 --- a/silabs_examples/unify-matter-bridge/linux/include/matter_device_translator.hpp +++ b/silabs_examples/unify-matter-bridge/linux/include/matter_device_translator.hpp @@ -28,79 +28,73 @@ #ifndef MATTER_DEVICE_TRANSLATOR_HPP #define MATTER_DEVICE_TRANSLATOR_HPP -#include +#include #include +#include #include -#include -namespace unify::matter_bridge -{ +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; +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 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 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. - */ + /** + * @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; + 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. - */ + /** + * @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 std::optional get_command_id(const std::string & cluster_name, const std::string & command_name) const; - virtual ~device_translator() = default; + virtual ~device_translator() = default; - static const device_translator& instance() { - static device_translator me; - return me; - } + static const device_translator & instance() + { + static device_translator me; + return me; + } }; -} // namespace unify::matter_bridge +} // namespace unify::matter_bridge -#endif //MATTER_DEVICE_TRANSLATOR_HPP +#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 index 07fcf6a08efdfa..16215aef43d309 100644 --- 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 @@ -14,14 +14,14 @@ #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 "unify_ember_interface.hpp" +#include "unify_node_state_monitor.hpp" #include +#include +#include -namespace unify::matter_bridge -{ +namespace unify::matter_bridge { class device_translator; /** @@ -31,102 +31,98 @@ class device_translator; * 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)) - {} +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 + * @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); +public: + matter_node_state_monitor(const device_translator & matter_device_translator, UnifyEmberInterface & ember_interface); - /** + /** * @brief Get the bridged endpoint by object from unify addresses - * - * @param unid - * @param epid - * @return const bridged_endpoint& + * + * @param unid + * @param epid + * @return const bridged_endpoint& */ - const struct bridged_endpoint *bridged_endpoint(const std::string &unid, - int epid) const; - /** + 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 + * + * @return std::pair + */ + virtual 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 */ - 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 + void register_event_listener(const event_listener_t & event_listener); + +protected: + /** + * @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. @@ -136,41 +132,40 @@ class matter_node_state_monitor : * * @param node */ - void on_unify_node_added(const unify::node_state_monitor::node &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 + * @param unid */ - void on_unify_node_removed(const std::string &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 + * 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 unid - * @param state + * @param node */ - 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; - /** + 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 @@ -184,22 +179,40 @@ class matter_node_state_monitor : * @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; + std::vector new_bridged_endpoints(const unify::node_state_monitor::node & node); + const device_translator & matter_device_translator; + + /** + * @brief Unify ember interface + * + * A class which wraps the ember interface for the node state monitor. + * Initialize and set in the constructor stage + */ + UnifyEmberInterface & unify_ember_interface; + + /** @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; + + /** + * @brief Erase matter endpoint in bridged endpoints if it exsits + * + */ + void erase_mapper_endpoint(const std::string unid, chip::EndpointId endpoint); + + /** + * @brief registers a bridged_endpoint to matter. + */ + void register_dynamic_endpoint(const struct bridged_endpoint & bridge); }; -} // namespace unify::matter_bridge +} // namespace unify::matter_bridge -#endif //MATTER_NODE_STATE_MONITOR_HPP +#endif // MATTER_NODE_STATE_MONITOR_HPP diff --git a/silabs_examples/unify-matter-bridge/linux/include/uic_mqtt_wrapper.hpp b/silabs_examples/unify-matter-bridge/linux/include/uic_mqtt_wrapper.hpp new file mode 100644 index 00000000000000..85af7460a0128e --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/include/uic_mqtt_wrapper.hpp @@ -0,0 +1,43 @@ +/****************************************************************************** + * # 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 uic_mqtt_wrapper + * @brief This file defines a C++ wrapper around the uic_mqtt module. + * @{ + */ + +#ifndef UIC_MQTT_WRAPPER_HPP +#define UIC_MQTT_WRAPPER_HPP + +#ifdef __cplusplus + +#include +#include +#include + +namespace unify::matter_bridge { + +class UicMqtt +{ +public: + UicMqtt(){}; + virtual void Publish(std::string topic, std::string message, bool retain); + virtual ~UicMqtt(){}; +}; + +} // namespace unify::matter_bridge + +#endif +#endif // UIC_MQTT_WRAPPER_HPP +/** @} end uic_mqtt_wrapper */ 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 index 54bc9408b3f588..1f50fef8c6657d 100644 --- 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 @@ -16,98 +16,121 @@ #include "matter.h" -#include "matter_node_state_monitor.hpp" #include "group_translator.hpp" -#include "uic_mqtt.h" +#include "matter_node_state_monitor.hpp" #include "sl_log.h" +#include "uic_mqtt_wrapper.hpp" namespace unify::matter_bridge { /** * @brief Base class for handling translation of commands - * - * This class hold base functionality for command translators, such + * + * 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 { +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; + command_translator_interface(const matter_node_state_monitor & node_state_monitor, chip::ClusterId id, const char * name, + UicMqtt & uic_mqtt) : + chip::app::CommandHandlerInterface(chip::Optional::Missing(), id), + m_node_state_monitor(node_state_monitor), cluster_name(name), m_uic_mqtt(uic_mqtt) + { + chip::app::InteractionModelEngine::GetInstance()->RegisterCommandHandler(this); } - - 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); + + /** + * @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() != nullptr) + { + 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); + } + } + 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()); + m_uic_mqtt.Publish(topic, msg, true); } - 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()); + 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; + } - uic_mqtt_publish(topic.c_str(), msg.c_str(), msg.size(), true); - } + 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; + } + } - 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; + send_command_callback(unify_node->unify_unid.c_str(), unify_node->unify_endpoint, command_data); } - - 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; + const matter_node_state_monitor & m_node_state_monitor; + const char * cluster_name; + UicMqtt & m_uic_mqtt; }; -} +} // namespace unify::matter_bridge -#endif //COMMAND_TRANSLATOR_INTERFACE_HPP +#endif // COMMAND_TRANSLATOR_INTERFACE_HPP 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 index 6e6e59e4425615..d5d884382250d0 100644 --- 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 @@ -20,19 +20,18 @@ * @{ */ #pragma once -#include "matter.h" #include "command_translator_interface.hpp" +#include "matter.h" -namespace unify::matter_bridge -{ +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; - +public: + GroupClusterCommandHandler(const matter_node_state_monitor & node_state_monitor, UicMqtt & uic_mqtt) : + command_translator_interface(node_state_monitor, chip::app::Clusters::Groups::Id, "Groups", uic_mqtt) + {} + // CommandHandlerInterface + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext & handlerContext) override; }; -} // namespace unify::matter_bridge \ No newline at end of file +} // namespace unify::matter_bridge \ No newline at end of file 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 deleted file mode 100644 index c9940dad2af361..00000000000000 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_attribute_translator.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/****************************************************************************** - * # 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 deleted file mode 100644 index 4e41591c78cdb7..00000000000000 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_attribute_translator.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/****************************************************************************** - * # 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 deleted file mode 100644 index d970dcb17ea045..00000000000000 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_command_translator.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/****************************************************************************** - * # 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/level_attribute_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_attribute_translator.cpp deleted file mode 100644 index 757829602aa45f..00000000000000 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_attribute_translator.cpp +++ /dev/null @@ -1,482 +0,0 @@ -/****************************************************************************** - * # 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 deleted file mode 100644 index dfed20d1f63d5e..00000000000000 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_attribute_translator.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/****************************************************************************** - * # 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 deleted file mode 100644 index 608631e3ace730..00000000000000 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_command_translator.cpp +++ /dev/null @@ -1,300 +0,0 @@ -/****************************************************************************** - * # 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 deleted file mode 100644 index 5a5cbdbe10d550..00000000000000 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/level_command_translator.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/****************************************************************************** - * # 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 deleted file mode 100644 index c309399481152b..00000000000000 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/****************************************************************************** - * # 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_command_translator.cpp b/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_command_translator.cpp deleted file mode 100644 index 3936b539c6efce..00000000000000 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_command_translator.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * # 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 deleted file mode 100644 index 262889c620e923..00000000000000 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_command_translator.h +++ /dev/null @@ -1,38 +0,0 @@ -/****************************************************************************** - * # 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/device_type_mapper/matter_device_mapper.inc b/silabs_examples/unify-matter-bridge/linux/src/device_type_mapper/matter_device_mapper.inc index 2cf8b0f3c541f2..28e9dece28d256 100644 --- 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 @@ -33,6 +33,7 @@ namespace app { namespace Clusters { static const std::unordered_map unify_cluster_id_map { + { "Basic", BridgedDeviceBasic::Id}, { "Identify", Identify::Id}, { "Groups", Groups::Id}, { "Scenes", Scenes::Id}, @@ -47,6 +48,25 @@ static const std::unordered_map unify_cluster_id_m { "OccupancySensing", OccupancySensing::Id}, }; +// Attribute mapping Unify->Matter conversion +// Attribute structure for each cluster +namespace BridgedDeviceBasic { +namespace Attributes { +static const std::unordered_map unify_to_matter_attribute_id_cluster_map { + { "ApplicationVersion", SoftwareVersion::Id }, + { "HwVersion", HardwareVersion::Id }, + { "ManufacturerName", VendorName::Id }, + { "ModelIdentifier", ProductName::Id }, + { "DateCode", ManufacturingDate::Id }, + { "PowerSource", PowerSource::Id }, + { "ProductUrL", ProductURL::Id }, + { "SerialNumber", SerialNumber::Id }, + { "ProductLabel", ProductLabel::Id }, + { "SwBuildID", SoftwareVersionString::Id } +}; +} // namespace Attributes +} // namespace Basic + // Attribute mapping Unify->Matter conversion // Attribute structure for each cluster namespace Identify { @@ -124,7 +144,7 @@ static const std::unordered_map unify_to_matter_ { "CurrentY", CurrentY::Id }, { "DriftCompensation", DriftCompensation::Id }, { "CompensationText", CompensationText::Id }, - { "ColorTemperatureMireds", ColorTemperature::Id }, + { "ColorTemperatureMireds", ColorTemperatureMireds::Id }, { "ColorMode", ColorMode::Id }, { "NumberOfPrimaries", NumberOfPrimaries::Id }, { "Primary1X", Primary1X::Id }, @@ -238,6 +258,7 @@ static const std::unordered_map unify_to_matter_ // Global map of each clusters attributes static const std::unordered_map> unify_to_matter_attribute_id_map { + { "Basic", BridgedDeviceBasic::Attributes::unify_to_matter_attribute_id_cluster_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 }, @@ -255,6 +276,12 @@ static const std::unordered_mapMatter conversion // Command structure for each cluster +namespace BridgedDeviceBasic { +namespace Commands { +static const std::unordered_map unify_to_matter_command_id_cluster_map { +}; +} // namespace Commands +} // namespace Basic namespace Identify { namespace Commands { static const std::unordered_map unify_to_matter_command_id_cluster_map { @@ -345,6 +372,7 @@ static const std::unordered_map unify_to_matter_co // Global map of each clusters commands static const std::unordered_map> unify_to_matter_command_id_map { + { "Basic", BridgedDeviceBasic::Commands::unify_to_matter_command_id_cluster_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 }, 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 index d51968f79a7299..1737e08f6b5a20 100644 --- 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 @@ -10,40 +10,38 @@ * sections of the MSLA applicable to Source Code. * *****************************************************************************/ +#include "matter_device_mapper.inc" #include "matter_device_translator.hpp" #include "matter_device_types_clusters_list_updated.inc" -#include "matter_device_mapper.inc" +#include "sl_log.h" -#include -#include #include -#include #include +#include +#include +#include using namespace chip::app::Clusters; +constexpr const char * LOG_TAG = "matter_device_translator"; - -namespace unify::matter_bridge -{ -static uint8_t device_type_mapper_compare_cluster_lists( - const std::vector &unify_clusters, - const std::vector &matter_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; + 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; + return count; } /** @@ -53,127 +51,130 @@ static uint8_t device_type_mapper_compare_cluster_lists( * 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) - {} +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 +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; + // contains scores that reflect 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); + 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); - } + 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); + } + } + } + if (!possible_device_list.empty()) + { + sl_log_info(LOG_TAG, "Prioritized Matter Device Type'%s' ", + matter_device_type_vs_clusters_map.find(possible_device_list[0])->second.second); } - } - return possible_device_list; + return possible_device_list; } -std::optional - device_translator::get_device_name(chip::DeviceTypeId device_id) const +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; - } + 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 +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; + 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; + return std::nullopt; } -std::optional - device_translator::get_command_id(const std::string &cluster_name, - const std::string &command_name) const +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; + 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; + return std::nullopt; } -std::optional - device_translator::get_cluster_id(const std::string &cluster_name) const +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; + 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 +} // namespace unify::matter_bridge 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 index 934d2b9264cdee..7c0c045e50825f 100644 --- 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 @@ -17,27 +17,27 @@ static const std::map, c //{ 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"} }, + //{ 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"} }, + //{ 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"} }, + //{ 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"} }, + //{ 0x0400, {{"Basic", "Identify", "IASACE"}, "iascie"} }, //{ 0x0401, {{"Basic", "Identify", "IASZone"}, "iasace"} }, - { 0x0402, {{"Basic", "Identify", "IASZone"}, "iaszone"} }, - { 0x0403, {{"Basic", "Identify", "IASWD", "IASZone"}, "iasW"} }, + //{ 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"} }, @@ -46,8 +46,8 @@ static const std::map, c //{ 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"} }, + //{ 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"} }, diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_cli.cpp b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_cli.cpp new file mode 100644 index 00000000000000..fb12fda580e440 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_cli.cpp @@ -0,0 +1,42 @@ +/****************************************************************************** + * # 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 "uic_stdin_process.h" +#include "uic_stdin.hpp" + +#include "Options.h" +#include "app/server/Server.h" +#include "app/server/OnboardingCodesUtil.h" + +using namespace chip; + +// CLI handling +static sl_status_t commission_cli_func(const handle_args_t &arg) { + LinuxDeviceOptions::GetInstance().payload.commissioningFlow = chip::CommissioningFlow::kStandard; + PrintOnboardingCodes(LinuxDeviceOptions::GetInstance().payload); + Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow(); + return SL_STATUS_OK; +} + + +command_map_t unify_cli_commands = { + {"commission",{"Open commissioning window", commission_cli_func} }, +}; + + + +sl_status_t matter_bridge_cli_init() { + uic_stdin_add_commands(unify_cli_commands); + return SL_STATUS_OK; +} \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_cli.hpp b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_cli.hpp new file mode 100644 index 00000000000000..7163c2a0bb2b8b --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_cli.hpp @@ -0,0 +1,24 @@ +/****************************************************************************** + * # 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 "sl_status.h" + + +/** + * @brief Initailize the CLI + * + * @return sl_status_t + */ + +sl_status_t matter_bridge_cli_init(); \ No newline at end of file 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 index ac867b56fcbca0..4dd53aa5ecfa03 100644 --- a/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_main.cpp +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_bridge_main.cpp @@ -1,20 +1,15 @@ -/* +/****************************************************************************** + * # 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. * - * 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 @@ -22,19 +17,20 @@ #include #include +#include "Options.h" +#include "app/server/Server.h" + // 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" +#include "command_translator.hpp" +#include "attribute_translator.hpp" +#include "matter_bridge_cli.hpp" + extern "C" { // Unify library @@ -45,6 +41,8 @@ extern "C" { #include "uic_main_loop.h" } + + using namespace chip; using namespace chip::app; using namespace chip::Credentials; @@ -59,6 +57,8 @@ using namespace unify::matter_bridge; constexpr const char * LOG_TAG = "unify_matter_bridge"; static bool matter_running; +static std::mutex unify_mutex; + void init_ember_endpoints() { @@ -69,9 +69,17 @@ void init_ember_endpoints() }); } -static void stop_the_loop(intptr_t) + +static void call_unify_event_queue(intptr_t) { - PlatformMgr().StopEventLoopTask(); + unify_mutex.lock(); + bool shutdown = !uic_main_loop_run(); + unify_mutex.unlock(); + if( shutdown ) { + matter_running = false; + Server::GetInstance().DispatchShutDownAndStopEventLoop(); + } + } std::thread run_unify() @@ -79,16 +87,12 @@ 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; - } + // It seems that ScheduleWork is not thread safe, which is why its protected + // by a mutex + unify_mutex.lock(); + PlatformMgr().ScheduleWork(call_unify_event_queue); + unify_mutex.unlock(); } }); return unify_thread; @@ -103,10 +107,12 @@ int main(int argc, char * argv[]) // Setup fixtures uic_fixt_setup_step_t uic_fixt_setup_steps_list[] = { { matter_bridge_config_fixt_setup, "Matter Bridge config fixture" }, + { matter_bridge_cli_init, "Matter Bridge Command Line Interface" }, { 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; @@ -114,6 +120,7 @@ int main(int argc, char * argv[]) auto cfg = matter_bridge_get_config(); opt.payload.commissioningFlow = CommissioningFlow::kStandard; + opt.payload.rendezvousInformation.Emplace().ClearAll(); opt.payload.rendezvousInformation.Emplace().Set(RendezvousInformationFlag::kOnNetwork); opt.mWiFi = false; opt.mThread = false; @@ -130,20 +137,39 @@ int main(int argc, char * argv[]) VerifyOrDie(ChipLinuxAppInit(__argc__, const_cast(__argv__)) == 0); device_translator matter_device_translator; - matter_node_state_monitor node_state_monitor(matter_device_translator); + UnifyEmberInterface ember_interface; + matter_node_state_monitor node_state_monitor(matter_device_translator, ember_interface); + UicMqtt uic_mqtt_handler; + + // Initializing Group cluster command handler + GroupClusterCommandHandler group_handler(node_state_monitor, uic_mqtt_handler); - // 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 OnOff command handler + OnOffClusterCommandHandler on_cmd_handler(node_state_monitor, uic_mqtt_handler); + OnOffAttributeAccess on_off_attribute_handler(node_state_monitor); + + // Initializing Identify Cluster Commands handler + IdentifyClusterCommandHandler identify_cluster_commands_handler(node_state_monitor, uic_mqtt_handler); + IdentifyAttributeAccess identify_attribute_handler(node_state_monitor); + // Initializing Level Cluster handler - // LevelClusterCommandHandler level_cluster_commands_handler(node_state_monitor); - // LevelAttributeAccess level_attribute_handler(node_state_monitor); + LevelControlClusterCommandHandler level_cluster_commands_handler(node_state_monitor, uic_mqtt_handler); + LevelControlAttributeAccess level_attribute_handler(node_state_monitor); + + // Initializing color controller cluster command handler + ColorControlClusterCommandHandler color_control_commands_handler(node_state_monitor, uic_mqtt_handler); + ColorControlAttributeAccess color_control_attribute_handler(node_state_monitor); + + // Initializing OccupancySensing command handler + OccupancySensingClusterCommandHandler occupancy_sensing_command_handler(node_state_monitor, uic_mqtt_handler); + OccupancySensingAttributeAccess occupancy_sensing_attribute_access(node_state_monitor); + + // Initializing Temperature Measurement command handler + TemperatureMeasurementClusterCommandHandler temperature_measurement_command_handler(node_state_monitor, uic_mqtt_handler); + TemperatureMeasurementAttributeAccess temperature_measurement_attribute_access(node_state_monitor); matter_running = true; auto handle = run_unify(); 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 index 6b559ce8ccea0f..574dd484dc189b 100644 --- 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 @@ -12,145 +12,129 @@ *****************************************************************************/ #include "matter_cluster_interactor.hpp" +#include "matter.h" #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 -{ +constexpr const char * LOG_TAG = "cluster_interactor"; +constexpr int kNodeLabelSize = 32; +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) +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()}); + constexpr int kDescriptorAttributeArraySize = 254; + constexpr int kFixedLabelAttributeArraySize = 254; - 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 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 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()}); + auto fixed_label_cluster = endpoint_builder.register_cluster(ZCL_FIXED_LABEL_CLUSTER_ID); + fixed_label_cluster.attributes.push_back(EmberAfAttributeMetadata{ ZCL_LABEL_LIST_ATTRIBUTE_ID, ZCL_ARRAY_ATTRIBUTE_TYPE, + kFixedLabelAttributeArraySize, 0, ZAP_EMPTY_DEFAULT() }); } -} // namespace +} // namespace -namespace unify::matter_bridge -{ -cluster_interactor::cluster_interactor( - const device_translator &translator, - matter_endpoint_builder &endpoint_builder) : - translator(translator), endpoint_builder(endpoint_builder) +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) +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()); - } - } + bool basic_cluster_is_supported = false; + for (const auto & [cluster_name, cluster] : clusters) + { + if (cluster_name == "NameAndLocation") + { + sl_log_info(LOG_TAG, " NameAndLocation cluster is already mapped to BasicBridgedDevice Info."); + continue; + } + 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()); + } - 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()); - } - } + 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 &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()}); - } - } + 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() }); + } + } + if (cluster_name == "Basic") + { + basic_cluster_is_supported = true; + cluster_builder.attributes.emplace_back(EmberAfAttributeMetadata{ + ZCL_NODE_LABEL_ATTRIBUTE_ID, ZCL_CHAR_STRING_ATTRIBUTE_TYPE, kNodeLabelSize, 0, ZAP_EMPTY_DEFAULT() }); + cluster_builder.attributes.emplace_back( + EmberAfAttributeMetadata{ ZCL_REACHABLE_ATTRIBUTE_ID, ZCL_BOOLEAN_ATTRIBUTE_TYPE, 1, 0, ZAP_EMPTY_DEFAULT() }); + } - clusterlist.push_back(cluster_name.c_str()); - } - append_bridged_clusters(endpoint_builder); + clusterlist.push_back(cluster_name.c_str()); + } + if (!basic_cluster_is_supported) + { + 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() }); + } + 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]; + 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 +} // 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 index 495523e3592e4e..5ca667b917ebfb 100644 --- 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 @@ -28,8 +28,8 @@ namespace unify::matter_bridge class cluster_interactor { public: - cluster_interactor(const device_translator &translator, - matter_endpoint_builder &endpoint_builder); + cluster_interactor(const device_translator &_translator, + matter_endpoint_builder &_endpoint_builder); std::optional get_matter_type() const; void build_matter_cluster( 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 index ccbbdd46f39637..c402e7f86fb2d0 100644 --- 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 @@ -29,8 +29,8 @@ std::shared_ptr> make_shared(const std::vector &data) namespace unify::matter_bridge { matter_cluster_builder::matter_cluster_builder( - const std::function &on_done) : - on_done(on_done) + const std::function &_on_done) : + on_done(_on_done) {} matter_cluster_builder::~matter_cluster_builder() @@ -38,7 +38,6 @@ matter_cluster_builder::~matter_cluster_builder() on_done(*this); } - matter_cluster_builder matter_endpoint_builder::register_cluster(const chip::ClusterId &cluster_id) 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 index 9902206859d316..9f431b555553f6 100644 --- 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 @@ -13,29 +13,27 @@ #ifndef MATTER_ENDPOINT_BUILDER_HPP #define MATTER_ENDPOINT_BUILDER_HPP -#include +#include "matter_context.hpp" #include #include -#include #include +#include #include -#include "matter_context.hpp" +#include -namespace unify::matter_bridge -{ +namespace unify::matter_bridge { class matter_cluster_builder { - public: - matter_cluster_builder( - const std::function &on_done); - ~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; + std::vector incoming_commands; + std::vector outgoing_commands; + std::vector attributes; - private: - const std::function on_done; +private: + const std::function on_done; }; /** @@ -46,7 +44,7 @@ class matter_cluster_builder * * 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 @@ -56,24 +54,24 @@ class matter_cluster_builder */ 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); +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(); + /** + * @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 +} // 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 index c24658b4677a9a..90c0633a144567 100644 --- 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 @@ -13,76 +13,34 @@ #include #include #include + +// Matter includes #include "matter.h" +// Unify bridge components #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" +// Unify lib components #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++; - } +namespace unify::zap_types { + #include "zap-types.h" } -/** - * @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 - +constexpr const char *LOG_TAG = "matter_node_state_monitor"; namespace unify::matter_bridge { matter_node_state_monitor::matter_node_state_monitor( - const class device_translator &translator) : - matter_device_translator(translator) + const class device_translator &translator, UnifyEmberInterface &ember_interface) : + matter_device_translator(translator), unify_ember_interface(ember_interface) { // 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), + auto endpoints_count = unify_ember_interface.emberAfFixedEndpointCountUnify(); + unify_ember_interface.emberAfEndpointEnableDisableUnify( + unify_ember_interface.emberAfEndpointFromIndexUnify(endpoints_count - 1), false); - unify::node_state_monitor::node_state_monitor::get_instance().set_interface( this); } @@ -122,30 +80,38 @@ void matter_node_state_monitor::on_unify_node_added( if (status_persisted_endpoint_map) { bridge.matter_endpoint = unify_node.matter_endpoint.value(); } else { - bridge.matter_endpoint = get_next_ember_endpoint_id(); + bridge.matter_endpoint = unify_ember_interface.getNextDynamicAvailableEndpointIndex(); 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(); + + // The bridge.matter_endpoint is then next available endpoint. The index + // when registered will be added by FIXED_ENDPOINT_COUNT. Which is why we + // substract it first. + bridge.index = bridge.matter_endpoint - unify_ember_interface.emberAfFixedEndpointCountUnify(); + + // Update or add the bridged endpoint + erase_mapper_endpoint(node.unid, bridge.matter_endpoint); 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); + = (node.state == unify::zap_types::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); + unify_ember_interface.emberAfClearDynamicEndpointUnify(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}; @@ -161,7 +127,7 @@ void matter_node_state_monitor::on_unify_node_state_changed( 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); + = (node.state == unify::zap_types::ZCL_NODE_STATE_NETWORK_STATUS_ONLINE_FUNCTIONAL); invoke_listeners(ep->second, update_t::NODE_STATE_CHANGED); } } @@ -204,4 +170,47 @@ void matter_node_state_monitor::register_event_listener( event_listeners.push_back(event_listener); } +void matter_node_state_monitor::erase_mapper_endpoint(const std::string unid, chip::EndpointId endpoint) +{ + const auto &[start, end] = bridged_endpoints.equal_range(unid); + for (auto ep = start; ep != end; ep++) { + if (ep->second.matter_endpoint == endpoint) { + bridged_endpoints.erase(ep); + return; + } + } +} + +void matter_node_state_monitor::register_dynamic_endpoint(const struct bridged_endpoint &bridge) +{ + uint16_t index = unify_ember_interface.emberAfGetDynamicIndexFromEndpointUnify(bridge.matter_endpoint); + if (index != kEmberInvalidEndpointIndex) { + chip::EndpointId ep = unify_ember_interface.emberAfClearDynamicEndpointUnify(index); + if (ep != bridge.matter_endpoint) { + sl_log_error(LOG_TAG, "The endpoint %d is not cleared from the dynamic endpoint index %d", bridge.matter_endpoint, index); + } + sl_log_debug(LOG_TAG, "Dynamic endpoint already exists for bridge endpoint %d. Cleared out the endpoint to replace it.", bridge.matter_endpoint); + } + + EmberAfStatus status = unify_ember_interface.emberAfSetDynamicEndpointUnify( + 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), + 1); + 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 unify::matter_bridge \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/matter_wrappers/unify_ember_interface.hpp b/silabs_examples/unify-matter-bridge/linux/src/matter_wrappers/unify_ember_interface.hpp new file mode 100644 index 00000000000000..2641e292761a28 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/matter_wrappers/unify_ember_interface.hpp @@ -0,0 +1,93 @@ +/****************************************************************************** + * # 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 "sl_log.h" +#include +#include + +class UnifyEmberInterface +{ +protected: + chip::EndpointId last_returned_available_endpoint_id = FIXED_ENDPOINT_COUNT; + const char * LOG_TAG = "Unify Ember Interface"; + +public: + // Class setup and teardown + UnifyEmberInterface(){}; + virtual ~UnifyEmberInterface(){}; + + // Wrapper logic improving the interface + + /** + * @brief Get next available dynamic endpoint. + * + * If more than 65535 - FIXED_ENDPOINT_COUNT is registered the function will + * return chip::kInvalidEndpointId. + * + * @return chip::EndpointId + */ + chip::EndpointId getNextDynamicAvailableEndpointIndex() + { + // Initially increment the endpoint count by 1 to skip the last fixed + // endpoint + chip::EndpointId endpoint_id = static_cast(last_returned_available_endpoint_id + 1); + for (; endpoint_id < MAX_ENDPOINT_COUNT; endpoint_id++) + { + if (emberAfGetDynamicIndexFromEndpointUnify(endpoint_id) == chip::kInvalidEndpointId && + endpoint_id < MAX_ENDPOINT_COUNT) + { + last_returned_available_endpoint_id = endpoint_id; + return endpoint_id; + } + } + + // If we have used all our endpoints or the incremented endpoint is + // already in use, search for a valid endpoint (This is not good for + // scale aka large networks). + sl_log_debug(LOG_TAG, "Warning: searching through all endpoints to find a free one"); + chip::EndpointId endpoint_count_start = emberAfFixedEndpointCountUnify(); + for (chip::EndpointId i = endpoint_count_start; i < MAX_ENDPOINT_COUNT; i++) + { + if (emberAfGetDynamicIndexFromEndpointUnify(i) == chip::kInvalidEndpointId) + { + return i; + } + } + return chip::kInvalidEndpointId; + } + + // Matter ember interface stack wrappers (Please add wrappers here if functions are missing) + // src/app/util/attribute-storage.h + virtual uint16_t emberAfGetDynamicIndexFromEndpointUnify(chip::EndpointId id) { return emberAfGetDynamicIndexFromEndpoint(id); } + virtual EmberAfStatus emberAfSetDynamicEndpointUnify(uint16_t index, chip::EndpointId id, const EmberAfEndpointType * ep, + const chip::Span & dataVersionStorage, + chip::Span deviceTypeList = {}, + chip::EndpointId parentEndpointId = chip::kInvalidEndpointId) + { + EmberAfStatus emberStatus = emberAfSetDynamicEndpoint(index, id, ep, dataVersionStorage, deviceTypeList, parentEndpointId); + return emberStatus; + } + virtual chip::EndpointId emberAfClearDynamicEndpointUnify(uint16_t index) + { + chip::EndpointId id = emberAfClearDynamicEndpoint(index); + return id; + } + + // src/app/util/af.h + virtual bool emberAfEndpointEnableDisableUnify(chip::EndpointId endpoint, bool enabled) + { + return emberAfEndpointEnableDisable(endpoint, enabled); + } + virtual chip::EndpointId emberAfEndpointFromIndexUnify(uint16_t index) { return emberAfEndpointFromIndex(index); } + virtual uint16_t emberAfFixedEndpointCountUnify(void) { return emberAfFixedEndpointCount(); }; +}; \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/tests/BUILD.gn b/silabs_examples/unify-matter-bridge/linux/src/tests/BUILD.gn new file mode 100644 index 00000000000000..8b05b312308105 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/tests/BUILD.gn @@ -0,0 +1,38 @@ +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") +import("//build_overrides/nlunit_test.gni") + +import("${chip_root}/build/chip/chip_test_suite.gni") + +chip_test_suite("tests") { + output_name = "unifyMatterBridgeTests" + + test_sources = [ + "TestExample.cpp", + "TestDeviceMapper.cpp", + "TestOnOffCommandsHandler.cpp", + "TestNodeStateMonitor.cpp" + ] + + cflags = [ "-Wconversion" ] + + + public_deps = [ + "//:unify-matter-bridge-lib", + "${chip_root}/src/lib/support:testing", + "${nlunit_test_root}:nlunit-test", + ] +} diff --git a/silabs_examples/unify-matter-bridge/linux/src/tests/README.md b/silabs_examples/unify-matter-bridge/linux/src/tests/README.md new file mode 100644 index 00000000000000..777f8a5246f729 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/tests/README.md @@ -0,0 +1,45 @@ +# Unify matter bridge unit testing + +For unit testing the matter bridge we are tapping into the test eco system of +Matter. Writing a unit test is done with the NL Unit test framework and Matter +helper functions. Please refer to [Test example](TestExample.cpp) for writing a +simple unit test. After writing a unit test remember to add the source file in +the [BUILD.gn](BUILD.gn). + +## Compiling the unit test + +When wanting to compile the unit test use the below GN command to generate the ninja files: + +```bash +silabs_examples/unify-matter-bridge/linux$ gn gen out/host --args='chip_build_tests=true use_coverage=true' +``` + +After generating the ninja files generating the tests is done as below: + +```bash +silabs_examples/unify-matter-bridge/linux$ ninja -C out/host check +``` + +This generates test binaries inside `out/host/tests` where test executables can +be found. + +## Running the unit test + +So far we are not aware of how to run all the unit tests so running a unit test +currently is done by locating your test binary and executing it. + +```bash +matter/silabs_examples/unify-matter-bridge/linux$ ./out/host/tests/TestExample +'#0:','ExampleTests' +'#3:','Example::TestExample','PASSED' +'#6:','0','1' +'#7:','0','1' +``` + +## Getting unit test coverage + +For getting unit test coverage the Matter repo has a helper script. So after generating your test files you can run the below script: + +```bash +matter/silabs_examples/unify-matter-bridge/linux$ ../../../scripts/build_coverage.sh --output_root out/host +``` diff --git a/silabs_examples/unify-matter-bridge/linux/src/tests/TestDeviceMapper.cpp b/silabs_examples/unify-matter-bridge/linux/src/tests/TestDeviceMapper.cpp new file mode 100644 index 00000000000000..f9cfc2dce309be --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/tests/TestDeviceMapper.cpp @@ -0,0 +1,67 @@ +#include "matter_device_translator.hpp" +#include "matter_device_types_clusters_list_updated.inc" + +// Chip components +#include +#include + + +// Third party library +#include +#include +#include +#include +#include + +using namespace unify::matter_bridge; + +device_translator obj; +void TestDeviceMapper(nlTestSuite * inSuite, void * aContext) +{ +std::vector clusters = { + "Basic", + "Identify", + "DoorLock", + }; +std::vector device_type_id = obj.get_device_types(clusters); +const char *dt = matter_device_type_vs_clusters_map.find(device_type_id[0])->second.second; +std::string device_type(dt); +NL_TEST_ASSERT(inSuite, device_type == "doorlock"); +clusters.push_back("Scenes"); +clusters.push_back("Groups"); +device_type_id = obj.get_device_types(clusters); +const char *dt_2 = matter_device_type_vs_clusters_map.find(device_type_id[0])->second.second; +std::string device_type_2(dt_2); +NL_TEST_ASSERT(inSuite, device_type_2 == "doorlock"); + +std::vector OccupancySensing_clusters = { "Basic", "Identify", "OccupancySensing", "IASZone"}; +device_type_id = obj.get_device_types(OccupancySensing_clusters); +const char * dt_Occupancy = matter_device_type_vs_clusters_map.find(device_type_id[0])->second.second; +std::string device_type_occupancy(dt_Occupancy); +NL_TEST_ASSERT(inSuite, device_type_occupancy == "occupancysensor"); + +std::vector colordimmablelight_clusters = { "Basic", "Identify", "Groups", "Scenes", "OnOff", "Level", "ColorControl" }; +device_type_id = obj.get_device_types(colordimmablelight_clusters); +const char * dt_colordimmablelight = matter_device_type_vs_clusters_map.find(device_type_id[0])->second.second; +std::string device_type_colordimmablelight(dt_colordimmablelight); +NL_TEST_ASSERT(inSuite, device_type_colordimmablelight == "colordimmablelight"); + +} + +class TestContext +{ +public: + nlTestSuite * mTestSuite; +}; + +static const nlTest sTests[] = { NL_TEST_DEF("TestDeviceMapper", TestDeviceMapper), + NL_TEST_SENTINEL() }; + +static nlTestSuite TheCommandSuite = { "TestDeviceMapperHandler", &sTests[0], nullptr, nullptr }; + +int TestDeviceMapperHandler(void) +{ + return (chip::ExecuteTestsWithContext(&TheCommandSuite)); +} + +CHIP_REGISTER_TEST_SUITE(TestDeviceMapperHandler) diff --git a/silabs_examples/unify-matter-bridge/linux/src/tests/TestExample.cpp b/silabs_examples/unify-matter-bridge/linux/src/tests/TestExample.cpp new file mode 100644 index 00000000000000..fdecfba702bf1e --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/tests/TestExample.cpp @@ -0,0 +1,47 @@ +// Unify bridge components + +// Chip components +#include +#include + +// Third party library +#include + +static void TestExample(nlTestSuite * inSuite, void * aContext) +{ + NL_TEST_ASSERT(inSuite, true); +} + +class TestContext +{ +public: + nlTestSuite * mTestSuite; + uint32_t mNumTimersHandled; +}; + +/** + * Test Suite. It lists all the test functions. + */ +// clang-format off +static const nlTest sTests[] = +{ + NL_TEST_DEF("Example::TestExample", TestExample), + NL_TEST_SENTINEL() +}; + + +// clang-format off +static nlTestSuite kTheSuite = +{ + "ExampleTests", + &sTests[0], + nullptr, + nullptr +}; + +int TestExampleSuite(void) +{ + return chip::ExecuteTestsWithContext(&kTheSuite); +} + +CHIP_REGISTER_TEST_SUITE(TestExampleSuite) \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/tests/TestNodeStateMonitor.cpp b/silabs_examples/unify-matter-bridge/linux/src/tests/TestNodeStateMonitor.cpp new file mode 100644 index 00000000000000..684d60b37783bc --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/tests/TestNodeStateMonitor.cpp @@ -0,0 +1,396 @@ +// Unify bridge components +#include "matter_device_translator.hpp" +#include "matter_node_state_monitor.hpp" + +// Unify lib components +#include "sl_log.h" +namespace unify_zap_types { +#include "zap-types.h" +} + +// Chip components +#include +#include + +// Third party library +#include + +#define TEST_LOG_TAG "NodeStateMonitorTest" + +class MockedUnifyEmberInterface : public UnifyEmberInterface +{ +public: + MockedUnifyEmberInterface() : UnifyEmberInterface(){}; + + chip::EndpointId calledWithId = 101; + uint16_t calledWithIndex; + EmberAfEndpointType * calledWithEndpoint; + chip::Span calledWithDeviceTypeList = {}; + chip::EndpointId calledWithParentEndpointId = chip::kInvalidEndpointId; + bool lastCalledEnabled; + + int calledNTimes = 0; + + // All the endpoints cleared + std::vector cleared_endpoints; + + EmberAfStatus emberAfSetDynamicEndpointUnify(uint16_t index, chip::EndpointId id, const EmberAfEndpointType * ep, + const chip::Span & dataVersionStorage, + chip::Span deviceTypeList, + chip::EndpointId parentEndpointId) override + { + calledWithIndex = index; + calledWithId = id; + calledWithEndpoint = const_cast(ep); + calledWithDeviceTypeList = deviceTypeList; + calledWithParentEndpointId = parentEndpointId; + return emberAfSetDynamicEndpoint(index, id, ep, dataVersionStorage, deviceTypeList, parentEndpointId); + } + + uint16_t emberAfFixedEndpointCountUnify() override { return emberAfFixedEndpointCount(); } + + chip::EndpointId emberAfClearDynamicEndpointUnify(uint16_t index) override + { + chip::EndpointId id = emberAfClearDynamicEndpoint(index); + if (id != chip::kInvalidEndpointId) + { + cleared_endpoints.push_back(id); + } + return id; + } + + chip::EndpointId getLastReturnedAvailableEndpointId() { return last_returned_available_endpoint_id; } +}; + +class NodeStateMonitorTest : public unify::matter_bridge::matter_node_state_monitor +{ +public: + NodeStateMonitorTest(unify::matter_bridge::device_translator & device_translator, MockedUnifyEmberInterface & ember_interface) : + matter_node_state_monitor(device_translator, ember_interface){}; + + void call_on_unify_node_added(const unify::node_state_monitor::node & node) { this->on_unify_node_added(node); } + + void call_on_unify_node_removed(const std::string & unid) { this->on_unify_node_removed(unid); } + + void call_on_unify_node_state_changed(const unify::node_state_monitor::node & node) { this->on_unify_node_state_changed(node); } + + long unsigned int listeners_count() { return this->event_listeners.size(); } + + long unsigned int bridged_endpoints_count() { return this->bridged_endpoints.size(); } +}; + +struct test_data_struct +{ + test_data_struct() + { + state_update_called = 0; + last_state = unify::matter_bridge::matter_node_state_monitor::NODE_DELETED; + state_update_history.clear(); + } + int state_update_called; + unify::matter_bridge::matter_node_state_monitor::update_t last_state; + std::vector state_update_history; +}; + +static test_data_struct test_data; + +void reset_test_data() +{ + test_data.state_update_called = 0; + test_data.last_state = unify::matter_bridge::matter_node_state_monitor::NODE_DELETED; + test_data.state_update_history.clear(); +} + +void unify_node_state_update(const unify::matter_bridge::bridged_endpoint & ep, + unify::matter_bridge::matter_node_state_monitor::update_t state) +{ + test_data.state_update_called++; + test_data.state_update_history.push_back(state); +} + +static void TestNodeStateMonitorAddingNode(nlTestSuite * inSuite, void * aContext) +{ + // 1 + // First test case covers adding a single node with a single endpoint + reset_test_data(); + + // Initialize the node state monitor + unify::matter_bridge::device_translator matter_device_translator; + MockedUnifyEmberInterface unify_ember_interface; + NodeStateMonitorTest node_state_monitor(matter_device_translator, unify_ember_interface); + + node_state_monitor.register_event_listener(unify_node_state_update); + NL_TEST_ASSERT(inSuite, node_state_monitor.listeners_count() == 1); + + // Create a node with OnOff Cluster endpoint + unify::node_state_monitor::node node("unid-node-1"); + auto & cluster = node.emplace_endpoint(1).emplace_cluster("OnOff"); + cluster.supported_commands = { "On", "Off", "Toggle" }; + cluster.attributes.emplace("OnOff"); + + // Initial add should first call a NODE_ADDED event and then a NODE_STATE_CHANGED event + node_state_monitor.call_on_unify_node_added(node); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 2); + NL_TEST_ASSERT(inSuite, test_data.state_update_history.at(0) == unify::matter_bridge::matter_node_state_monitor::NODE_ADDED); + NL_TEST_ASSERT(inSuite, + test_data.state_update_history.at(1) == unify::matter_bridge::matter_node_state_monitor::NODE_STATE_CHANGED); + NL_TEST_ASSERT(inSuite, node_state_monitor.bridged_endpoints_count() == 1); + + // 2 + // Second test case introduces another endpoint and adds the same node twice. + // Reset test + reset_test_data(); + + // Adding another endpoint to the same node + auto & cluster_2 = node.emplace_endpoint(2).emplace_cluster("Level"); + cluster_2.supported_commands = { "MoveToLevel", "Move", "Step" }; + cluster_2.attributes.emplace("CurrentLevel"); + + // Adding a node with multiple endpoints + node_state_monitor.call_on_unify_node_added(node); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 4); + NL_TEST_ASSERT(inSuite, test_data.state_update_history.at(0) == unify::matter_bridge::matter_node_state_monitor::NODE_ADDED); + NL_TEST_ASSERT(inSuite, + test_data.state_update_history.at(1) == unify::matter_bridge::matter_node_state_monitor::NODE_STATE_CHANGED); + NL_TEST_ASSERT(inSuite, test_data.state_update_history.at(2) == unify::matter_bridge::matter_node_state_monitor::NODE_ADDED); + NL_TEST_ASSERT(inSuite, + test_data.state_update_history.at(3) == unify::matter_bridge::matter_node_state_monitor::NODE_STATE_CHANGED); + sl_log_debug(TEST_LOG_TAG, "Bridged endpoints count: %d", node_state_monitor.bridged_endpoints_count()); + NL_TEST_ASSERT(inSuite, node_state_monitor.bridged_endpoints_count() == 2); + + // Adding the same node again triggers everything again except registering a new dynamic endpoint + node_state_monitor.call_on_unify_node_added(node); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 8); + // This fails - we blindly adds bridged endpoints without checking if they are already added + NL_TEST_ASSERT(inSuite, node_state_monitor.bridged_endpoints_count() == 2); +} + +static void TestNodeStateMonitoringStateChangingNode(nlTestSuite * inSuite, void * aContext) +{ + reset_test_data(); + + // Initialize the node state monitor + unify::matter_bridge::device_translator matter_device_translator; + MockedUnifyEmberInterface unify_ember_interface; + NodeStateMonitorTest node_state_monitor(matter_device_translator, unify_ember_interface); + node_state_monitor.register_event_listener(unify_node_state_update); + + // Create a node with OnOff Cluster endpoint + unify::node_state_monitor::node node_2("unid-node-2"); + auto & cluster = node_2.emplace_endpoint(1).emplace_cluster("OnOff"); + cluster.supported_commands = { "On", "Off", "Toggle" }; + cluster.attributes.emplace("OnOff"); + + // Call a state change before node is added nothing should happen! + node_state_monitor.call_on_unify_node_state_changed(node_2); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 0); + + // Initial add should first call a NODE_ADDED event and then a NODE_STATE_CHANGED event + node_state_monitor.call_on_unify_node_added(node_2); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 2); + NL_TEST_ASSERT(inSuite, test_data.state_update_history.at(0) == unify::matter_bridge::matter_node_state_monitor::NODE_ADDED); + NL_TEST_ASSERT(inSuite, + test_data.state_update_history.at(1) == unify::matter_bridge::matter_node_state_monitor::NODE_STATE_CHANGED); + + // Call a state change after node is added should trigger a NODE_STATE_CHANGED event + node_state_monitor.call_on_unify_node_state_changed(node_2); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 3); + NL_TEST_ASSERT(inSuite, + test_data.state_update_history.at(2) == unify::matter_bridge::matter_node_state_monitor::NODE_STATE_CHANGED); +} + +static void TestOnNodeRemoved(nlTestSuite * inSuite, void * aContext) +{ + reset_test_data(); + + // Setup + // Initialize the node state monitor + unify::matter_bridge::device_translator matter_device_translator; + MockedUnifyEmberInterface unify_ember_interface; + NodeStateMonitorTest node_state_monitor(matter_device_translator, unify_ember_interface); + node_state_monitor.register_event_listener(unify_node_state_update); + + // Create a node with OnOff Cluster endpoint + const std::string node_id = "unid-node-3"; + unify::node_state_monitor::node node_3(node_id); + auto & cluster = node_3.emplace_endpoint(1).emplace_cluster("OnOff"); + cluster.supported_commands = { "On", "Off", "Toggle" }; + cluster.attributes.emplace("OnOff"); + + // 1 + // First test case introduces a node and removes it + + // Initial add should first call a NODE_ADDED event and then a NODE_STATE_CHANGED event + node_state_monitor.call_on_unify_node_added(node_3); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 2); + NL_TEST_ASSERT(inSuite, test_data.state_update_history.at(0) == unify::matter_bridge::matter_node_state_monitor::NODE_ADDED); + NL_TEST_ASSERT(inSuite, + test_data.state_update_history.at(1) == unify::matter_bridge::matter_node_state_monitor::NODE_STATE_CHANGED); + + // Remove the node + node_state_monitor.call_on_unify_node_removed(node_id); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 3); + NL_TEST_ASSERT(inSuite, test_data.state_update_history.at(2) == unify::matter_bridge::matter_node_state_monitor::NODE_DELETED); + NL_TEST_ASSERT(inSuite, node_state_monitor.bridged_endpoints_count() == 0); + + // 2 + // Second test case adds the same node again and removes it + node_state_monitor.call_on_unify_node_added(node_3); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 5); + NL_TEST_ASSERT(inSuite, test_data.state_update_history.at(3) == unify::matter_bridge::matter_node_state_monitor::NODE_ADDED); + NL_TEST_ASSERT(inSuite, + test_data.state_update_history.at(4) == unify::matter_bridge::matter_node_state_monitor::NODE_STATE_CHANGED); + + node_state_monitor.call_on_unify_node_removed(node_id); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 6); + + // 3 + // Removed a node which does not exist + node_state_monitor.call_on_unify_node_removed(node_id); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 6); +} + +static void TestMultipleListeners(nlTestSuite * inSuite, void * aContext) +{ + reset_test_data(); + // Setup + // Initialize the node state monitor + unify::matter_bridge::device_translator matter_device_translator; + MockedUnifyEmberInterface unify_ember_interface; + NodeStateMonitorTest node_state_monitor(matter_device_translator, unify_ember_interface); + + // Create a node with OnOff Cluster endpoint + const std::string node_id = "unid-node-3"; + unify::node_state_monitor::node node_4(node_id); + auto & cluster = node_4.emplace_endpoint(1).emplace_cluster("OnOff"); + cluster.supported_commands = { "On", "Off", "Toggle" }; + cluster.attributes.emplace("OnOff"); + + // Create additional listener functions + int listener_1_called = 0; + uint8_t listener_1_unify_endpoint_id = 0; + int listener_2_called = 0; + uint8_t listener_2_unify_endpoint_id = 0; + + auto listener_1 = [&](const unify::matter_bridge::bridged_endpoint & ep, + unify::matter_bridge::matter_node_state_monitor::update_t state) { + listener_1_called++; + listener_1_unify_endpoint_id = ep.unify_endpoint; + }; + + auto listener_2 = [&](const unify::matter_bridge::bridged_endpoint & ep, + unify::matter_bridge::matter_node_state_monitor::update_t state) { + listener_2_called++; + listener_2_unify_endpoint_id = ep.unify_endpoint; + }; + + // Register a listener + node_state_monitor.register_event_listener(unify_node_state_update); + node_state_monitor.register_event_listener(listener_1); + node_state_monitor.register_event_listener(listener_2); + + // Add the node + node_state_monitor.call_on_unify_node_added(node_4); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 2); + NL_TEST_ASSERT(inSuite, listener_1_called == 2); + NL_TEST_ASSERT(inSuite, listener_2_called == 2); + NL_TEST_ASSERT(inSuite, listener_1_unify_endpoint_id == listener_2_unify_endpoint_id); +} + +static void TestEmberInterfaceNodeAdded(nlTestSuite * inSuite, void * aContext) +{ + sl_log_warning(TEST_LOG_TAG, "Starting TestEmberInterfaceNodeAdded"); + reset_test_data(); + + // Setup + // Initialize the node state monitor + unify::matter_bridge::device_translator matter_device_translator; + MockedUnifyEmberInterface unify_ember_interface; + NodeStateMonitorTest node_state_monitor(matter_device_translator, unify_ember_interface); + node_state_monitor.register_event_listener(unify_node_state_update); + + // Create a node with clustr endpoints resembling a dimmable light. + const std::string node_id = "unid-ember-check-1"; + unify::node_state_monitor::node node_ember_1(node_id); + auto & ep = node_ember_1.emplace_endpoint(1); + auto & onoff_cluster = ep.emplace_cluster("OnOff"); + onoff_cluster.supported_commands = { "On", "Off", "Toggle" }; + onoff_cluster.attributes.emplace("OnOff"); + ep.emplace_cluster("Level"); + ep.emplace_cluster("Basic"); + ep.emplace_cluster("Identify"); + ep.emplace_cluster("Groups"); + ep.emplace_cluster("Scenes"); + + // 1 + // Add a unify node and check the proper ember calls are made. + + // Initial add should first call a NODE_ADDED event and then a NODE_STATE_CHANGED event + node_state_monitor.call_on_unify_node_added(node_ember_1); + NL_TEST_ASSERT(inSuite, test_data.state_update_called == 2); + NL_TEST_ASSERT(inSuite, test_data.state_update_history.at(0) == unify::matter_bridge::matter_node_state_monitor::NODE_ADDED); + NL_TEST_ASSERT(inSuite, + test_data.state_update_history.at(1) == unify::matter_bridge::matter_node_state_monitor::NODE_STATE_CHANGED); + + // Check the ember calls + chip::EndpointId matter_endpoint_id = unify_ember_interface.getLastReturnedAvailableEndpointId(); + + // Check endpoints and indexes + NL_TEST_ASSERT(inSuite, unify_ember_interface.calledWithId == matter_endpoint_id); + // The matter_endpoint_id and index should be the same when matter_endpoint_id is substracted by FIXED_ENDPOINT_COUNT + NL_TEST_ASSERT(inSuite, unify_ember_interface.calledWithIndex == matter_endpoint_id - FIXED_ENDPOINT_COUNT); + NL_TEST_ASSERT(inSuite, unify_ember_interface.cleared_endpoints.empty()); + + // Check the cluster mapping to a device of the node deviceId 19 is always + // present in the device type list. Do not know why. + const uint16_t smart_plug_device_id = 0x0101; + + bool matched_device_type = false; + for (auto & deviceType : unify_ember_interface.calledWithDeviceTypeList) + { + sl_log_debug(TEST_LOG_TAG, "Device types in list %d", deviceType.deviceId); + if (deviceType.deviceId == smart_plug_device_id) + { + matched_device_type = true; + } + } + NL_TEST_ASSERT(inSuite, matched_device_type); +} + +class TestContext +{ +public: + nlTestSuite * mTestSuite; + uint32_t mNumTimersHandled; +}; + +/** + * Test Suite. It lists all the test functions. + */ +// clang-format off +static const nlTest sTests[] = +{ + NL_TEST_DEF("NodeStateMonitor::TestNodeStateMonitorAddingNode", TestNodeStateMonitorAddingNode), + NL_TEST_DEF("NodeStateMonitor::TestNodeStateMonitoringStateChangingNode", TestNodeStateMonitoringStateChangingNode), + NL_TEST_DEF("NodeStateMonitor::TestOnNodeRemoved", TestOnNodeRemoved), + NL_TEST_DEF("NodeStateMonitor::TestMultipleListeners", TestMultipleListeners), + NL_TEST_DEF("NodeStateMonitor::TestEmberInterfaceNodeAdded", TestEmberInterfaceNodeAdded), + NL_TEST_SENTINEL() +}; + + +// clang-format off +static nlTestSuite kTheSuite = +{ + "NodeStateMonitorTests", + &sTests[0], + nullptr, + nullptr +}; + +int TestNodeStateMonitorSuite(void) +{ + return chip::ExecuteTestsWithContext(&kTheSuite); +} + +CHIP_REGISTER_TEST_SUITE(TestNodeStateMonitorSuite) \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/tests/TestOnOffCommandsHandler.cpp b/silabs_examples/unify-matter-bridge/linux/src/tests/TestOnOffCommandsHandler.cpp new file mode 100644 index 00000000000000..57590207f55148 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/tests/TestOnOffCommandsHandler.cpp @@ -0,0 +1,110 @@ +// Unify bridge components +#include "command_translator.hpp" +#include "matter_device_translator.hpp" +#include "matter_node_state_monitor.hpp" + +// Chip components +#include +#include + +// Third party library +#include +#include +#include + +using namespace unify::matter_bridge; + +static UnifyEmberInterface ember_interface = UnifyEmberInterface(); + +class MockMatterNodeStateMonitor : public matter_node_state_monitor +{ +public: + MockMatterNodeStateMonitor() : matter_node_state_monitor(device_translator(), ember_interface), test_bridge_ep(matter_endpoint_context()) {} + + const struct bridged_endpoint * bridged_endpoint(chip::EndpointId endpoint) const override + { + ++nNumBridgedMethodCall; + if (endpoint >= 2) + { + test_bridge_ep.matter_endpoint = endpoint; + test_bridge_ep.unify_endpoint = 4; + test_bridge_ep.unify_unid = "zw-0x0002"; + return &test_bridge_ep; + } + else + { + return nullptr; + } + } + + mutable int nNumBridgedMethodCall = 0; + mutable struct bridged_endpoint test_bridge_ep; +}; + +class MockCommandHandlerCallback : public chip::app::CommandHandler::Callback +{ +public: + void OnDone(chip::app::CommandHandler & apCommandHandler) final { onFinalCalledTimes++; } + void DispatchCommand(chip::app::CommandHandler & apCommandObj, const chip::app::ConcreteCommandPath & aCommandPath, + chip::TLV::TLVReader & apPayload) final + {} + chip::Protocols::InteractionModel::Status CommandExists(const chip::app::ConcreteCommandPath & aCommandPath) + { + return chip::Protocols::InteractionModel::Status::Success; + } + + int onFinalCalledTimes = 0; +}; + +class MockUicMqttPublish : public UicMqtt +{ +public: + void Publish(std::string topic, std::string message, bool retain) override + { + publish_topic = topic; + ++nNumerUicMqttPublishCall; + } + int nNumerUicMqttPublishCall = 0; + std::string publish_topic; +}; + +void TestOnOffClusterCommandHandler(nlTestSuite * inSuite, void * aContext) +{ + MockMatterNodeStateMonitor test_matter_node_state_monitor; + MockUicMqttPublish mqtt_publish_test; + OnOffClusterCommandHandler on_cmd_handler(test_matter_node_state_monitor, mqtt_publish_test); + + chip::EndpointId endpoint = 2; + chip::app::ConcreteCommandPath test_command_path = + chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OnOff::Id, chip::app::Clusters::OnOff::Commands::On::Id); + MockCommandHandlerCallback mockCommandHandlerDelegate; + chip::app::CommandHandler test_commandHandler(&mockCommandHandlerDelegate); + chip::TLV::TLVReader test_tlv_reader; + chip::app::CommandHandlerInterface::HandlerContext ctxt = + chip::app::CommandHandlerInterface::HandlerContext(test_commandHandler, test_command_path, test_tlv_reader); + + on_cmd_handler.InvokeCommand(ctxt); + + NL_TEST_ASSERT(inSuite, test_matter_node_state_monitor.nNumBridgedMethodCall == 2); + NL_TEST_ASSERT(inSuite, mqtt_publish_test.nNumerUicMqttPublishCall == 1); + NL_TEST_ASSERT(inSuite, mqtt_publish_test.publish_topic == "ucl/by-unid/zw-0x0002/ep4/OnOff/Commands/On" ); + +} + +class TestContext +{ +public: + nlTestSuite * mTestSuite; +}; + +static const nlTest sTests[] = { NL_TEST_DEF("TestOnOffClusterCommandHandler", TestOnOffClusterCommandHandler), + NL_TEST_SENTINEL() }; + +static nlTestSuite TheCommandSuite = { "TestOnOffCommandsHandler", &sTests[0], nullptr, nullptr }; + +int TestOnOffCommandsHandler(void) +{ + return (chip::ExecuteTestsWithContext(&TheCommandSuite)); +} + +CHIP_REGISTER_TEST_SUITE(TestOnOffCommandsHandler) \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/src/uic_mqtt_wrapper.cpp b/silabs_examples/unify-matter-bridge/linux/src/uic_mqtt_wrapper.cpp new file mode 100644 index 00000000000000..9832a10dbf58ae --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/src/uic_mqtt_wrapper.cpp @@ -0,0 +1,21 @@ +/****************************************************************************** + * # 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 "uic_mqtt.h" +#include "uic_mqtt_wrapper.hpp" + +using namespace unify::matter_bridge; + +void UicMqtt::Publish(std::string topic, std::string message, bool retain) +{ + uic_mqtt_publish(topic.c_str(), message.c_str(), message.size(), retain); +} \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/attribute_translator.cpp.zapt b/silabs_examples/unify-matter-bridge/linux/zap-handlers/attribute_translator.cpp.zapt new file mode 100644 index 00000000000000..572b69b8d0fb72 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/attribute_translator.cpp.zapt @@ -0,0 +1,184 @@ +/****************************************************************************** + * # 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. + * + *****************************************************************************/ + +#define CHIP_USE_ENUM_CLASS_FOR_IM_ENUM + +#include +#include +#include +#include +#include "matter.h" + +#include +#include "attribute_translator.hpp" +#include "matter_device_translator.hpp" +#include "uic_mqtt.h" +#include "sl_log.h" +#include "app-common/zap-generated/attributes/Accessors.h" +#define LOG_TAG "attribute_translator" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace unify::matter_bridge; + +#include "chip_types_to_json.hpp" +#include "chip_types_from_json.hpp" +#include "unify_accessors.hpp" + +{{#zcl_clusters}} +CHIP_ERROR +{{asUpperCamelCase label}}AttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::{{asUpperCamelCase label}}::Attributes; + namespace UN = unify::matter_bridge::{{asUpperCamelCase label}}::Attributes; + if (aPath.mClusterId != Clusters::{{asUpperCamelCase label}}::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + {{#zcl_attributes_server}} + + {{#if_is_struct type}} + {{else if (canHaveSimpleAccessors this)}} + case MN::{{asUpperCamelCase label}}::Id: { // type is {{type}} + MN::{{asUpperCamelCase label}}::TypeInfo::Type value; + UN::{{asUpperCamelCase label}}::Get(atrpath, value ); + return aEncoder.Encode(value); + } + {{/if_is_struct}} + {{/zcl_attributes_server}} + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR {{asUpperCamelCase label}}AttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::{{asUpperCamelCase label}}; + + if (aPath.mClusterId != Clusters::{{asUpperCamelCase label}}::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) { + {{#zcl_attributes_server}} + {{#if writable}} + + case Attributes::{{asUpperCamelCase label}}::Id: { + + Attributes::{{asUpperCamelCase label}}::TypeInfo::DecodableType value; + aDecoder.Decode(value); + jsn["value"] = to_json(value); + attribute_name = std::string("{{asUpperCamelCase label}}"); + break; + } + {{/if}} + {{/zcl_attributes_server}} + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/{{asUpperCamelCase label}}/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void {{asUpperCamelCase label}}AttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::{{asUpperCamelCase label}}::Attributes; + namespace UN = unify::matter_bridge::{{asUpperCamelCase label}}::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::{{asUpperCamelCase label}}::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::{{asUpperCamelCase label}}::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + {{#zcl_attributes_server}} + {{#if_is_struct type}} + {{else if (canHaveSimpleAccessors this)}} + // type is {{type}} + case MN::{{asUpperCamelCase label}}::Id: { + using T = MN::{{asUpperCamelCase label}}::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"{{asUpperCamelCase label}} attribute value is %s",unify_value.dump().c_str() ); + UN::{{asUpperCamelCase label}}::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::{{asUpperCamelCase parent.label}}::Id, + MN::{{asUpperCamelCase label}}::Id, + ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + {{/if_is_struct}} + {{/zcl_attributes_server}} + } +} + +{{/zcl_clusters}} diff --git a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.hpp b/silabs_examples/unify-matter-bridge/linux/zap-handlers/attribute_translator.hpp.zapt similarity index 80% rename from silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.hpp rename to silabs_examples/unify-matter-bridge/linux/zap-handlers/attribute_translator.hpp.zapt index 20ba777ccc4517..5a6c110dd975bb 100644 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/on_off_attribute_translator.hpp +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/attribute_translator.hpp.zapt @@ -24,12 +24,14 @@ namespace unify::matter_bridge { -class OnOffAttributeAccess : public attribute_translator_interface +{{#zcl_clusters}} + +class {{asUpperCamelCase label}}AttributeAccess : public attribute_translator_interface { public: - OnOffAttributeAccess(matter_node_state_monitor &node_state_monitor) : + {{asUpperCamelCase label}}AttributeAccess(matter_node_state_monitor &node_state_monitor) : attribute_translator_interface(node_state_monitor, - chip::app::Clusters::OnOff::Id) + chip::app::Clusters::{{asUpperCamelCase label}}::Id) {} CHIP_ERROR Read(const chip::app::ConcreteReadAttributePath &aPath, @@ -38,16 +40,13 @@ class OnOffAttributeAccess : public attribute_translator_interface 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" });} + std::vector unify_cluster_names() const override {return std::vector({ "{{asUpperCamelCase label}}" });} }; +{{/zcl_clusters}} } // namespace unify::matter_bridge \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/bridge-templates.json b/silabs_examples/unify-matter-bridge/linux/zap-handlers/bridge-templates.json new file mode 100644 index 00000000000000..6f5fc7fd8ed9ff --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/bridge-templates.json @@ -0,0 +1,57 @@ +{ + "name": "CHIP Application templates", + "version": "chip-v1", + "helpers": [ + "partials/helper.js", + "common/ListHelper.js", + "common/StringHelper.js", + "common/ChipTypesHelper.js", + "common/attributes/Accessors.js", + "templates/app/helper.js", + "templates/chip/helper.js", + "unify-helper.js" + ], + "override": "../../../../src/app/zap-templates/common/override.js", + "templates": [ + { + "path": "command_translator.cpp.zapt", + "name": "Command Handler Implementation", + "output": "command_translator.cpp" + }, + { + "path": "command_translator.hpp.zapt", + "name": "Command Handler Header", + "output": "command_translator.hpp" + }, + { + "path": "chip_types_to_json.hpp.zapt", + "name": "Type converters", + "output": "chip_types_to_json.hpp" + }, + { + "path": "chip_types_from_json.hpp.zapt", + "name": "Type converters", + "output": "chip_types_from_json.hpp" + }, + { + "path": "attribute_translator.cpp.zapt", + "name": "Attribute Translator Implementation", + "output": "attribute_translator.cpp" + }, + { + "path": "attribute_translator.hpp.zapt", + "name": "Attribute Translator Header", + "output": "attribute_translator.hpp" + }, + { + "path": "unify_accessors.hpp.zapt", + "name": "Attribute Accessor Header", + "output": "unify_accessors.hpp" + }, + { + "path": "unify_accessors.cpp.zapt", + "name": "Attribute Accessor Source", + "output": "unify_accessors.cpp" + } + ] +} diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/chip_types_from_json.hpp.zapt b/silabs_examples/unify-matter-bridge/linux/zap-handlers/chip_types_from_json.hpp.zapt new file mode 100644 index 00000000000000..15ad304d7351cc --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/chip_types_from_json.hpp.zapt @@ -0,0 +1,81 @@ +/******************************************************************************* + * # 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. + * + ******************************************************************************/ + + +// Default translation +template +std::optional from_json(const nlohmann::json & value) +{ + return std::nullopt; +} + +/***************************** Simple types Convertes **************/ + +template<> inline +std::optional from_json(const nlohmann::json & value) +{ + return value; +} + +template<> inline +std::optional from_json(const nlohmann::json & value) +{ + return value; +} + +template<> inline +std::optional from_json(const nlohmann::json & value) +{ + return value; +} + + +/***************************** Bitmap Convertes **************/ +//{{#zcl_clusters}} +//{{#zcl_bitmaps}} +//template<> inline nlohmann::json to_json(const chip::BitFlags<{{asUpperCamelCase parent.label}}::{{label}}, uint8_t>& value) { +// return "{\"no bitmap support\"}"; +//} + +{{/zcl_bitmaps}} + +/***************************** Struct Convertes **************/ +//{{#zcl_structs}} +//template<> inline nlohmann::json to_json(const {{asUpperCamelCase parent.label}}::Structs::{{name}}::Type& value) { +// return "no struct support"; +//} +// +//{{/zcl_structs}} + +{{#zcl_enums}} + +template<> inline std::optional<{{asUpperCamelCase parent.label}}::{{label}}> from_json(const nlohmann::json& value) { + const std::map< std::string, {{asUpperCamelCase parent.label}}::{{label}}> + table = { + {{#zcl_enum_items}} + { "{{asUpperCamelCase label}}" , {{asUpperCamelCase parent.parent.label}}::{{parent.label}}::k{{asUpperCamelCase label}} }, + {{/zcl_enum_items}} + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + +{{/zcl_enums}} + +{{/zcl_clusters}} diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/chip_types_to_json.hpp.zapt b/silabs_examples/unify-matter-bridge/linux/zap-handlers/chip_types_to_json.hpp.zapt new file mode 100644 index 00000000000000..2ce920ff1edbda --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/chip_types_to_json.hpp.zapt @@ -0,0 +1,99 @@ +/******************************************************************************* + * # 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. + * + ******************************************************************************/ + + +// Default translation +#include + +template +nlohmann::json inline to_json(const T & value) +{ + return __FUNCTION__; +} + +/***************************** Simple types Convertes **************/ + +template<> +nlohmann::json inline to_json(const bool & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const int & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const int16_t & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const std::string & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const uint8_t & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const uint16_t & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const uint32_t & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const uint64_t & value) +{ + return value; +} + +/***************************** Bitmap Convertes **************/ +{{#zcl_clusters}} +{{#if (supportedCluster label)}} + +/***************************** Bitmap Converter FIXME**************/ +//{{#zcl_bitmaps}} +//template<> nlohmann::json to_json(const chip::BitFlags<{{asUpperCamelCase parent.label}}::{{label}}, uint8_t>& value) { +// return "{\"no bitmap support\"}"; +//} +//{{/zcl_bitmaps}} + +/***************************** Struct Converted FIXME**************/ +//{{#zcl_structs}} +//template<> nlohmann::json inline to_json(const {{asUpperCamelCase parent.label}}::Structs::{{name}}::Type& value) { +// return "no struct support"; +//} +//{{/zcl_structs}} + +{{#zcl_enums}} +template<> nlohmann::json inline to_json(const chip::app::Clusters::{{asUpperCamelCase parent.label}}::{{label}}& value) { + switch( value ) { + {{#zcl_enum_items}} + case chip::app::Clusters::{{asUpperCamelCase parent.parent.label}}::{{parent.label}}::k{{asUpperCamelCase label}}: return "{{asUpperCamelCase label}}"; + {{/zcl_enum_items}} + default: return "{}"; + } +} + +{{/zcl_enums}} + +{{/if}} +{{/zcl_clusters}} diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/command_translator.cpp.zapt b/silabs_examples/unify-matter-bridge/linux/zap-handlers/command_translator.cpp.zapt new file mode 100644 index 00000000000000..450488f576d332 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/command_translator.cpp.zapt @@ -0,0 +1,89 @@ +/******************************************************************************* + * # 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. + * + ******************************************************************************/ + #define CHIP_USE_ENUM_CLASS_FOR_IM_ENUM + +#include "command_translator.hpp" +#include +#include +#include +#include "sl_log.h" +#include "chip_types_to_json.hpp" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace unify::matter_bridge; + +#define LOG_TAG "matter_cluster_command_server" + +{{#zcl_clusters}} +{{#if (supportedCluster label)}} + +void {{asUpperCamelCase label}}ClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::{{asUpperCamelCase label}}; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + {{#zcl_commands_source_client}} + case Commands::{{asUpperCamelCase label}}::Id: + { + cmd = "{{asUpperCamelCase label}}"; + {{#zcl_command_arguments}} + { + Commands::{{asUpperCamelCase parent.label}}::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + {{#isOptional}} + if( data.{{asLowerCamelCase label}}.HasValue() ) { + try { + payload["{{asUpperCamelCase label}}"] = to_json(data.{{asLowerCamelCase label}}.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + {{else}} + try { + payload["{{asUpperCamelCase label}}"] = to_json(data.{{asLowerCamelCase label}}); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + {{/isOptional}} + } + } + {{/zcl_command_arguments}} + } + break; + {{/zcl_commands_source_client}} + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} +{{/if}} +{{/zcl_clusters}} \ 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/zap-handlers/command_translator.hpp.zapt similarity index 57% rename from silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_command_translator.hpp rename to silabs_examples/unify-matter-bridge/linux/zap-handlers/command_translator.hpp.zapt index 138e5794b677ac..8cdce7b8f0885c 100644 --- a/silabs_examples/unify-matter-bridge/linux/src/cluster_translator/identify_command_translator.hpp +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/command_translator.hpp.zapt @@ -12,35 +12,41 @@ *****************************************************************************/ /** - * @defgroup identify_command_translator - * @brief Identify cluster command translator for matter interface + * @defgroup command_translator + * @brief cluster command translator for matter interface * - * Translate Identify cluster commands from the matter protocol to unify + * Translate cluster commands from the matter protocol to unify * dotdot data model. * * @{ */ -#ifndef IDENTIFY_COMMAND_TRANSLATOR_HPP -#define IDENTIFY_COMMAND_TRANSLATOR_HPP +#ifndef COMMAND_TRANSLATOR_HPP +#define COMMAND_TRANSLATOR_HPP #pragma once #include "command_translator_interface.hpp" namespace unify::matter_bridge { -class IdentifyClusterCommandHandler : public command_translator_interface + +{{#zcl_clusters}} +{{#if (supportedCluster label)}} +class {{asUpperCamelCase label}}ClusterCommandHandler : public command_translator_interface { public: - IdentifyClusterCommandHandler( - const matter_node_state_monitor &node_state_monitor) : + {{asUpperCamelCase label}}ClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : command_translator_interface(node_state_monitor, - chip::app::Clusters::Identify::Id,"Identify") + chip::app::Clusters::{{asUpperCamelCase label}}::Id,"{{asUpperCamelCase label}}", uic_mqtt) {} void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext - &HandlerContext) override; + &HandlerContext) override; }; +{{/if}} +{{/zcl_clusters}} + } // namespace unify::matter_bridge -#endif //IDENTIFY_COMMAND_TRANSLATOR_HPP -/** @} end identify_command_translator */ +#endif //COMMAND_TRANSLATOR_HPP +/** @} end command_translator */ diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/attribute_translator.cpp b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/attribute_translator.cpp new file mode 100644 index 00000000000000..a95a0cb1f276b9 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/attribute_translator.cpp @@ -0,0 +1,26933 @@ +/****************************************************************************** + * # 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. + * + *****************************************************************************/ + +#define CHIP_USE_ENUM_CLASS_FOR_IM_ENUM + +#include +#include +#include +#include +#include "matter.h" + +#include +#include "attribute_translator.hpp" +#include "matter_device_translator.hpp" +#include "uic_mqtt.h" +#include "sl_log.h" +#include "app-common/zap-generated/attributes/Accessors.h" +#define LOG_TAG "attribute_translator" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace unify::matter_bridge; + +#include "chip_types_to_json.hpp" +#include "chip_types_from_json.hpp" +#include "unify_accessors.hpp" + +CHIP_ERROR +IdentifyAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::Identify::Attributes; + namespace UN = unify::matter_bridge::Identify::Attributes; + if (aPath.mClusterId != Clusters::Identify::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::IdentifyTime::Id: { // type is int16u + MN::IdentifyTime::TypeInfo::Type value; + UN::IdentifyTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::IdentifyType::Id: { // type is enum8 + MN::IdentifyType::TypeInfo::Type value; + UN::IdentifyType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR IdentifyAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::Identify; + + 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; + } + + std::string attribute_name; + nlohmann::json jsn; + + switch (aPath.mAttributeId) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/Identify/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void IdentifyAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::Identify::Attributes; + namespace UN = unify::matter_bridge::Identify::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::Identify::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::Identify::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16u + case MN::IdentifyTime::Id: { + using T = MN::IdentifyTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"IdentifyTime attribute value is %s",unify_value.dump().c_str() ); + UN::IdentifyTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Identify::Id, + MN::IdentifyTime::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::IdentifyType::Id: { + using T = MN::IdentifyType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"IdentifyType attribute value is %s",unify_value.dump().c_str() ); + UN::IdentifyType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Identify::Id, + MN::IdentifyType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Identify::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Identify::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +GroupsAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::Groups::Attributes; + namespace UN = unify::matter_bridge::Groups::Attributes; + if (aPath.mClusterId != Clusters::Groups::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::NameSupport::Id: { // type is bitmap8 + MN::NameSupport::TypeInfo::Type value; + UN::NameSupport::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR GroupsAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::Groups; + + if (aPath.mClusterId != Clusters::Groups::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/Groups/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void GroupsAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::Groups::Attributes; + namespace UN = unify::matter_bridge::Groups::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::Groups::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::Groups::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap8 + case MN::NameSupport::Id: { + using T = MN::NameSupport::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NameSupport attribute value is %s",unify_value.dump().c_str() ); + UN::NameSupport::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Groups::Id, + MN::NameSupport::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Groups::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Groups::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ScenesAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::Scenes::Attributes; + namespace UN = unify::matter_bridge::Scenes::Attributes; + if (aPath.mClusterId != Clusters::Scenes::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::SceneCount::Id: { // type is int8u + MN::SceneCount::TypeInfo::Type value; + UN::SceneCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentScene::Id: { // type is int8u + MN::CurrentScene::TypeInfo::Type value; + UN::CurrentScene::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentGroup::Id: { // type is group_id + MN::CurrentGroup::TypeInfo::Type value; + UN::CurrentGroup::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SceneValid::Id: { // type is boolean + MN::SceneValid::TypeInfo::Type value; + UN::SceneValid::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NameSupport::Id: { // type is bitmap8 + MN::NameSupport::TypeInfo::Type value; + UN::NameSupport::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LastConfiguredBy::Id: { // type is node_id + MN::LastConfiguredBy::TypeInfo::Type value; + UN::LastConfiguredBy::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ScenesAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::Scenes; + + if (aPath.mClusterId != Clusters::Scenes::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/Scenes/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ScenesAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::Scenes::Attributes; + namespace UN = unify::matter_bridge::Scenes::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::Scenes::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::Scenes::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int8u + case MN::SceneCount::Id: { + using T = MN::SceneCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SceneCount attribute value is %s",unify_value.dump().c_str() ); + UN::SceneCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Scenes::Id, + MN::SceneCount::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::CurrentScene::Id: { + using T = MN::CurrentScene::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentScene attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentScene::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Scenes::Id, + MN::CurrentScene::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is group_id + case MN::CurrentGroup::Id: { + using T = MN::CurrentGroup::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentGroup attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentGroup::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Scenes::Id, + MN::CurrentGroup::Id, + ZCL_GROUP_ID_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::SceneValid::Id: { + using T = MN::SceneValid::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SceneValid attribute value is %s",unify_value.dump().c_str() ); + UN::SceneValid::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Scenes::Id, + MN::SceneValid::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::NameSupport::Id: { + using T = MN::NameSupport::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NameSupport attribute value is %s",unify_value.dump().c_str() ); + UN::NameSupport::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Scenes::Id, + MN::NameSupport::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is node_id + case MN::LastConfiguredBy::Id: { + using T = MN::LastConfiguredBy::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LastConfiguredBy attribute value is %s",unify_value.dump().c_str() ); + UN::LastConfiguredBy::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Scenes::Id, + MN::LastConfiguredBy::Id, + ZCL_NODE_ID_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Scenes::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Scenes::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +OnOffAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::OnOff::Attributes; + namespace UN = unify::matter_bridge::OnOff::Attributes; + if (aPath.mClusterId != Clusters::OnOff::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::OnOff::Id: { // type is boolean + MN::OnOff::TypeInfo::Type value; + UN::OnOff::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::GlobalSceneControl::Id: { // type is boolean + MN::GlobalSceneControl::TypeInfo::Type value; + UN::GlobalSceneControl::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OnTime::Id: { // type is int16u + MN::OnTime::TypeInfo::Type value; + UN::OnTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OffWaitTime::Id: { // type is int16u + MN::OffWaitTime::TypeInfo::Type value; + UN::OffWaitTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::StartUpOnOff::Id: { // type is OnOffStartUpOnOff + MN::StartUpOnOff::TypeInfo::Type value; + UN::StartUpOnOff::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR OnOffAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::OnOff; + + 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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string 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(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void OnOffAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::OnOff::Attributes; + namespace UN = unify::matter_bridge::OnOff::Attributes; + + 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()) { + // type is boolean + case MN::OnOff::Id: { + using T = MN::OnOff::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OnOff attribute value is %s",unify_value.dump().c_str() ); + UN::OnOff::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + MN::OnOff::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::GlobalSceneControl::Id: { + using T = MN::GlobalSceneControl::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"GlobalSceneControl attribute value is %s",unify_value.dump().c_str() ); + UN::GlobalSceneControl::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + MN::GlobalSceneControl::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::OnTime::Id: { + using T = MN::OnTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OnTime attribute value is %s",unify_value.dump().c_str() ); + UN::OnTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + MN::OnTime::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::OffWaitTime::Id: { + using T = MN::OffWaitTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OffWaitTime attribute value is %s",unify_value.dump().c_str() ); + UN::OffWaitTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + MN::OffWaitTime::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is OnOffStartUpOnOff + case MN::StartUpOnOff::Id: { + using T = MN::StartUpOnOff::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"StartUpOnOff attribute value is %s",unify_value.dump().c_str() ); + UN::StartUpOnOff::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + MN::StartUpOnOff::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOff::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +OnOffSwitchConfigurationAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::OnOffSwitchConfiguration::Attributes; + namespace UN = unify::matter_bridge::OnOffSwitchConfiguration::Attributes; + if (aPath.mClusterId != Clusters::OnOffSwitchConfiguration::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::SwitchType::Id: { // type is enum8 + MN::SwitchType::TypeInfo::Type value; + UN::SwitchType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SwitchActions::Id: { // type is enum8 + MN::SwitchActions::TypeInfo::Type value; + UN::SwitchActions::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR OnOffSwitchConfigurationAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::OnOffSwitchConfiguration; + + if (aPath.mClusterId != Clusters::OnOffSwitchConfiguration::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/OnOffSwitchConfiguration/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void OnOffSwitchConfigurationAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::OnOffSwitchConfiguration::Attributes; + namespace UN = unify::matter_bridge::OnOffSwitchConfiguration::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::OnOffSwitchConfiguration::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::OnOffSwitchConfiguration::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is enum8 + case MN::SwitchType::Id: { + using T = MN::SwitchType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SwitchType attribute value is %s",unify_value.dump().c_str() ); + UN::SwitchType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOffSwitchConfiguration::Id, + MN::SwitchType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::SwitchActions::Id: { + using T = MN::SwitchActions::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SwitchActions attribute value is %s",unify_value.dump().c_str() ); + UN::SwitchActions::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOffSwitchConfiguration::Id, + MN::SwitchActions::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOffSwitchConfiguration::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OnOffSwitchConfiguration::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +LevelControlAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::LevelControl::Attributes; + namespace UN = unify::matter_bridge::LevelControl::Attributes; + if (aPath.mClusterId != Clusters::LevelControl::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::CurrentLevel::Id: { // type is int8u + MN::CurrentLevel::TypeInfo::Type value; + UN::CurrentLevel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RemainingTime::Id: { // type is int16u + MN::RemainingTime::TypeInfo::Type value; + UN::RemainingTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinLevel::Id: { // type is int8u + MN::MinLevel::TypeInfo::Type value; + UN::MinLevel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxLevel::Id: { // type is int8u + MN::MaxLevel::TypeInfo::Type value; + UN::MaxLevel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentFrequency::Id: { // type is int16u + MN::CurrentFrequency::TypeInfo::Type value; + UN::CurrentFrequency::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinFrequency::Id: { // type is int16u + MN::MinFrequency::TypeInfo::Type value; + UN::MinFrequency::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxFrequency::Id: { // type is int16u + MN::MaxFrequency::TypeInfo::Type value; + UN::MaxFrequency::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Options::Id: { // type is bitmap8 + MN::Options::TypeInfo::Type value; + UN::Options::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OnOffTransitionTime::Id: { // type is int16u + MN::OnOffTransitionTime::TypeInfo::Type value; + UN::OnOffTransitionTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OnLevel::Id: { // type is int8u + MN::OnLevel::TypeInfo::Type value; + UN::OnLevel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OnTransitionTime::Id: { // type is int16u + MN::OnTransitionTime::TypeInfo::Type value; + UN::OnTransitionTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OffTransitionTime::Id: { // type is int16u + MN::OffTransitionTime::TypeInfo::Type value; + UN::OffTransitionTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DefaultMoveRate::Id: { // type is int8u + MN::DefaultMoveRate::TypeInfo::Type value; + UN::DefaultMoveRate::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::StartUpCurrentLevel::Id: { // type is int8u + MN::StartUpCurrentLevel::TypeInfo::Type value; + UN::StartUpCurrentLevel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR LevelControlAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::LevelControl; + + 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 jsn; + + switch (aPath.mAttributeId) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/LevelControl/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void LevelControlAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::LevelControl::Attributes; + namespace UN = unify::matter_bridge::LevelControl::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::LevelControl::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::LevelControl::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int8u + case MN::CurrentLevel::Id: { + using T = MN::CurrentLevel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentLevel attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentLevel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::CurrentLevel::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RemainingTime::Id: { + using T = MN::RemainingTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RemainingTime attribute value is %s",unify_value.dump().c_str() ); + UN::RemainingTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::RemainingTime::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::MinLevel::Id: { + using T = MN::MinLevel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinLevel attribute value is %s",unify_value.dump().c_str() ); + UN::MinLevel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::MinLevel::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::MaxLevel::Id: { + using T = MN::MaxLevel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxLevel attribute value is %s",unify_value.dump().c_str() ); + UN::MaxLevel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::MaxLevel::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::CurrentFrequency::Id: { + using T = MN::CurrentFrequency::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentFrequency attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentFrequency::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::CurrentFrequency::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MinFrequency::Id: { + using T = MN::MinFrequency::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinFrequency attribute value is %s",unify_value.dump().c_str() ); + UN::MinFrequency::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::MinFrequency::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MaxFrequency::Id: { + using T = MN::MaxFrequency::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxFrequency attribute value is %s",unify_value.dump().c_str() ); + UN::MaxFrequency::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::MaxFrequency::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::Options::Id: { + using T = MN::Options::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Options attribute value is %s",unify_value.dump().c_str() ); + UN::Options::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::Options::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::OnOffTransitionTime::Id: { + using T = MN::OnOffTransitionTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OnOffTransitionTime attribute value is %s",unify_value.dump().c_str() ); + UN::OnOffTransitionTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::OnOffTransitionTime::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::OnLevel::Id: { + using T = MN::OnLevel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OnLevel attribute value is %s",unify_value.dump().c_str() ); + UN::OnLevel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::OnLevel::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::OnTransitionTime::Id: { + using T = MN::OnTransitionTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OnTransitionTime attribute value is %s",unify_value.dump().c_str() ); + UN::OnTransitionTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::OnTransitionTime::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::OffTransitionTime::Id: { + using T = MN::OffTransitionTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OffTransitionTime attribute value is %s",unify_value.dump().c_str() ); + UN::OffTransitionTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::OffTransitionTime::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::DefaultMoveRate::Id: { + using T = MN::DefaultMoveRate::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DefaultMoveRate attribute value is %s",unify_value.dump().c_str() ); + UN::DefaultMoveRate::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::DefaultMoveRate::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::StartUpCurrentLevel::Id: { + using T = MN::StartUpCurrentLevel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"StartUpCurrentLevel attribute value is %s",unify_value.dump().c_str() ); + UN::StartUpCurrentLevel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::StartUpCurrentLevel::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LevelControl::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +BinaryInputBasicAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::BinaryInputBasic::Attributes; + namespace UN = unify::matter_bridge::BinaryInputBasic::Attributes; + if (aPath.mClusterId != Clusters::BinaryInputBasic::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::ActiveText::Id: { // type is char_string + MN::ActiveText::TypeInfo::Type value; + UN::ActiveText::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Description::Id: { // type is char_string + MN::Description::TypeInfo::Type value; + UN::Description::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::InactiveText::Id: { // type is char_string + MN::InactiveText::TypeInfo::Type value; + UN::InactiveText::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OutOfService::Id: { // type is boolean + MN::OutOfService::TypeInfo::Type value; + UN::OutOfService::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Polarity::Id: { // type is enum8 + MN::Polarity::TypeInfo::Type value; + UN::Polarity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PresentValue::Id: { // type is boolean + MN::PresentValue::TypeInfo::Type value; + UN::PresentValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Reliability::Id: { // type is enum8 + MN::Reliability::TypeInfo::Type value; + UN::Reliability::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::StatusFlags::Id: { // type is bitmap8 + MN::StatusFlags::TypeInfo::Type value; + UN::StatusFlags::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ApplicationType::Id: { // type is int32u + MN::ApplicationType::TypeInfo::Type value; + UN::ApplicationType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR BinaryInputBasicAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::BinaryInputBasic; + + if (aPath.mClusterId != Clusters::BinaryInputBasic::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/BinaryInputBasic/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void BinaryInputBasicAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::BinaryInputBasic::Attributes; + namespace UN = unify::matter_bridge::BinaryInputBasic::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::BinaryInputBasic::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::BinaryInputBasic::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is char_string + case MN::ActiveText::Id: { + using T = MN::ActiveText::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActiveText attribute value is %s",unify_value.dump().c_str() ); + UN::ActiveText::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BinaryInputBasic::Id, + MN::ActiveText::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::Description::Id: { + using T = MN::Description::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Description attribute value is %s",unify_value.dump().c_str() ); + UN::Description::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BinaryInputBasic::Id, + MN::Description::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::InactiveText::Id: { + using T = MN::InactiveText::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"InactiveText attribute value is %s",unify_value.dump().c_str() ); + UN::InactiveText::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BinaryInputBasic::Id, + MN::InactiveText::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::OutOfService::Id: { + using T = MN::OutOfService::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OutOfService attribute value is %s",unify_value.dump().c_str() ); + UN::OutOfService::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BinaryInputBasic::Id, + MN::OutOfService::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::Polarity::Id: { + using T = MN::Polarity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Polarity attribute value is %s",unify_value.dump().c_str() ); + UN::Polarity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BinaryInputBasic::Id, + MN::Polarity::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::PresentValue::Id: { + using T = MN::PresentValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PresentValue attribute value is %s",unify_value.dump().c_str() ); + UN::PresentValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BinaryInputBasic::Id, + MN::PresentValue::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::Reliability::Id: { + using T = MN::Reliability::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Reliability attribute value is %s",unify_value.dump().c_str() ); + UN::Reliability::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BinaryInputBasic::Id, + MN::Reliability::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::StatusFlags::Id: { + using T = MN::StatusFlags::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"StatusFlags attribute value is %s",unify_value.dump().c_str() ); + UN::StatusFlags::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BinaryInputBasic::Id, + MN::StatusFlags::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::ApplicationType::Id: { + using T = MN::ApplicationType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ApplicationType attribute value is %s",unify_value.dump().c_str() ); + UN::ApplicationType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BinaryInputBasic::Id, + MN::ApplicationType::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BinaryInputBasic::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BinaryInputBasic::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +PulseWidthModulationAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::PulseWidthModulation::Attributes; + namespace UN = unify::matter_bridge::PulseWidthModulation::Attributes; + if (aPath.mClusterId != Clusters::PulseWidthModulation::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR PulseWidthModulationAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::PulseWidthModulation; + + if (aPath.mClusterId != Clusters::PulseWidthModulation::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/PulseWidthModulation/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void PulseWidthModulationAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::PulseWidthModulation::Attributes; + namespace UN = unify::matter_bridge::PulseWidthModulation::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::PulseWidthModulation::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::PulseWidthModulation::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PulseWidthModulation::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PulseWidthModulation::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +DescriptorAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::Descriptor::Attributes; + namespace UN = unify::matter_bridge::Descriptor::Attributes; + if (aPath.mClusterId != Clusters::Descriptor::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR DescriptorAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::Descriptor; + + if (aPath.mClusterId != Clusters::Descriptor::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/Descriptor/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void DescriptorAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::Descriptor::Attributes; + namespace UN = unify::matter_bridge::Descriptor::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::Descriptor::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::Descriptor::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Descriptor::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Descriptor::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +BindingAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::Binding::Attributes; + namespace UN = unify::matter_bridge::Binding::Attributes; + if (aPath.mClusterId != Clusters::Binding::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR BindingAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::Binding; + + if (aPath.mClusterId != Clusters::Binding::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/Binding/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void BindingAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::Binding::Attributes; + namespace UN = unify::matter_bridge::Binding::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::Binding::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::Binding::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Binding::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Binding::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +AccessControlAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::AccessControl::Attributes; + namespace UN = unify::matter_bridge::AccessControl::Attributes; + if (aPath.mClusterId != Clusters::AccessControl::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + case MN::SubjectsPerAccessControlEntry::Id: { // type is int16u + MN::SubjectsPerAccessControlEntry::TypeInfo::Type value; + UN::SubjectsPerAccessControlEntry::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TargetsPerAccessControlEntry::Id: { // type is int16u + MN::TargetsPerAccessControlEntry::TypeInfo::Type value; + UN::TargetsPerAccessControlEntry::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AccessControlEntriesPerFabric::Id: { // type is int16u + MN::AccessControlEntriesPerFabric::TypeInfo::Type value; + UN::AccessControlEntriesPerFabric::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR AccessControlAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::AccessControl; + + if (aPath.mClusterId != Clusters::AccessControl::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/AccessControl/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void AccessControlAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::AccessControl::Attributes; + namespace UN = unify::matter_bridge::AccessControl::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::AccessControl::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::AccessControl::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16u + case MN::SubjectsPerAccessControlEntry::Id: { + using T = MN::SubjectsPerAccessControlEntry::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SubjectsPerAccessControlEntry attribute value is %s",unify_value.dump().c_str() ); + UN::SubjectsPerAccessControlEntry::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AccessControl::Id, + MN::SubjectsPerAccessControlEntry::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::TargetsPerAccessControlEntry::Id: { + using T = MN::TargetsPerAccessControlEntry::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TargetsPerAccessControlEntry attribute value is %s",unify_value.dump().c_str() ); + UN::TargetsPerAccessControlEntry::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AccessControl::Id, + MN::TargetsPerAccessControlEntry::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AccessControlEntriesPerFabric::Id: { + using T = MN::AccessControlEntriesPerFabric::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AccessControlEntriesPerFabric attribute value is %s",unify_value.dump().c_str() ); + UN::AccessControlEntriesPerFabric::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AccessControl::Id, + MN::AccessControlEntriesPerFabric::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AccessControl::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AccessControl::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ActionsAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::Actions::Attributes; + namespace UN = unify::matter_bridge::Actions::Attributes; + if (aPath.mClusterId != Clusters::Actions::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + case MN::SetupURL::Id: { // type is long_char_string + MN::SetupURL::TypeInfo::Type value; + UN::SetupURL::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ActionsAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::Actions; + + if (aPath.mClusterId != Clusters::Actions::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/Actions/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ActionsAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::Actions::Attributes; + namespace UN = unify::matter_bridge::Actions::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::Actions::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::Actions::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is long_char_string + case MN::SetupURL::Id: { + using T = MN::SetupURL::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SetupURL attribute value is %s",unify_value.dump().c_str() ); + UN::SetupURL::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Actions::Id, + MN::SetupURL::Id, + ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Actions::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Actions::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +BasicAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::Basic::Attributes; + namespace UN = unify::matter_bridge::Basic::Attributes; + if (aPath.mClusterId != Clusters::Basic::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::DataModelRevision::Id: { // type is int16u + MN::DataModelRevision::TypeInfo::Type value; + UN::DataModelRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::VendorName::Id: { // type is char_string + MN::VendorName::TypeInfo::Type value; + UN::VendorName::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::VendorID::Id: { // type is vendor_id + MN::VendorID::TypeInfo::Type value; + UN::VendorID::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ProductName::Id: { // type is char_string + MN::ProductName::TypeInfo::Type value; + UN::ProductName::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ProductID::Id: { // type is int16u + MN::ProductID::TypeInfo::Type value; + UN::ProductID::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NodeLabel::Id: { // type is char_string + MN::NodeLabel::TypeInfo::Type value; + UN::NodeLabel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Location::Id: { // type is char_string + MN::Location::TypeInfo::Type value; + UN::Location::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::HardwareVersion::Id: { // type is int16u + MN::HardwareVersion::TypeInfo::Type value; + UN::HardwareVersion::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::HardwareVersionString::Id: { // type is char_string + MN::HardwareVersionString::TypeInfo::Type value; + UN::HardwareVersionString::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SoftwareVersion::Id: { // type is int32u + MN::SoftwareVersion::TypeInfo::Type value; + UN::SoftwareVersion::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SoftwareVersionString::Id: { // type is char_string + MN::SoftwareVersionString::TypeInfo::Type value; + UN::SoftwareVersionString::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ManufacturingDate::Id: { // type is char_string + MN::ManufacturingDate::TypeInfo::Type value; + UN::ManufacturingDate::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PartNumber::Id: { // type is char_string + MN::PartNumber::TypeInfo::Type value; + UN::PartNumber::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ProductURL::Id: { // type is long_char_string + MN::ProductURL::TypeInfo::Type value; + UN::ProductURL::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ProductLabel::Id: { // type is char_string + MN::ProductLabel::TypeInfo::Type value; + UN::ProductLabel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SerialNumber::Id: { // type is char_string + MN::SerialNumber::TypeInfo::Type value; + UN::SerialNumber::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LocalConfigDisabled::Id: { // type is boolean + MN::LocalConfigDisabled::TypeInfo::Type value; + UN::LocalConfigDisabled::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Reachable::Id: { // type is boolean + MN::Reachable::TypeInfo::Type value; + UN::Reachable::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UniqueID::Id: { // type is char_string + MN::UniqueID::TypeInfo::Type value; + UN::UniqueID::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR BasicAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::Basic; + + if (aPath.mClusterId != Clusters::Basic::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/Basic/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void BasicAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::Basic::Attributes; + namespace UN = unify::matter_bridge::Basic::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::Basic::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::Basic::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16u + case MN::DataModelRevision::Id: { + using T = MN::DataModelRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DataModelRevision attribute value is %s",unify_value.dump().c_str() ); + UN::DataModelRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::DataModelRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::VendorName::Id: { + using T = MN::VendorName::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"VendorName attribute value is %s",unify_value.dump().c_str() ); + UN::VendorName::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::VendorName::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is vendor_id + case MN::VendorID::Id: { + using T = MN::VendorID::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"VendorID attribute value is %s",unify_value.dump().c_str() ); + UN::VendorID::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::VendorID::Id, + ZCL_VENDOR_ID_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::ProductName::Id: { + using T = MN::ProductName::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ProductName attribute value is %s",unify_value.dump().c_str() ); + UN::ProductName::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::ProductName::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ProductID::Id: { + using T = MN::ProductID::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ProductID attribute value is %s",unify_value.dump().c_str() ); + UN::ProductID::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::ProductID::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::NodeLabel::Id: { + using T = MN::NodeLabel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NodeLabel attribute value is %s",unify_value.dump().c_str() ); + UN::NodeLabel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::NodeLabel::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::Location::Id: { + using T = MN::Location::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Location attribute value is %s",unify_value.dump().c_str() ); + UN::Location::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::Location::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::HardwareVersion::Id: { + using T = MN::HardwareVersion::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"HardwareVersion attribute value is %s",unify_value.dump().c_str() ); + UN::HardwareVersion::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::HardwareVersion::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::HardwareVersionString::Id: { + using T = MN::HardwareVersionString::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"HardwareVersionString attribute value is %s",unify_value.dump().c_str() ); + UN::HardwareVersionString::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::HardwareVersionString::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::SoftwareVersion::Id: { + using T = MN::SoftwareVersion::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SoftwareVersion attribute value is %s",unify_value.dump().c_str() ); + UN::SoftwareVersion::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::SoftwareVersion::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::SoftwareVersionString::Id: { + using T = MN::SoftwareVersionString::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SoftwareVersionString attribute value is %s",unify_value.dump().c_str() ); + UN::SoftwareVersionString::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::SoftwareVersionString::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::ManufacturingDate::Id: { + using T = MN::ManufacturingDate::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ManufacturingDate attribute value is %s",unify_value.dump().c_str() ); + UN::ManufacturingDate::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::ManufacturingDate::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::PartNumber::Id: { + using T = MN::PartNumber::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PartNumber attribute value is %s",unify_value.dump().c_str() ); + UN::PartNumber::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::PartNumber::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is long_char_string + case MN::ProductURL::Id: { + using T = MN::ProductURL::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ProductURL attribute value is %s",unify_value.dump().c_str() ); + UN::ProductURL::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::ProductURL::Id, + ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::ProductLabel::Id: { + using T = MN::ProductLabel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ProductLabel attribute value is %s",unify_value.dump().c_str() ); + UN::ProductLabel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::ProductLabel::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::SerialNumber::Id: { + using T = MN::SerialNumber::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SerialNumber attribute value is %s",unify_value.dump().c_str() ); + UN::SerialNumber::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::SerialNumber::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::LocalConfigDisabled::Id: { + using T = MN::LocalConfigDisabled::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LocalConfigDisabled attribute value is %s",unify_value.dump().c_str() ); + UN::LocalConfigDisabled::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::LocalConfigDisabled::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::Reachable::Id: { + using T = MN::Reachable::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Reachable attribute value is %s",unify_value.dump().c_str() ); + UN::Reachable::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::Reachable::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::UniqueID::Id: { + using T = MN::UniqueID::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UniqueID attribute value is %s",unify_value.dump().c_str() ); + UN::UniqueID::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::UniqueID::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Basic::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +OtaSoftwareUpdateProviderAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes; + namespace UN = unify::matter_bridge::OtaSoftwareUpdateProvider::Attributes; + if (aPath.mClusterId != Clusters::OtaSoftwareUpdateProvider::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR OtaSoftwareUpdateProviderAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::OtaSoftwareUpdateProvider; + + if (aPath.mClusterId != Clusters::OtaSoftwareUpdateProvider::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/OtaSoftwareUpdateProvider/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void OtaSoftwareUpdateProviderAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes; + namespace UN = unify::matter_bridge::OtaSoftwareUpdateProvider::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::OtaSoftwareUpdateProvider::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::OtaSoftwareUpdateProvider::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OtaSoftwareUpdateProvider::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OtaSoftwareUpdateProvider::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +OtaSoftwareUpdateRequestorAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes; + namespace UN = unify::matter_bridge::OtaSoftwareUpdateRequestor::Attributes; + if (aPath.mClusterId != Clusters::OtaSoftwareUpdateRequestor::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + case MN::UpdatePossible::Id: { // type is boolean + MN::UpdatePossible::TypeInfo::Type value; + UN::UpdatePossible::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UpdateState::Id: { // type is OTAUpdateStateEnum + MN::UpdateState::TypeInfo::Type value; + UN::UpdateState::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UpdateStateProgress::Id: { // type is int8u + MN::UpdateStateProgress::TypeInfo::Type value; + UN::UpdateStateProgress::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR OtaSoftwareUpdateRequestorAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::OtaSoftwareUpdateRequestor; + + if (aPath.mClusterId != Clusters::OtaSoftwareUpdateRequestor::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/OtaSoftwareUpdateRequestor/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void OtaSoftwareUpdateRequestorAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes; + namespace UN = unify::matter_bridge::OtaSoftwareUpdateRequestor::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::OtaSoftwareUpdateRequestor::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::OtaSoftwareUpdateRequestor::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is boolean + case MN::UpdatePossible::Id: { + using T = MN::UpdatePossible::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UpdatePossible attribute value is %s",unify_value.dump().c_str() ); + UN::UpdatePossible::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OtaSoftwareUpdateRequestor::Id, + MN::UpdatePossible::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is OTAUpdateStateEnum + case MN::UpdateState::Id: { + using T = MN::UpdateState::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UpdateState attribute value is %s",unify_value.dump().c_str() ); + UN::UpdateState::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OtaSoftwareUpdateRequestor::Id, + MN::UpdateState::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::UpdateStateProgress::Id: { + using T = MN::UpdateStateProgress::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UpdateStateProgress attribute value is %s",unify_value.dump().c_str() ); + UN::UpdateStateProgress::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OtaSoftwareUpdateRequestor::Id, + MN::UpdateStateProgress::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OtaSoftwareUpdateRequestor::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OtaSoftwareUpdateRequestor::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +LocalizationConfigurationAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::LocalizationConfiguration::Attributes; + namespace UN = unify::matter_bridge::LocalizationConfiguration::Attributes; + if (aPath.mClusterId != Clusters::LocalizationConfiguration::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::ActiveLocale::Id: { // type is char_string + MN::ActiveLocale::TypeInfo::Type value; + UN::ActiveLocale::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR LocalizationConfigurationAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::LocalizationConfiguration; + + if (aPath.mClusterId != Clusters::LocalizationConfiguration::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/LocalizationConfiguration/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void LocalizationConfigurationAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::LocalizationConfiguration::Attributes; + namespace UN = unify::matter_bridge::LocalizationConfiguration::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::LocalizationConfiguration::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::LocalizationConfiguration::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is char_string + case MN::ActiveLocale::Id: { + using T = MN::ActiveLocale::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActiveLocale attribute value is %s",unify_value.dump().c_str() ); + UN::ActiveLocale::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LocalizationConfiguration::Id, + MN::ActiveLocale::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LocalizationConfiguration::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LocalizationConfiguration::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +TimeFormatLocalizationAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::TimeFormatLocalization::Attributes; + namespace UN = unify::matter_bridge::TimeFormatLocalization::Attributes; + if (aPath.mClusterId != Clusters::TimeFormatLocalization::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::HourFormat::Id: { // type is HourFormat + MN::HourFormat::TypeInfo::Type value; + UN::HourFormat::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActiveCalendarType::Id: { // type is CalendarType + MN::ActiveCalendarType::TypeInfo::Type value; + UN::ActiveCalendarType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR TimeFormatLocalizationAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::TimeFormatLocalization; + + if (aPath.mClusterId != Clusters::TimeFormatLocalization::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/TimeFormatLocalization/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void TimeFormatLocalizationAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::TimeFormatLocalization::Attributes; + namespace UN = unify::matter_bridge::TimeFormatLocalization::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::TimeFormatLocalization::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::TimeFormatLocalization::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is HourFormat + case MN::HourFormat::Id: { + using T = MN::HourFormat::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"HourFormat attribute value is %s",unify_value.dump().c_str() ); + UN::HourFormat::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeFormatLocalization::Id, + MN::HourFormat::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is CalendarType + case MN::ActiveCalendarType::Id: { + using T = MN::ActiveCalendarType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActiveCalendarType attribute value is %s",unify_value.dump().c_str() ); + UN::ActiveCalendarType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeFormatLocalization::Id, + MN::ActiveCalendarType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeFormatLocalization::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeFormatLocalization::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +UnitLocalizationAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::UnitLocalization::Attributes; + namespace UN = unify::matter_bridge::UnitLocalization::Attributes; + if (aPath.mClusterId != Clusters::UnitLocalization::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::TemperatureUnit::Id: { // type is TempUnit + MN::TemperatureUnit::TypeInfo::Type value; + UN::TemperatureUnit::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR UnitLocalizationAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::UnitLocalization; + + if (aPath.mClusterId != Clusters::UnitLocalization::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/UnitLocalization/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void UnitLocalizationAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::UnitLocalization::Attributes; + namespace UN = unify::matter_bridge::UnitLocalization::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::UnitLocalization::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::UnitLocalization::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is TempUnit + case MN::TemperatureUnit::Id: { + using T = MN::TemperatureUnit::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TemperatureUnit attribute value is %s",unify_value.dump().c_str() ); + UN::TemperatureUnit::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::UnitLocalization::Id, + MN::TemperatureUnit::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::UnitLocalization::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::UnitLocalization::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +PowerSourceConfigurationAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::PowerSourceConfiguration::Attributes; + namespace UN = unify::matter_bridge::PowerSourceConfiguration::Attributes; + if (aPath.mClusterId != Clusters::PowerSourceConfiguration::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR PowerSourceConfigurationAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::PowerSourceConfiguration; + + if (aPath.mClusterId != Clusters::PowerSourceConfiguration::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/PowerSourceConfiguration/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void PowerSourceConfigurationAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::PowerSourceConfiguration::Attributes; + namespace UN = unify::matter_bridge::PowerSourceConfiguration::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::PowerSourceConfiguration::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::PowerSourceConfiguration::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSourceConfiguration::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSourceConfiguration::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +PowerSourceAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::PowerSource::Attributes; + namespace UN = unify::matter_bridge::PowerSource::Attributes; + if (aPath.mClusterId != Clusters::PowerSource::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::Status::Id: { // type is PowerSourceStatus + MN::Status::TypeInfo::Type value; + UN::Status::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Order::Id: { // type is int8u + MN::Order::TypeInfo::Type value; + UN::Order::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Description::Id: { // type is char_string + MN::Description::TypeInfo::Type value; + UN::Description::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WiredAssessedInputVoltage::Id: { // type is int32u + MN::WiredAssessedInputVoltage::TypeInfo::Type value; + UN::WiredAssessedInputVoltage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WiredAssessedInputFrequency::Id: { // type is int16u + MN::WiredAssessedInputFrequency::TypeInfo::Type value; + UN::WiredAssessedInputFrequency::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WiredCurrentType::Id: { // type is WiredCurrentType + MN::WiredCurrentType::TypeInfo::Type value; + UN::WiredCurrentType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WiredAssessedCurrent::Id: { // type is int32u + MN::WiredAssessedCurrent::TypeInfo::Type value; + UN::WiredAssessedCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WiredNominalVoltage::Id: { // type is int32u + MN::WiredNominalVoltage::TypeInfo::Type value; + UN::WiredNominalVoltage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WiredMaximumCurrent::Id: { // type is int32u + MN::WiredMaximumCurrent::TypeInfo::Type value; + UN::WiredMaximumCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WiredPresent::Id: { // type is boolean + MN::WiredPresent::TypeInfo::Type value; + UN::WiredPresent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::BatVoltage::Id: { // type is int32u + MN::BatVoltage::TypeInfo::Type value; + UN::BatVoltage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatPercentRemaining::Id: { // type is int8u + MN::BatPercentRemaining::TypeInfo::Type value; + UN::BatPercentRemaining::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatTimeRemaining::Id: { // type is int32u + MN::BatTimeRemaining::TypeInfo::Type value; + UN::BatTimeRemaining::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatChargeLevel::Id: { // type is BatChargeLevel + MN::BatChargeLevel::TypeInfo::Type value; + UN::BatChargeLevel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatReplacementNeeded::Id: { // type is boolean + MN::BatReplacementNeeded::TypeInfo::Type value; + UN::BatReplacementNeeded::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatReplaceability::Id: { // type is BatReplaceability + MN::BatReplaceability::TypeInfo::Type value; + UN::BatReplaceability::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatPresent::Id: { // type is boolean + MN::BatPresent::TypeInfo::Type value; + UN::BatPresent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::BatReplacementDescription::Id: { // type is char_string + MN::BatReplacementDescription::TypeInfo::Type value; + UN::BatReplacementDescription::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatCommonDesignation::Id: { // type is int32u + MN::BatCommonDesignation::TypeInfo::Type value; + UN::BatCommonDesignation::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatANSIDesignation::Id: { // type is char_string + MN::BatANSIDesignation::TypeInfo::Type value; + UN::BatANSIDesignation::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatIECDesignation::Id: { // type is char_string + MN::BatIECDesignation::TypeInfo::Type value; + UN::BatIECDesignation::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatApprovedChemistry::Id: { // type is int32u + MN::BatApprovedChemistry::TypeInfo::Type value; + UN::BatApprovedChemistry::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatCapacity::Id: { // type is int32u + MN::BatCapacity::TypeInfo::Type value; + UN::BatCapacity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatQuantity::Id: { // type is int8u + MN::BatQuantity::TypeInfo::Type value; + UN::BatQuantity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatChargeState::Id: { // type is BatChargeState + MN::BatChargeState::TypeInfo::Type value; + UN::BatChargeState::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatTimeToFullCharge::Id: { // type is int32u + MN::BatTimeToFullCharge::TypeInfo::Type value; + UN::BatTimeToFullCharge::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatFunctionalWhileCharging::Id: { // type is boolean + MN::BatFunctionalWhileCharging::TypeInfo::Type value; + UN::BatFunctionalWhileCharging::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BatChargingCurrent::Id: { // type is int32u + MN::BatChargingCurrent::TypeInfo::Type value; + UN::BatChargingCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR PowerSourceAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::PowerSource; + + if (aPath.mClusterId != Clusters::PowerSource::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/PowerSource/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void PowerSourceAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::PowerSource::Attributes; + namespace UN = unify::matter_bridge::PowerSource::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::PowerSource::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::PowerSource::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is PowerSourceStatus + case MN::Status::Id: { + using T = MN::Status::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Status attribute value is %s",unify_value.dump().c_str() ); + UN::Status::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::Status::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::Order::Id: { + using T = MN::Order::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Order attribute value is %s",unify_value.dump().c_str() ); + UN::Order::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::Order::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::Description::Id: { + using T = MN::Description::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Description attribute value is %s",unify_value.dump().c_str() ); + UN::Description::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::Description::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::WiredAssessedInputVoltage::Id: { + using T = MN::WiredAssessedInputVoltage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WiredAssessedInputVoltage attribute value is %s",unify_value.dump().c_str() ); + UN::WiredAssessedInputVoltage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::WiredAssessedInputVoltage::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::WiredAssessedInputFrequency::Id: { + using T = MN::WiredAssessedInputFrequency::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WiredAssessedInputFrequency attribute value is %s",unify_value.dump().c_str() ); + UN::WiredAssessedInputFrequency::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::WiredAssessedInputFrequency::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is WiredCurrentType + case MN::WiredCurrentType::Id: { + using T = MN::WiredCurrentType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WiredCurrentType attribute value is %s",unify_value.dump().c_str() ); + UN::WiredCurrentType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::WiredCurrentType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::WiredAssessedCurrent::Id: { + using T = MN::WiredAssessedCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WiredAssessedCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::WiredAssessedCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::WiredAssessedCurrent::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::WiredNominalVoltage::Id: { + using T = MN::WiredNominalVoltage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WiredNominalVoltage attribute value is %s",unify_value.dump().c_str() ); + UN::WiredNominalVoltage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::WiredNominalVoltage::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::WiredMaximumCurrent::Id: { + using T = MN::WiredMaximumCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WiredMaximumCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::WiredMaximumCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::WiredMaximumCurrent::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::WiredPresent::Id: { + using T = MN::WiredPresent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WiredPresent attribute value is %s",unify_value.dump().c_str() ); + UN::WiredPresent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::WiredPresent::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::BatVoltage::Id: { + using T = MN::BatVoltage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatVoltage attribute value is %s",unify_value.dump().c_str() ); + UN::BatVoltage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatVoltage::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::BatPercentRemaining::Id: { + using T = MN::BatPercentRemaining::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatPercentRemaining attribute value is %s",unify_value.dump().c_str() ); + UN::BatPercentRemaining::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatPercentRemaining::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::BatTimeRemaining::Id: { + using T = MN::BatTimeRemaining::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatTimeRemaining attribute value is %s",unify_value.dump().c_str() ); + UN::BatTimeRemaining::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatTimeRemaining::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is BatChargeLevel + case MN::BatChargeLevel::Id: { + using T = MN::BatChargeLevel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatChargeLevel attribute value is %s",unify_value.dump().c_str() ); + UN::BatChargeLevel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatChargeLevel::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::BatReplacementNeeded::Id: { + using T = MN::BatReplacementNeeded::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatReplacementNeeded attribute value is %s",unify_value.dump().c_str() ); + UN::BatReplacementNeeded::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatReplacementNeeded::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is BatReplaceability + case MN::BatReplaceability::Id: { + using T = MN::BatReplaceability::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatReplaceability attribute value is %s",unify_value.dump().c_str() ); + UN::BatReplaceability::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatReplaceability::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::BatPresent::Id: { + using T = MN::BatPresent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatPresent attribute value is %s",unify_value.dump().c_str() ); + UN::BatPresent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatPresent::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::BatReplacementDescription::Id: { + using T = MN::BatReplacementDescription::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatReplacementDescription attribute value is %s",unify_value.dump().c_str() ); + UN::BatReplacementDescription::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatReplacementDescription::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::BatCommonDesignation::Id: { + using T = MN::BatCommonDesignation::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatCommonDesignation attribute value is %s",unify_value.dump().c_str() ); + UN::BatCommonDesignation::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatCommonDesignation::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::BatANSIDesignation::Id: { + using T = MN::BatANSIDesignation::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatANSIDesignation attribute value is %s",unify_value.dump().c_str() ); + UN::BatANSIDesignation::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatANSIDesignation::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::BatIECDesignation::Id: { + using T = MN::BatIECDesignation::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatIECDesignation attribute value is %s",unify_value.dump().c_str() ); + UN::BatIECDesignation::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatIECDesignation::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::BatApprovedChemistry::Id: { + using T = MN::BatApprovedChemistry::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatApprovedChemistry attribute value is %s",unify_value.dump().c_str() ); + UN::BatApprovedChemistry::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatApprovedChemistry::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::BatCapacity::Id: { + using T = MN::BatCapacity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatCapacity attribute value is %s",unify_value.dump().c_str() ); + UN::BatCapacity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatCapacity::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::BatQuantity::Id: { + using T = MN::BatQuantity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatQuantity attribute value is %s",unify_value.dump().c_str() ); + UN::BatQuantity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatQuantity::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is BatChargeState + case MN::BatChargeState::Id: { + using T = MN::BatChargeState::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatChargeState attribute value is %s",unify_value.dump().c_str() ); + UN::BatChargeState::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatChargeState::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::BatTimeToFullCharge::Id: { + using T = MN::BatTimeToFullCharge::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatTimeToFullCharge attribute value is %s",unify_value.dump().c_str() ); + UN::BatTimeToFullCharge::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatTimeToFullCharge::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::BatFunctionalWhileCharging::Id: { + using T = MN::BatFunctionalWhileCharging::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatFunctionalWhileCharging attribute value is %s",unify_value.dump().c_str() ); + UN::BatFunctionalWhileCharging::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatFunctionalWhileCharging::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::BatChargingCurrent::Id: { + using T = MN::BatChargingCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BatChargingCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::BatChargingCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::BatChargingCurrent::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PowerSource::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +GeneralCommissioningAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::GeneralCommissioning::Attributes; + namespace UN = unify::matter_bridge::GeneralCommissioning::Attributes; + if (aPath.mClusterId != Clusters::GeneralCommissioning::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::Breadcrumb::Id: { // type is int64u + MN::Breadcrumb::TypeInfo::Type value; + UN::Breadcrumb::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::RegulatoryConfig::Id: { // type is RegulatoryLocationType + MN::RegulatoryConfig::TypeInfo::Type value; + UN::RegulatoryConfig::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LocationCapability::Id: { // type is RegulatoryLocationType + MN::LocationCapability::TypeInfo::Type value; + UN::LocationCapability::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SupportsConcurrentConnection::Id: { // type is boolean + MN::SupportsConcurrentConnection::TypeInfo::Type value; + UN::SupportsConcurrentConnection::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR GeneralCommissioningAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::GeneralCommissioning; + + if (aPath.mClusterId != Clusters::GeneralCommissioning::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/GeneralCommissioning/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void GeneralCommissioningAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::GeneralCommissioning::Attributes; + namespace UN = unify::matter_bridge::GeneralCommissioning::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::GeneralCommissioning::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::GeneralCommissioning::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int64u + case MN::Breadcrumb::Id: { + using T = MN::Breadcrumb::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Breadcrumb attribute value is %s",unify_value.dump().c_str() ); + UN::Breadcrumb::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralCommissioning::Id, + MN::Breadcrumb::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is RegulatoryLocationType + case MN::RegulatoryConfig::Id: { + using T = MN::RegulatoryConfig::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RegulatoryConfig attribute value is %s",unify_value.dump().c_str() ); + UN::RegulatoryConfig::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralCommissioning::Id, + MN::RegulatoryConfig::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is RegulatoryLocationType + case MN::LocationCapability::Id: { + using T = MN::LocationCapability::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LocationCapability attribute value is %s",unify_value.dump().c_str() ); + UN::LocationCapability::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralCommissioning::Id, + MN::LocationCapability::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::SupportsConcurrentConnection::Id: { + using T = MN::SupportsConcurrentConnection::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SupportsConcurrentConnection attribute value is %s",unify_value.dump().c_str() ); + UN::SupportsConcurrentConnection::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralCommissioning::Id, + MN::SupportsConcurrentConnection::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralCommissioning::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralCommissioning::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +NetworkCommissioningAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::NetworkCommissioning::Attributes; + namespace UN = unify::matter_bridge::NetworkCommissioning::Attributes; + if (aPath.mClusterId != Clusters::NetworkCommissioning::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::MaxNetworks::Id: { // type is int8u + MN::MaxNetworks::TypeInfo::Type value; + UN::MaxNetworks::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::ScanMaxTimeSeconds::Id: { // type is int8u + MN::ScanMaxTimeSeconds::TypeInfo::Type value; + UN::ScanMaxTimeSeconds::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ConnectMaxTimeSeconds::Id: { // type is int8u + MN::ConnectMaxTimeSeconds::TypeInfo::Type value; + UN::ConnectMaxTimeSeconds::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::InterfaceEnabled::Id: { // type is boolean + MN::InterfaceEnabled::TypeInfo::Type value; + UN::InterfaceEnabled::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LastNetworkingStatus::Id: { // type is NetworkCommissioningStatus + MN::LastNetworkingStatus::TypeInfo::Type value; + UN::LastNetworkingStatus::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LastNetworkID::Id: { // type is octet_string + MN::LastNetworkID::TypeInfo::Type value; + UN::LastNetworkID::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LastConnectErrorValue::Id: { // type is int32s + MN::LastConnectErrorValue::TypeInfo::Type value; + UN::LastConnectErrorValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR NetworkCommissioningAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::NetworkCommissioning; + + if (aPath.mClusterId != Clusters::NetworkCommissioning::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/NetworkCommissioning/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void NetworkCommissioningAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::NetworkCommissioning::Attributes; + namespace UN = unify::matter_bridge::NetworkCommissioning::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::NetworkCommissioning::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::NetworkCommissioning::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int8u + case MN::MaxNetworks::Id: { + using T = MN::MaxNetworks::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxNetworks attribute value is %s",unify_value.dump().c_str() ); + UN::MaxNetworks::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::NetworkCommissioning::Id, + MN::MaxNetworks::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::ScanMaxTimeSeconds::Id: { + using T = MN::ScanMaxTimeSeconds::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ScanMaxTimeSeconds attribute value is %s",unify_value.dump().c_str() ); + UN::ScanMaxTimeSeconds::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::NetworkCommissioning::Id, + MN::ScanMaxTimeSeconds::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::ConnectMaxTimeSeconds::Id: { + using T = MN::ConnectMaxTimeSeconds::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ConnectMaxTimeSeconds attribute value is %s",unify_value.dump().c_str() ); + UN::ConnectMaxTimeSeconds::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::NetworkCommissioning::Id, + MN::ConnectMaxTimeSeconds::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::InterfaceEnabled::Id: { + using T = MN::InterfaceEnabled::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"InterfaceEnabled attribute value is %s",unify_value.dump().c_str() ); + UN::InterfaceEnabled::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::NetworkCommissioning::Id, + MN::InterfaceEnabled::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is NetworkCommissioningStatus + case MN::LastNetworkingStatus::Id: { + using T = MN::LastNetworkingStatus::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LastNetworkingStatus attribute value is %s",unify_value.dump().c_str() ); + UN::LastNetworkingStatus::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::NetworkCommissioning::Id, + MN::LastNetworkingStatus::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is octet_string + case MN::LastNetworkID::Id: { + using T = MN::LastNetworkID::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LastNetworkID attribute value is %s",unify_value.dump().c_str() ); + UN::LastNetworkID::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::NetworkCommissioning::Id, + MN::LastNetworkID::Id, + ZCL_OCTET_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32s + case MN::LastConnectErrorValue::Id: { + using T = MN::LastConnectErrorValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LastConnectErrorValue attribute value is %s",unify_value.dump().c_str() ); + UN::LastConnectErrorValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::NetworkCommissioning::Id, + MN::LastConnectErrorValue::Id, + ZCL_INT32S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::NetworkCommissioning::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::NetworkCommissioning::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +DiagnosticLogsAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::DiagnosticLogs::Attributes; + namespace UN = unify::matter_bridge::DiagnosticLogs::Attributes; + if (aPath.mClusterId != Clusters::DiagnosticLogs::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR DiagnosticLogsAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::DiagnosticLogs; + + if (aPath.mClusterId != Clusters::DiagnosticLogs::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/DiagnosticLogs/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void DiagnosticLogsAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::DiagnosticLogs::Attributes; + namespace UN = unify::matter_bridge::DiagnosticLogs::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::DiagnosticLogs::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::DiagnosticLogs::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DiagnosticLogs::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DiagnosticLogs::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +GeneralDiagnosticsAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::GeneralDiagnostics::Attributes; + namespace UN = unify::matter_bridge::GeneralDiagnostics::Attributes; + if (aPath.mClusterId != Clusters::GeneralDiagnostics::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + case MN::RebootCount::Id: { // type is int16u + MN::RebootCount::TypeInfo::Type value; + UN::RebootCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UpTime::Id: { // type is int64u + MN::UpTime::TypeInfo::Type value; + UN::UpTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TotalOperationalHours::Id: { // type is int32u + MN::TotalOperationalHours::TypeInfo::Type value; + UN::TotalOperationalHours::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BootReasons::Id: { // type is enum8 + MN::BootReasons::TypeInfo::Type value; + UN::BootReasons::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::TestEventTriggersEnabled::Id: { // type is boolean + MN::TestEventTriggersEnabled::TypeInfo::Type value; + UN::TestEventTriggersEnabled::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR GeneralDiagnosticsAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::GeneralDiagnostics; + + if (aPath.mClusterId != Clusters::GeneralDiagnostics::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/GeneralDiagnostics/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void GeneralDiagnosticsAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::GeneralDiagnostics::Attributes; + namespace UN = unify::matter_bridge::GeneralDiagnostics::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::GeneralDiagnostics::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::GeneralDiagnostics::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16u + case MN::RebootCount::Id: { + using T = MN::RebootCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RebootCount attribute value is %s",unify_value.dump().c_str() ); + UN::RebootCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralDiagnostics::Id, + MN::RebootCount::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::UpTime::Id: { + using T = MN::UpTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UpTime attribute value is %s",unify_value.dump().c_str() ); + UN::UpTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralDiagnostics::Id, + MN::UpTime::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TotalOperationalHours::Id: { + using T = MN::TotalOperationalHours::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TotalOperationalHours attribute value is %s",unify_value.dump().c_str() ); + UN::TotalOperationalHours::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralDiagnostics::Id, + MN::TotalOperationalHours::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::BootReasons::Id: { + using T = MN::BootReasons::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BootReasons attribute value is %s",unify_value.dump().c_str() ); + UN::BootReasons::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralDiagnostics::Id, + MN::BootReasons::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::TestEventTriggersEnabled::Id: { + using T = MN::TestEventTriggersEnabled::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TestEventTriggersEnabled attribute value is %s",unify_value.dump().c_str() ); + UN::TestEventTriggersEnabled::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralDiagnostics::Id, + MN::TestEventTriggersEnabled::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralDiagnostics::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GeneralDiagnostics::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +SoftwareDiagnosticsAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::SoftwareDiagnostics::Attributes; + namespace UN = unify::matter_bridge::SoftwareDiagnostics::Attributes; + if (aPath.mClusterId != Clusters::SoftwareDiagnostics::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + case MN::CurrentHeapFree::Id: { // type is int64u + MN::CurrentHeapFree::TypeInfo::Type value; + UN::CurrentHeapFree::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentHeapUsed::Id: { // type is int64u + MN::CurrentHeapUsed::TypeInfo::Type value; + UN::CurrentHeapUsed::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentHeapHighWatermark::Id: { // type is int64u + MN::CurrentHeapHighWatermark::TypeInfo::Type value; + UN::CurrentHeapHighWatermark::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR SoftwareDiagnosticsAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::SoftwareDiagnostics; + + if (aPath.mClusterId != Clusters::SoftwareDiagnostics::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/SoftwareDiagnostics/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void SoftwareDiagnosticsAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::SoftwareDiagnostics::Attributes; + namespace UN = unify::matter_bridge::SoftwareDiagnostics::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::SoftwareDiagnostics::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::SoftwareDiagnostics::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int64u + case MN::CurrentHeapFree::Id: { + using T = MN::CurrentHeapFree::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentHeapFree attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentHeapFree::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::SoftwareDiagnostics::Id, + MN::CurrentHeapFree::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::CurrentHeapUsed::Id: { + using T = MN::CurrentHeapUsed::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentHeapUsed attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentHeapUsed::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::SoftwareDiagnostics::Id, + MN::CurrentHeapUsed::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::CurrentHeapHighWatermark::Id: { + using T = MN::CurrentHeapHighWatermark::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentHeapHighWatermark attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentHeapHighWatermark::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::SoftwareDiagnostics::Id, + MN::CurrentHeapHighWatermark::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::SoftwareDiagnostics::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::SoftwareDiagnostics::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ThreadNetworkDiagnosticsAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes; + namespace UN = unify::matter_bridge::ThreadNetworkDiagnostics::Attributes; + if (aPath.mClusterId != Clusters::ThreadNetworkDiagnostics::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::Channel::Id: { // type is int16u + MN::Channel::TypeInfo::Type value; + UN::Channel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RoutingRole::Id: { // type is RoutingRole + MN::RoutingRole::TypeInfo::Type value; + UN::RoutingRole::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NetworkName::Id: { // type is char_string + MN::NetworkName::TypeInfo::Type value; + UN::NetworkName::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PanId::Id: { // type is int16u + MN::PanId::TypeInfo::Type value; + UN::PanId::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ExtendedPanId::Id: { // type is int64u + MN::ExtendedPanId::TypeInfo::Type value; + UN::ExtendedPanId::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MeshLocalPrefix::Id: { // type is octet_string + MN::MeshLocalPrefix::TypeInfo::Type value; + UN::MeshLocalPrefix::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OverrunCount::Id: { // type is int64u + MN::OverrunCount::TypeInfo::Type value; + UN::OverrunCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + case MN::PartitionId::Id: { // type is int32u + MN::PartitionId::TypeInfo::Type value; + UN::PartitionId::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Weighting::Id: { // type is int8u + MN::Weighting::TypeInfo::Type value; + UN::Weighting::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DataVersion::Id: { // type is int8u + MN::DataVersion::TypeInfo::Type value; + UN::DataVersion::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::StableDataVersion::Id: { // type is int8u + MN::StableDataVersion::TypeInfo::Type value; + UN::StableDataVersion::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LeaderRouterId::Id: { // type is int8u + MN::LeaderRouterId::TypeInfo::Type value; + UN::LeaderRouterId::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DetachedRoleCount::Id: { // type is int16u + MN::DetachedRoleCount::TypeInfo::Type value; + UN::DetachedRoleCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ChildRoleCount::Id: { // type is int16u + MN::ChildRoleCount::TypeInfo::Type value; + UN::ChildRoleCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RouterRoleCount::Id: { // type is int16u + MN::RouterRoleCount::TypeInfo::Type value; + UN::RouterRoleCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LeaderRoleCount::Id: { // type is int16u + MN::LeaderRoleCount::TypeInfo::Type value; + UN::LeaderRoleCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AttachAttemptCount::Id: { // type is int16u + MN::AttachAttemptCount::TypeInfo::Type value; + UN::AttachAttemptCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PartitionIdChangeCount::Id: { // type is int16u + MN::PartitionIdChangeCount::TypeInfo::Type value; + UN::PartitionIdChangeCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BetterPartitionAttachAttemptCount::Id: { // type is int16u + MN::BetterPartitionAttachAttemptCount::TypeInfo::Type value; + UN::BetterPartitionAttachAttemptCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ParentChangeCount::Id: { // type is int16u + MN::ParentChangeCount::TypeInfo::Type value; + UN::ParentChangeCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxTotalCount::Id: { // type is int32u + MN::TxTotalCount::TypeInfo::Type value; + UN::TxTotalCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxUnicastCount::Id: { // type is int32u + MN::TxUnicastCount::TypeInfo::Type value; + UN::TxUnicastCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxBroadcastCount::Id: { // type is int32u + MN::TxBroadcastCount::TypeInfo::Type value; + UN::TxBroadcastCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxAckRequestedCount::Id: { // type is int32u + MN::TxAckRequestedCount::TypeInfo::Type value; + UN::TxAckRequestedCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxAckedCount::Id: { // type is int32u + MN::TxAckedCount::TypeInfo::Type value; + UN::TxAckedCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxNoAckRequestedCount::Id: { // type is int32u + MN::TxNoAckRequestedCount::TypeInfo::Type value; + UN::TxNoAckRequestedCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxDataCount::Id: { // type is int32u + MN::TxDataCount::TypeInfo::Type value; + UN::TxDataCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxDataPollCount::Id: { // type is int32u + MN::TxDataPollCount::TypeInfo::Type value; + UN::TxDataPollCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxBeaconCount::Id: { // type is int32u + MN::TxBeaconCount::TypeInfo::Type value; + UN::TxBeaconCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxBeaconRequestCount::Id: { // type is int32u + MN::TxBeaconRequestCount::TypeInfo::Type value; + UN::TxBeaconRequestCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxOtherCount::Id: { // type is int32u + MN::TxOtherCount::TypeInfo::Type value; + UN::TxOtherCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxRetryCount::Id: { // type is int32u + MN::TxRetryCount::TypeInfo::Type value; + UN::TxRetryCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxDirectMaxRetryExpiryCount::Id: { // type is int32u + MN::TxDirectMaxRetryExpiryCount::TypeInfo::Type value; + UN::TxDirectMaxRetryExpiryCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxIndirectMaxRetryExpiryCount::Id: { // type is int32u + MN::TxIndirectMaxRetryExpiryCount::TypeInfo::Type value; + UN::TxIndirectMaxRetryExpiryCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxErrCcaCount::Id: { // type is int32u + MN::TxErrCcaCount::TypeInfo::Type value; + UN::TxErrCcaCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxErrAbortCount::Id: { // type is int32u + MN::TxErrAbortCount::TypeInfo::Type value; + UN::TxErrAbortCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxErrBusyChannelCount::Id: { // type is int32u + MN::TxErrBusyChannelCount::TypeInfo::Type value; + UN::TxErrBusyChannelCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxTotalCount::Id: { // type is int32u + MN::RxTotalCount::TypeInfo::Type value; + UN::RxTotalCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxUnicastCount::Id: { // type is int32u + MN::RxUnicastCount::TypeInfo::Type value; + UN::RxUnicastCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxBroadcastCount::Id: { // type is int32u + MN::RxBroadcastCount::TypeInfo::Type value; + UN::RxBroadcastCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxDataCount::Id: { // type is int32u + MN::RxDataCount::TypeInfo::Type value; + UN::RxDataCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxDataPollCount::Id: { // type is int32u + MN::RxDataPollCount::TypeInfo::Type value; + UN::RxDataPollCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxBeaconCount::Id: { // type is int32u + MN::RxBeaconCount::TypeInfo::Type value; + UN::RxBeaconCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxBeaconRequestCount::Id: { // type is int32u + MN::RxBeaconRequestCount::TypeInfo::Type value; + UN::RxBeaconRequestCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxOtherCount::Id: { // type is int32u + MN::RxOtherCount::TypeInfo::Type value; + UN::RxOtherCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxAddressFilteredCount::Id: { // type is int32u + MN::RxAddressFilteredCount::TypeInfo::Type value; + UN::RxAddressFilteredCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxDestAddrFilteredCount::Id: { // type is int32u + MN::RxDestAddrFilteredCount::TypeInfo::Type value; + UN::RxDestAddrFilteredCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxDuplicatedCount::Id: { // type is int32u + MN::RxDuplicatedCount::TypeInfo::Type value; + UN::RxDuplicatedCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxErrNoFrameCount::Id: { // type is int32u + MN::RxErrNoFrameCount::TypeInfo::Type value; + UN::RxErrNoFrameCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxErrUnknownNeighborCount::Id: { // type is int32u + MN::RxErrUnknownNeighborCount::TypeInfo::Type value; + UN::RxErrUnknownNeighborCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxErrInvalidSrcAddrCount::Id: { // type is int32u + MN::RxErrInvalidSrcAddrCount::TypeInfo::Type value; + UN::RxErrInvalidSrcAddrCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxErrSecCount::Id: { // type is int32u + MN::RxErrSecCount::TypeInfo::Type value; + UN::RxErrSecCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxErrFcsCount::Id: { // type is int32u + MN::RxErrFcsCount::TypeInfo::Type value; + UN::RxErrFcsCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RxErrOtherCount::Id: { // type is int32u + MN::RxErrOtherCount::TypeInfo::Type value; + UN::RxErrOtherCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActiveTimestamp::Id: { // type is int64u + MN::ActiveTimestamp::TypeInfo::Type value; + UN::ActiveTimestamp::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PendingTimestamp::Id: { // type is int64u + MN::PendingTimestamp::TypeInfo::Type value; + UN::PendingTimestamp::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Delay::Id: { // type is int32u + MN::Delay::TypeInfo::Type value; + UN::Delay::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::ChannelPage0Mask::Id: { // type is octet_string + MN::ChannelPage0Mask::TypeInfo::Type value; + UN::ChannelPage0Mask::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThreadNetworkDiagnosticsAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::ThreadNetworkDiagnostics; + + if (aPath.mClusterId != Clusters::ThreadNetworkDiagnostics::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/ThreadNetworkDiagnostics/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ThreadNetworkDiagnosticsAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes; + namespace UN = unify::matter_bridge::ThreadNetworkDiagnostics::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::ThreadNetworkDiagnostics::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::ThreadNetworkDiagnostics::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16u + case MN::Channel::Id: { + using T = MN::Channel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Channel attribute value is %s",unify_value.dump().c_str() ); + UN::Channel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::Channel::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is RoutingRole + case MN::RoutingRole::Id: { + using T = MN::RoutingRole::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RoutingRole attribute value is %s",unify_value.dump().c_str() ); + UN::RoutingRole::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RoutingRole::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::NetworkName::Id: { + using T = MN::NetworkName::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NetworkName attribute value is %s",unify_value.dump().c_str() ); + UN::NetworkName::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::NetworkName::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::PanId::Id: { + using T = MN::PanId::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PanId attribute value is %s",unify_value.dump().c_str() ); + UN::PanId::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::PanId::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::ExtendedPanId::Id: { + using T = MN::ExtendedPanId::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ExtendedPanId attribute value is %s",unify_value.dump().c_str() ); + UN::ExtendedPanId::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::ExtendedPanId::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is octet_string + case MN::MeshLocalPrefix::Id: { + using T = MN::MeshLocalPrefix::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeshLocalPrefix attribute value is %s",unify_value.dump().c_str() ); + UN::MeshLocalPrefix::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::MeshLocalPrefix::Id, + ZCL_OCTET_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::OverrunCount::Id: { + using T = MN::OverrunCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OverrunCount attribute value is %s",unify_value.dump().c_str() ); + UN::OverrunCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::OverrunCount::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::PartitionId::Id: { + using T = MN::PartitionId::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PartitionId attribute value is %s",unify_value.dump().c_str() ); + UN::PartitionId::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::PartitionId::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::Weighting::Id: { + using T = MN::Weighting::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Weighting attribute value is %s",unify_value.dump().c_str() ); + UN::Weighting::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::Weighting::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::DataVersion::Id: { + using T = MN::DataVersion::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DataVersion attribute value is %s",unify_value.dump().c_str() ); + UN::DataVersion::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::DataVersion::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::StableDataVersion::Id: { + using T = MN::StableDataVersion::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"StableDataVersion attribute value is %s",unify_value.dump().c_str() ); + UN::StableDataVersion::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::StableDataVersion::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::LeaderRouterId::Id: { + using T = MN::LeaderRouterId::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LeaderRouterId attribute value is %s",unify_value.dump().c_str() ); + UN::LeaderRouterId::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::LeaderRouterId::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::DetachedRoleCount::Id: { + using T = MN::DetachedRoleCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DetachedRoleCount attribute value is %s",unify_value.dump().c_str() ); + UN::DetachedRoleCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::DetachedRoleCount::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ChildRoleCount::Id: { + using T = MN::ChildRoleCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ChildRoleCount attribute value is %s",unify_value.dump().c_str() ); + UN::ChildRoleCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::ChildRoleCount::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RouterRoleCount::Id: { + using T = MN::RouterRoleCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RouterRoleCount attribute value is %s",unify_value.dump().c_str() ); + UN::RouterRoleCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RouterRoleCount::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::LeaderRoleCount::Id: { + using T = MN::LeaderRoleCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LeaderRoleCount attribute value is %s",unify_value.dump().c_str() ); + UN::LeaderRoleCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::LeaderRoleCount::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AttachAttemptCount::Id: { + using T = MN::AttachAttemptCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AttachAttemptCount attribute value is %s",unify_value.dump().c_str() ); + UN::AttachAttemptCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::AttachAttemptCount::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::PartitionIdChangeCount::Id: { + using T = MN::PartitionIdChangeCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PartitionIdChangeCount attribute value is %s",unify_value.dump().c_str() ); + UN::PartitionIdChangeCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::PartitionIdChangeCount::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::BetterPartitionAttachAttemptCount::Id: { + using T = MN::BetterPartitionAttachAttemptCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BetterPartitionAttachAttemptCount attribute value is %s",unify_value.dump().c_str() ); + UN::BetterPartitionAttachAttemptCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::BetterPartitionAttachAttemptCount::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ParentChangeCount::Id: { + using T = MN::ParentChangeCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ParentChangeCount attribute value is %s",unify_value.dump().c_str() ); + UN::ParentChangeCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::ParentChangeCount::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxTotalCount::Id: { + using T = MN::TxTotalCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxTotalCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxTotalCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxTotalCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxUnicastCount::Id: { + using T = MN::TxUnicastCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxUnicastCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxUnicastCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxUnicastCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxBroadcastCount::Id: { + using T = MN::TxBroadcastCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxBroadcastCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxBroadcastCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxBroadcastCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxAckRequestedCount::Id: { + using T = MN::TxAckRequestedCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxAckRequestedCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxAckRequestedCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxAckRequestedCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxAckedCount::Id: { + using T = MN::TxAckedCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxAckedCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxAckedCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxAckedCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxNoAckRequestedCount::Id: { + using T = MN::TxNoAckRequestedCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxNoAckRequestedCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxNoAckRequestedCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxNoAckRequestedCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxDataCount::Id: { + using T = MN::TxDataCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxDataCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxDataCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxDataCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxDataPollCount::Id: { + using T = MN::TxDataPollCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxDataPollCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxDataPollCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxDataPollCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxBeaconCount::Id: { + using T = MN::TxBeaconCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxBeaconCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxBeaconCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxBeaconCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxBeaconRequestCount::Id: { + using T = MN::TxBeaconRequestCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxBeaconRequestCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxBeaconRequestCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxBeaconRequestCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxOtherCount::Id: { + using T = MN::TxOtherCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxOtherCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxOtherCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxOtherCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxRetryCount::Id: { + using T = MN::TxRetryCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxRetryCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxRetryCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxRetryCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxDirectMaxRetryExpiryCount::Id: { + using T = MN::TxDirectMaxRetryExpiryCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxDirectMaxRetryExpiryCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxDirectMaxRetryExpiryCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxDirectMaxRetryExpiryCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxIndirectMaxRetryExpiryCount::Id: { + using T = MN::TxIndirectMaxRetryExpiryCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxIndirectMaxRetryExpiryCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxIndirectMaxRetryExpiryCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxIndirectMaxRetryExpiryCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxErrCcaCount::Id: { + using T = MN::TxErrCcaCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxErrCcaCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxErrCcaCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxErrCcaCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxErrAbortCount::Id: { + using T = MN::TxErrAbortCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxErrAbortCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxErrAbortCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxErrAbortCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TxErrBusyChannelCount::Id: { + using T = MN::TxErrBusyChannelCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxErrBusyChannelCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxErrBusyChannelCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::TxErrBusyChannelCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxTotalCount::Id: { + using T = MN::RxTotalCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxTotalCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxTotalCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxTotalCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxUnicastCount::Id: { + using T = MN::RxUnicastCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxUnicastCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxUnicastCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxUnicastCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxBroadcastCount::Id: { + using T = MN::RxBroadcastCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxBroadcastCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxBroadcastCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxBroadcastCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxDataCount::Id: { + using T = MN::RxDataCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxDataCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxDataCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxDataCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxDataPollCount::Id: { + using T = MN::RxDataPollCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxDataPollCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxDataPollCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxDataPollCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxBeaconCount::Id: { + using T = MN::RxBeaconCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxBeaconCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxBeaconCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxBeaconCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxBeaconRequestCount::Id: { + using T = MN::RxBeaconRequestCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxBeaconRequestCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxBeaconRequestCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxBeaconRequestCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxOtherCount::Id: { + using T = MN::RxOtherCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxOtherCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxOtherCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxOtherCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxAddressFilteredCount::Id: { + using T = MN::RxAddressFilteredCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxAddressFilteredCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxAddressFilteredCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxAddressFilteredCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxDestAddrFilteredCount::Id: { + using T = MN::RxDestAddrFilteredCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxDestAddrFilteredCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxDestAddrFilteredCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxDestAddrFilteredCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxDuplicatedCount::Id: { + using T = MN::RxDuplicatedCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxDuplicatedCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxDuplicatedCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxDuplicatedCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxErrNoFrameCount::Id: { + using T = MN::RxErrNoFrameCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxErrNoFrameCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxErrNoFrameCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxErrNoFrameCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxErrUnknownNeighborCount::Id: { + using T = MN::RxErrUnknownNeighborCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxErrUnknownNeighborCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxErrUnknownNeighborCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxErrUnknownNeighborCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxErrInvalidSrcAddrCount::Id: { + using T = MN::RxErrInvalidSrcAddrCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxErrInvalidSrcAddrCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxErrInvalidSrcAddrCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxErrInvalidSrcAddrCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxErrSecCount::Id: { + using T = MN::RxErrSecCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxErrSecCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxErrSecCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxErrSecCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxErrFcsCount::Id: { + using T = MN::RxErrFcsCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxErrFcsCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxErrFcsCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxErrFcsCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::RxErrOtherCount::Id: { + using T = MN::RxErrOtherCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RxErrOtherCount attribute value is %s",unify_value.dump().c_str() ); + UN::RxErrOtherCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::RxErrOtherCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::ActiveTimestamp::Id: { + using T = MN::ActiveTimestamp::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActiveTimestamp attribute value is %s",unify_value.dump().c_str() ); + UN::ActiveTimestamp::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::ActiveTimestamp::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::PendingTimestamp::Id: { + using T = MN::PendingTimestamp::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PendingTimestamp attribute value is %s",unify_value.dump().c_str() ); + UN::PendingTimestamp::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::PendingTimestamp::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::Delay::Id: { + using T = MN::Delay::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Delay attribute value is %s",unify_value.dump().c_str() ); + UN::Delay::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::Delay::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is octet_string + case MN::ChannelPage0Mask::Id: { + using T = MN::ChannelPage0Mask::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ChannelPage0Mask attribute value is %s",unify_value.dump().c_str() ); + UN::ChannelPage0Mask::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::ChannelPage0Mask::Id, + ZCL_OCTET_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThreadNetworkDiagnostics::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +WiFiNetworkDiagnosticsAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes; + namespace UN = unify::matter_bridge::WiFiNetworkDiagnostics::Attributes; + if (aPath.mClusterId != Clusters::WiFiNetworkDiagnostics::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::Bssid::Id: { // type is octet_string + MN::Bssid::TypeInfo::Type value; + UN::Bssid::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SecurityType::Id: { // type is SecurityType + MN::SecurityType::TypeInfo::Type value; + UN::SecurityType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WiFiVersion::Id: { // type is WiFiVersionType + MN::WiFiVersion::TypeInfo::Type value; + UN::WiFiVersion::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ChannelNumber::Id: { // type is int16u + MN::ChannelNumber::TypeInfo::Type value; + UN::ChannelNumber::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Rssi::Id: { // type is int8s + MN::Rssi::TypeInfo::Type value; + UN::Rssi::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BeaconLostCount::Id: { // type is int32u + MN::BeaconLostCount::TypeInfo::Type value; + UN::BeaconLostCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BeaconRxCount::Id: { // type is int32u + MN::BeaconRxCount::TypeInfo::Type value; + UN::BeaconRxCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PacketMulticastRxCount::Id: { // type is int32u + MN::PacketMulticastRxCount::TypeInfo::Type value; + UN::PacketMulticastRxCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PacketMulticastTxCount::Id: { // type is int32u + MN::PacketMulticastTxCount::TypeInfo::Type value; + UN::PacketMulticastTxCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PacketUnicastRxCount::Id: { // type is int32u + MN::PacketUnicastRxCount::TypeInfo::Type value; + UN::PacketUnicastRxCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PacketUnicastTxCount::Id: { // type is int32u + MN::PacketUnicastTxCount::TypeInfo::Type value; + UN::PacketUnicastTxCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentMaxRate::Id: { // type is int64u + MN::CurrentMaxRate::TypeInfo::Type value; + UN::CurrentMaxRate::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OverrunCount::Id: { // type is int64u + MN::OverrunCount::TypeInfo::Type value; + UN::OverrunCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR WiFiNetworkDiagnosticsAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::WiFiNetworkDiagnostics; + + if (aPath.mClusterId != Clusters::WiFiNetworkDiagnostics::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/WiFiNetworkDiagnostics/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void WiFiNetworkDiagnosticsAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes; + namespace UN = unify::matter_bridge::WiFiNetworkDiagnostics::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::WiFiNetworkDiagnostics::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::WiFiNetworkDiagnostics::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is octet_string + case MN::Bssid::Id: { + using T = MN::Bssid::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Bssid attribute value is %s",unify_value.dump().c_str() ); + UN::Bssid::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::Bssid::Id, + ZCL_OCTET_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is SecurityType + case MN::SecurityType::Id: { + using T = MN::SecurityType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SecurityType attribute value is %s",unify_value.dump().c_str() ); + UN::SecurityType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::SecurityType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is WiFiVersionType + case MN::WiFiVersion::Id: { + using T = MN::WiFiVersion::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WiFiVersion attribute value is %s",unify_value.dump().c_str() ); + UN::WiFiVersion::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::WiFiVersion::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ChannelNumber::Id: { + using T = MN::ChannelNumber::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ChannelNumber attribute value is %s",unify_value.dump().c_str() ); + UN::ChannelNumber::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::ChannelNumber::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::Rssi::Id: { + using T = MN::Rssi::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Rssi attribute value is %s",unify_value.dump().c_str() ); + UN::Rssi::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::Rssi::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::BeaconLostCount::Id: { + using T = MN::BeaconLostCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BeaconLostCount attribute value is %s",unify_value.dump().c_str() ); + UN::BeaconLostCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::BeaconLostCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::BeaconRxCount::Id: { + using T = MN::BeaconRxCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BeaconRxCount attribute value is %s",unify_value.dump().c_str() ); + UN::BeaconRxCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::BeaconRxCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::PacketMulticastRxCount::Id: { + using T = MN::PacketMulticastRxCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PacketMulticastRxCount attribute value is %s",unify_value.dump().c_str() ); + UN::PacketMulticastRxCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::PacketMulticastRxCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::PacketMulticastTxCount::Id: { + using T = MN::PacketMulticastTxCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PacketMulticastTxCount attribute value is %s",unify_value.dump().c_str() ); + UN::PacketMulticastTxCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::PacketMulticastTxCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::PacketUnicastRxCount::Id: { + using T = MN::PacketUnicastRxCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PacketUnicastRxCount attribute value is %s",unify_value.dump().c_str() ); + UN::PacketUnicastRxCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::PacketUnicastRxCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::PacketUnicastTxCount::Id: { + using T = MN::PacketUnicastTxCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PacketUnicastTxCount attribute value is %s",unify_value.dump().c_str() ); + UN::PacketUnicastTxCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::PacketUnicastTxCount::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::CurrentMaxRate::Id: { + using T = MN::CurrentMaxRate::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentMaxRate attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentMaxRate::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::CurrentMaxRate::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::OverrunCount::Id: { + using T = MN::OverrunCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OverrunCount attribute value is %s",unify_value.dump().c_str() ); + UN::OverrunCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::OverrunCount::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WiFiNetworkDiagnostics::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +EthernetNetworkDiagnosticsAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes; + namespace UN = unify::matter_bridge::EthernetNetworkDiagnostics::Attributes; + if (aPath.mClusterId != Clusters::EthernetNetworkDiagnostics::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::PHYRate::Id: { // type is PHYRateType + MN::PHYRate::TypeInfo::Type value; + UN::PHYRate::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::FullDuplex::Id: { // type is boolean + MN::FullDuplex::TypeInfo::Type value; + UN::FullDuplex::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PacketRxCount::Id: { // type is int64u + MN::PacketRxCount::TypeInfo::Type value; + UN::PacketRxCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PacketTxCount::Id: { // type is int64u + MN::PacketTxCount::TypeInfo::Type value; + UN::PacketTxCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TxErrCount::Id: { // type is int64u + MN::TxErrCount::TypeInfo::Type value; + UN::TxErrCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CollisionCount::Id: { // type is int64u + MN::CollisionCount::TypeInfo::Type value; + UN::CollisionCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OverrunCount::Id: { // type is int64u + MN::OverrunCount::TypeInfo::Type value; + UN::OverrunCount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CarrierDetect::Id: { // type is boolean + MN::CarrierDetect::TypeInfo::Type value; + UN::CarrierDetect::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TimeSinceReset::Id: { // type is int64u + MN::TimeSinceReset::TypeInfo::Type value; + UN::TimeSinceReset::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR EthernetNetworkDiagnosticsAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::EthernetNetworkDiagnostics; + + if (aPath.mClusterId != Clusters::EthernetNetworkDiagnostics::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/EthernetNetworkDiagnostics/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void EthernetNetworkDiagnosticsAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes; + namespace UN = unify::matter_bridge::EthernetNetworkDiagnostics::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::EthernetNetworkDiagnostics::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::EthernetNetworkDiagnostics::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is PHYRateType + case MN::PHYRate::Id: { + using T = MN::PHYRate::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PHYRate attribute value is %s",unify_value.dump().c_str() ); + UN::PHYRate::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::EthernetNetworkDiagnostics::Id, + MN::PHYRate::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::FullDuplex::Id: { + using T = MN::FullDuplex::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FullDuplex attribute value is %s",unify_value.dump().c_str() ); + UN::FullDuplex::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::EthernetNetworkDiagnostics::Id, + MN::FullDuplex::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::PacketRxCount::Id: { + using T = MN::PacketRxCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PacketRxCount attribute value is %s",unify_value.dump().c_str() ); + UN::PacketRxCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::EthernetNetworkDiagnostics::Id, + MN::PacketRxCount::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::PacketTxCount::Id: { + using T = MN::PacketTxCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PacketTxCount attribute value is %s",unify_value.dump().c_str() ); + UN::PacketTxCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::EthernetNetworkDiagnostics::Id, + MN::PacketTxCount::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::TxErrCount::Id: { + using T = MN::TxErrCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TxErrCount attribute value is %s",unify_value.dump().c_str() ); + UN::TxErrCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::EthernetNetworkDiagnostics::Id, + MN::TxErrCount::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::CollisionCount::Id: { + using T = MN::CollisionCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CollisionCount attribute value is %s",unify_value.dump().c_str() ); + UN::CollisionCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::EthernetNetworkDiagnostics::Id, + MN::CollisionCount::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::OverrunCount::Id: { + using T = MN::OverrunCount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OverrunCount attribute value is %s",unify_value.dump().c_str() ); + UN::OverrunCount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::EthernetNetworkDiagnostics::Id, + MN::OverrunCount::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::CarrierDetect::Id: { + using T = MN::CarrierDetect::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CarrierDetect attribute value is %s",unify_value.dump().c_str() ); + UN::CarrierDetect::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::EthernetNetworkDiagnostics::Id, + MN::CarrierDetect::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::TimeSinceReset::Id: { + using T = MN::TimeSinceReset::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TimeSinceReset attribute value is %s",unify_value.dump().c_str() ); + UN::TimeSinceReset::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::EthernetNetworkDiagnostics::Id, + MN::TimeSinceReset::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::EthernetNetworkDiagnostics::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::EthernetNetworkDiagnostics::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +TimeSynchronizationAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::TimeSynchronization::Attributes; + namespace UN = unify::matter_bridge::TimeSynchronization::Attributes; + if (aPath.mClusterId != Clusters::TimeSynchronization::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::UTCTime::Id: { // type is epoch_us + MN::UTCTime::TypeInfo::Type value; + UN::UTCTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Granularity::Id: { // type is GranularityEnum + MN::Granularity::TypeInfo::Type value; + UN::Granularity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TimeSource::Id: { // type is TimeSourceEnum + MN::TimeSource::TypeInfo::Type value; + UN::TimeSource::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TrustedTimeNodeId::Id: { // type is node_id + MN::TrustedTimeNodeId::TypeInfo::Type value; + UN::TrustedTimeNodeId::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DefaultNtp::Id: { // type is char_string + MN::DefaultNtp::TypeInfo::Type value; + UN::DefaultNtp::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + case MN::LocalTime::Id: { // type is epoch_us + MN::LocalTime::TypeInfo::Type value; + UN::LocalTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TimeZoneDatabase::Id: { // type is boolean + MN::TimeZoneDatabase::TypeInfo::Type value; + UN::TimeZoneDatabase::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NtpServerPort::Id: { // type is int16u + MN::NtpServerPort::TypeInfo::Type value; + UN::NtpServerPort::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR TimeSynchronizationAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::TimeSynchronization; + + if (aPath.mClusterId != Clusters::TimeSynchronization::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/TimeSynchronization/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void TimeSynchronizationAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::TimeSynchronization::Attributes; + namespace UN = unify::matter_bridge::TimeSynchronization::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::TimeSynchronization::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::TimeSynchronization::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is epoch_us + case MN::UTCTime::Id: { + using T = MN::UTCTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UTCTime attribute value is %s",unify_value.dump().c_str() ); + UN::UTCTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeSynchronization::Id, + MN::UTCTime::Id, + ZCL_EPOCH_US_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is GranularityEnum + case MN::Granularity::Id: { + using T = MN::Granularity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Granularity attribute value is %s",unify_value.dump().c_str() ); + UN::Granularity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeSynchronization::Id, + MN::Granularity::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is TimeSourceEnum + case MN::TimeSource::Id: { + using T = MN::TimeSource::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TimeSource attribute value is %s",unify_value.dump().c_str() ); + UN::TimeSource::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeSynchronization::Id, + MN::TimeSource::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is node_id + case MN::TrustedTimeNodeId::Id: { + using T = MN::TrustedTimeNodeId::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TrustedTimeNodeId attribute value is %s",unify_value.dump().c_str() ); + UN::TrustedTimeNodeId::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeSynchronization::Id, + MN::TrustedTimeNodeId::Id, + ZCL_NODE_ID_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::DefaultNtp::Id: { + using T = MN::DefaultNtp::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DefaultNtp attribute value is %s",unify_value.dump().c_str() ); + UN::DefaultNtp::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeSynchronization::Id, + MN::DefaultNtp::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is epoch_us + case MN::LocalTime::Id: { + using T = MN::LocalTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LocalTime attribute value is %s",unify_value.dump().c_str() ); + UN::LocalTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeSynchronization::Id, + MN::LocalTime::Id, + ZCL_EPOCH_US_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::TimeZoneDatabase::Id: { + using T = MN::TimeZoneDatabase::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TimeZoneDatabase attribute value is %s",unify_value.dump().c_str() ); + UN::TimeZoneDatabase::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeSynchronization::Id, + MN::TimeZoneDatabase::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::NtpServerPort::Id: { + using T = MN::NtpServerPort::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NtpServerPort attribute value is %s",unify_value.dump().c_str() ); + UN::NtpServerPort::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeSynchronization::Id, + MN::NtpServerPort::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeSynchronization::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TimeSynchronization::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +BridgedDeviceBasicAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::BridgedDeviceBasic::Attributes; + namespace UN = unify::matter_bridge::BridgedDeviceBasic::Attributes; + if (aPath.mClusterId != Clusters::BridgedDeviceBasic::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::VendorName::Id: { // type is char_string + MN::VendorName::TypeInfo::Type value; + UN::VendorName::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::VendorID::Id: { // type is vendor_id + MN::VendorID::TypeInfo::Type value; + UN::VendorID::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ProductName::Id: { // type is char_string + MN::ProductName::TypeInfo::Type value; + UN::ProductName::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NodeLabel::Id: { // type is char_string + MN::NodeLabel::TypeInfo::Type value; + UN::NodeLabel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::HardwareVersion::Id: { // type is int16u + MN::HardwareVersion::TypeInfo::Type value; + UN::HardwareVersion::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::HardwareVersionString::Id: { // type is char_string + MN::HardwareVersionString::TypeInfo::Type value; + UN::HardwareVersionString::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SoftwareVersion::Id: { // type is int32u + MN::SoftwareVersion::TypeInfo::Type value; + UN::SoftwareVersion::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SoftwareVersionString::Id: { // type is char_string + MN::SoftwareVersionString::TypeInfo::Type value; + UN::SoftwareVersionString::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ManufacturingDate::Id: { // type is char_string + MN::ManufacturingDate::TypeInfo::Type value; + UN::ManufacturingDate::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PartNumber::Id: { // type is char_string + MN::PartNumber::TypeInfo::Type value; + UN::PartNumber::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ProductURL::Id: { // type is long_char_string + MN::ProductURL::TypeInfo::Type value; + UN::ProductURL::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ProductLabel::Id: { // type is char_string + MN::ProductLabel::TypeInfo::Type value; + UN::ProductLabel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SerialNumber::Id: { // type is char_string + MN::SerialNumber::TypeInfo::Type value; + UN::SerialNumber::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Reachable::Id: { // type is boolean + MN::Reachable::TypeInfo::Type value; + UN::Reachable::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UniqueID::Id: { // type is char_string + MN::UniqueID::TypeInfo::Type value; + UN::UniqueID::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR BridgedDeviceBasicAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::BridgedDeviceBasic; + + if (aPath.mClusterId != Clusters::BridgedDeviceBasic::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/BridgedDeviceBasic/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void BridgedDeviceBasicAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::BridgedDeviceBasic::Attributes; + namespace UN = unify::matter_bridge::BridgedDeviceBasic::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::BridgedDeviceBasic::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::BridgedDeviceBasic::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is char_string + case MN::VendorName::Id: { + using T = MN::VendorName::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"VendorName attribute value is %s",unify_value.dump().c_str() ); + UN::VendorName::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::VendorName::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is vendor_id + case MN::VendorID::Id: { + using T = MN::VendorID::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"VendorID attribute value is %s",unify_value.dump().c_str() ); + UN::VendorID::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::VendorID::Id, + ZCL_VENDOR_ID_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::ProductName::Id: { + using T = MN::ProductName::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ProductName attribute value is %s",unify_value.dump().c_str() ); + UN::ProductName::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::ProductName::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::NodeLabel::Id: { + using T = MN::NodeLabel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NodeLabel attribute value is %s",unify_value.dump().c_str() ); + UN::NodeLabel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::NodeLabel::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::HardwareVersion::Id: { + using T = MN::HardwareVersion::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"HardwareVersion attribute value is %s",unify_value.dump().c_str() ); + UN::HardwareVersion::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::HardwareVersion::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::HardwareVersionString::Id: { + using T = MN::HardwareVersionString::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"HardwareVersionString attribute value is %s",unify_value.dump().c_str() ); + UN::HardwareVersionString::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::HardwareVersionString::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::SoftwareVersion::Id: { + using T = MN::SoftwareVersion::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SoftwareVersion attribute value is %s",unify_value.dump().c_str() ); + UN::SoftwareVersion::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::SoftwareVersion::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::SoftwareVersionString::Id: { + using T = MN::SoftwareVersionString::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SoftwareVersionString attribute value is %s",unify_value.dump().c_str() ); + UN::SoftwareVersionString::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::SoftwareVersionString::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::ManufacturingDate::Id: { + using T = MN::ManufacturingDate::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ManufacturingDate attribute value is %s",unify_value.dump().c_str() ); + UN::ManufacturingDate::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::ManufacturingDate::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::PartNumber::Id: { + using T = MN::PartNumber::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PartNumber attribute value is %s",unify_value.dump().c_str() ); + UN::PartNumber::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::PartNumber::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is long_char_string + case MN::ProductURL::Id: { + using T = MN::ProductURL::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ProductURL attribute value is %s",unify_value.dump().c_str() ); + UN::ProductURL::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::ProductURL::Id, + ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::ProductLabel::Id: { + using T = MN::ProductLabel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ProductLabel attribute value is %s",unify_value.dump().c_str() ); + UN::ProductLabel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::ProductLabel::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::SerialNumber::Id: { + using T = MN::SerialNumber::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SerialNumber attribute value is %s",unify_value.dump().c_str() ); + UN::SerialNumber::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::SerialNumber::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::Reachable::Id: { + using T = MN::Reachable::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Reachable attribute value is %s",unify_value.dump().c_str() ); + UN::Reachable::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::Reachable::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::UniqueID::Id: { + using T = MN::UniqueID::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UniqueID attribute value is %s",unify_value.dump().c_str() ); + UN::UniqueID::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::UniqueID::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BridgedDeviceBasic::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +SwitchAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::Switch::Attributes; + namespace UN = unify::matter_bridge::Switch::Attributes; + if (aPath.mClusterId != Clusters::Switch::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::NumberOfPositions::Id: { // type is int8u + MN::NumberOfPositions::TypeInfo::Type value; + UN::NumberOfPositions::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentPosition::Id: { // type is int8u + MN::CurrentPosition::TypeInfo::Type value; + UN::CurrentPosition::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MultiPressMax::Id: { // type is int8u + MN::MultiPressMax::TypeInfo::Type value; + UN::MultiPressMax::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR SwitchAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::Switch; + + if (aPath.mClusterId != Clusters::Switch::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/Switch/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void SwitchAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::Switch::Attributes; + namespace UN = unify::matter_bridge::Switch::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::Switch::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::Switch::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int8u + case MN::NumberOfPositions::Id: { + using T = MN::NumberOfPositions::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfPositions attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfPositions::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Switch::Id, + MN::NumberOfPositions::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::CurrentPosition::Id: { + using T = MN::CurrentPosition::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentPosition attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentPosition::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Switch::Id, + MN::CurrentPosition::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::MultiPressMax::Id: { + using T = MN::MultiPressMax::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MultiPressMax attribute value is %s",unify_value.dump().c_str() ); + UN::MultiPressMax::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Switch::Id, + MN::MultiPressMax::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Switch::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Switch::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +AdministratorCommissioningAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::AdministratorCommissioning::Attributes; + namespace UN = unify::matter_bridge::AdministratorCommissioning::Attributes; + if (aPath.mClusterId != Clusters::AdministratorCommissioning::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::WindowStatus::Id: { // type is CommissioningWindowStatus + MN::WindowStatus::TypeInfo::Type value; + UN::WindowStatus::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AdminFabricIndex::Id: { // type is fabric_idx + MN::AdminFabricIndex::TypeInfo::Type value; + UN::AdminFabricIndex::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AdminVendorId::Id: { // type is int16u + MN::AdminVendorId::TypeInfo::Type value; + UN::AdminVendorId::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR AdministratorCommissioningAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::AdministratorCommissioning; + + if (aPath.mClusterId != Clusters::AdministratorCommissioning::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/AdministratorCommissioning/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void AdministratorCommissioningAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::AdministratorCommissioning::Attributes; + namespace UN = unify::matter_bridge::AdministratorCommissioning::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::AdministratorCommissioning::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::AdministratorCommissioning::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is CommissioningWindowStatus + case MN::WindowStatus::Id: { + using T = MN::WindowStatus::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WindowStatus attribute value is %s",unify_value.dump().c_str() ); + UN::WindowStatus::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AdministratorCommissioning::Id, + MN::WindowStatus::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is fabric_idx + case MN::AdminFabricIndex::Id: { + using T = MN::AdminFabricIndex::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AdminFabricIndex attribute value is %s",unify_value.dump().c_str() ); + UN::AdminFabricIndex::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AdministratorCommissioning::Id, + MN::AdminFabricIndex::Id, + ZCL_FABRIC_IDX_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AdminVendorId::Id: { + using T = MN::AdminVendorId::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AdminVendorId attribute value is %s",unify_value.dump().c_str() ); + UN::AdminVendorId::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AdministratorCommissioning::Id, + MN::AdminVendorId::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AdministratorCommissioning::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AdministratorCommissioning::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +OperationalCredentialsAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::OperationalCredentials::Attributes; + namespace UN = unify::matter_bridge::OperationalCredentials::Attributes; + if (aPath.mClusterId != Clusters::OperationalCredentials::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + case MN::SupportedFabrics::Id: { // type is int8u + MN::SupportedFabrics::TypeInfo::Type value; + UN::SupportedFabrics::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CommissionedFabrics::Id: { // type is int8u + MN::CommissionedFabrics::TypeInfo::Type value; + UN::CommissionedFabrics::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::CurrentFabricIndex::Id: { // type is int8u + MN::CurrentFabricIndex::TypeInfo::Type value; + UN::CurrentFabricIndex::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR OperationalCredentialsAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::OperationalCredentials; + + if (aPath.mClusterId != Clusters::OperationalCredentials::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/OperationalCredentials/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void OperationalCredentialsAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::OperationalCredentials::Attributes; + namespace UN = unify::matter_bridge::OperationalCredentials::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::OperationalCredentials::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::OperationalCredentials::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int8u + case MN::SupportedFabrics::Id: { + using T = MN::SupportedFabrics::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SupportedFabrics attribute value is %s",unify_value.dump().c_str() ); + UN::SupportedFabrics::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OperationalCredentials::Id, + MN::SupportedFabrics::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::CommissionedFabrics::Id: { + using T = MN::CommissionedFabrics::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CommissionedFabrics attribute value is %s",unify_value.dump().c_str() ); + UN::CommissionedFabrics::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OperationalCredentials::Id, + MN::CommissionedFabrics::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::CurrentFabricIndex::Id: { + using T = MN::CurrentFabricIndex::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentFabricIndex attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentFabricIndex::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OperationalCredentials::Id, + MN::CurrentFabricIndex::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OperationalCredentials::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OperationalCredentials::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +GroupKeyManagementAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::GroupKeyManagement::Attributes; + namespace UN = unify::matter_bridge::GroupKeyManagement::Attributes; + if (aPath.mClusterId != Clusters::GroupKeyManagement::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + case MN::MaxGroupsPerFabric::Id: { // type is int16u + MN::MaxGroupsPerFabric::TypeInfo::Type value; + UN::MaxGroupsPerFabric::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxGroupKeysPerFabric::Id: { // type is int16u + MN::MaxGroupKeysPerFabric::TypeInfo::Type value; + UN::MaxGroupKeysPerFabric::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR GroupKeyManagementAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::GroupKeyManagement; + + if (aPath.mClusterId != Clusters::GroupKeyManagement::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/GroupKeyManagement/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void GroupKeyManagementAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::GroupKeyManagement::Attributes; + namespace UN = unify::matter_bridge::GroupKeyManagement::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::GroupKeyManagement::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::GroupKeyManagement::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16u + case MN::MaxGroupsPerFabric::Id: { + using T = MN::MaxGroupsPerFabric::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxGroupsPerFabric attribute value is %s",unify_value.dump().c_str() ); + UN::MaxGroupsPerFabric::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GroupKeyManagement::Id, + MN::MaxGroupsPerFabric::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MaxGroupKeysPerFabric::Id: { + using T = MN::MaxGroupKeysPerFabric::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxGroupKeysPerFabric attribute value is %s",unify_value.dump().c_str() ); + UN::MaxGroupKeysPerFabric::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GroupKeyManagement::Id, + MN::MaxGroupKeysPerFabric::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GroupKeyManagement::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::GroupKeyManagement::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +FixedLabelAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::FixedLabel::Attributes; + namespace UN = unify::matter_bridge::FixedLabel::Attributes; + if (aPath.mClusterId != Clusters::FixedLabel::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR FixedLabelAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::FixedLabel; + + if (aPath.mClusterId != Clusters::FixedLabel::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/FixedLabel/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void FixedLabelAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::FixedLabel::Attributes; + namespace UN = unify::matter_bridge::FixedLabel::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::FixedLabel::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::FixedLabel::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FixedLabel::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FixedLabel::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +UserLabelAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::UserLabel::Attributes; + namespace UN = unify::matter_bridge::UserLabel::Attributes; + if (aPath.mClusterId != Clusters::UserLabel::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR UserLabelAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::UserLabel; + + if (aPath.mClusterId != Clusters::UserLabel::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/UserLabel/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void UserLabelAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::UserLabel::Attributes; + namespace UN = unify::matter_bridge::UserLabel::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::UserLabel::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::UserLabel::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::UserLabel::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::UserLabel::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ProxyConfigurationAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::ProxyConfiguration::Attributes; + namespace UN = unify::matter_bridge::ProxyConfiguration::Attributes; + if (aPath.mClusterId != Clusters::ProxyConfiguration::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ProxyConfigurationAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::ProxyConfiguration; + + if (aPath.mClusterId != Clusters::ProxyConfiguration::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/ProxyConfiguration/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ProxyConfigurationAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::ProxyConfiguration::Attributes; + namespace UN = unify::matter_bridge::ProxyConfiguration::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::ProxyConfiguration::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::ProxyConfiguration::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ProxyConfiguration::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ProxyConfiguration::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ProxyDiscoveryAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::ProxyDiscovery::Attributes; + namespace UN = unify::matter_bridge::ProxyDiscovery::Attributes; + if (aPath.mClusterId != Clusters::ProxyDiscovery::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ProxyDiscoveryAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::ProxyDiscovery; + + if (aPath.mClusterId != Clusters::ProxyDiscovery::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/ProxyDiscovery/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ProxyDiscoveryAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::ProxyDiscovery::Attributes; + namespace UN = unify::matter_bridge::ProxyDiscovery::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::ProxyDiscovery::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::ProxyDiscovery::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ProxyDiscovery::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ProxyDiscovery::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ProxyValidAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::ProxyValid::Attributes; + namespace UN = unify::matter_bridge::ProxyValid::Attributes; + if (aPath.mClusterId != Clusters::ProxyValid::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ProxyValidAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::ProxyValid; + + if (aPath.mClusterId != Clusters::ProxyValid::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/ProxyValid/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ProxyValidAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::ProxyValid::Attributes; + namespace UN = unify::matter_bridge::ProxyValid::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::ProxyValid::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::ProxyValid::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ProxyValid::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ProxyValid::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +BooleanStateAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::BooleanState::Attributes; + namespace UN = unify::matter_bridge::BooleanState::Attributes; + if (aPath.mClusterId != Clusters::BooleanState::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::StateValue::Id: { // type is boolean + MN::StateValue::TypeInfo::Type value; + UN::StateValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR BooleanStateAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::BooleanState; + + if (aPath.mClusterId != Clusters::BooleanState::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/BooleanState/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void BooleanStateAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::BooleanState::Attributes; + namespace UN = unify::matter_bridge::BooleanState::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::BooleanState::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::BooleanState::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is boolean + case MN::StateValue::Id: { + using T = MN::StateValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"StateValue attribute value is %s",unify_value.dump().c_str() ); + UN::StateValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BooleanState::Id, + MN::StateValue::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BooleanState::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BooleanState::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ModeSelectAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::ModeSelect::Attributes; + namespace UN = unify::matter_bridge::ModeSelect::Attributes; + if (aPath.mClusterId != Clusters::ModeSelect::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::Description::Id: { // type is char_string + MN::Description::TypeInfo::Type value; + UN::Description::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::StandardNamespace::Id: { // type is enum16 + MN::StandardNamespace::TypeInfo::Type value; + UN::StandardNamespace::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::CurrentMode::Id: { // type is int8u + MN::CurrentMode::TypeInfo::Type value; + UN::CurrentMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::StartUpMode::Id: { // type is int8u + MN::StartUpMode::TypeInfo::Type value; + UN::StartUpMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OnMode::Id: { // type is int8u + MN::OnMode::TypeInfo::Type value; + UN::OnMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ModeSelectAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::ModeSelect; + + if (aPath.mClusterId != Clusters::ModeSelect::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/ModeSelect/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ModeSelectAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::ModeSelect::Attributes; + namespace UN = unify::matter_bridge::ModeSelect::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::ModeSelect::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::ModeSelect::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is char_string + case MN::Description::Id: { + using T = MN::Description::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Description attribute value is %s",unify_value.dump().c_str() ); + UN::Description::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ModeSelect::Id, + MN::Description::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum16 + case MN::StandardNamespace::Id: { + using T = MN::StandardNamespace::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"StandardNamespace attribute value is %s",unify_value.dump().c_str() ); + UN::StandardNamespace::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ModeSelect::Id, + MN::StandardNamespace::Id, + ZCL_ENUM16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::CurrentMode::Id: { + using T = MN::CurrentMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentMode attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ModeSelect::Id, + MN::CurrentMode::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::StartUpMode::Id: { + using T = MN::StartUpMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"StartUpMode attribute value is %s",unify_value.dump().c_str() ); + UN::StartUpMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ModeSelect::Id, + MN::StartUpMode::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::OnMode::Id: { + using T = MN::OnMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OnMode attribute value is %s",unify_value.dump().c_str() ); + UN::OnMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ModeSelect::Id, + MN::OnMode::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ModeSelect::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ModeSelect::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +DoorLockAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::DoorLock::Attributes; + namespace UN = unify::matter_bridge::DoorLock::Attributes; + if (aPath.mClusterId != Clusters::DoorLock::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::LockState::Id: { // type is DlLockState + MN::LockState::TypeInfo::Type value; + UN::LockState::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LockType::Id: { // type is DlLockType + MN::LockType::TypeInfo::Type value; + UN::LockType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActuatorEnabled::Id: { // type is boolean + MN::ActuatorEnabled::TypeInfo::Type value; + UN::ActuatorEnabled::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DoorState::Id: { // type is DlDoorState + MN::DoorState::TypeInfo::Type value; + UN::DoorState::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DoorOpenEvents::Id: { // type is int32u + MN::DoorOpenEvents::TypeInfo::Type value; + UN::DoorOpenEvents::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DoorClosedEvents::Id: { // type is int32u + MN::DoorClosedEvents::TypeInfo::Type value; + UN::DoorClosedEvents::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OpenPeriod::Id: { // type is int16u + MN::OpenPeriod::TypeInfo::Type value; + UN::OpenPeriod::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfTotalUsersSupported::Id: { // type is int16u + MN::NumberOfTotalUsersSupported::TypeInfo::Type value; + UN::NumberOfTotalUsersSupported::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfPINUsersSupported::Id: { // type is int16u + MN::NumberOfPINUsersSupported::TypeInfo::Type value; + UN::NumberOfPINUsersSupported::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfRFIDUsersSupported::Id: { // type is int16u + MN::NumberOfRFIDUsersSupported::TypeInfo::Type value; + UN::NumberOfRFIDUsersSupported::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfWeekDaySchedulesSupportedPerUser::Id: { // type is int8u + MN::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo::Type value; + UN::NumberOfWeekDaySchedulesSupportedPerUser::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfYearDaySchedulesSupportedPerUser::Id: { // type is int8u + MN::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo::Type value; + UN::NumberOfYearDaySchedulesSupportedPerUser::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfHolidaySchedulesSupported::Id: { // type is int8u + MN::NumberOfHolidaySchedulesSupported::TypeInfo::Type value; + UN::NumberOfHolidaySchedulesSupported::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxPINCodeLength::Id: { // type is int8u + MN::MaxPINCodeLength::TypeInfo::Type value; + UN::MaxPINCodeLength::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinPINCodeLength::Id: { // type is int8u + MN::MinPINCodeLength::TypeInfo::Type value; + UN::MinPINCodeLength::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxRFIDCodeLength::Id: { // type is int8u + MN::MaxRFIDCodeLength::TypeInfo::Type value; + UN::MaxRFIDCodeLength::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinRFIDCodeLength::Id: { // type is int8u + MN::MinRFIDCodeLength::TypeInfo::Type value; + UN::MinRFIDCodeLength::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CredentialRulesSupport::Id: { // type is DlCredentialRuleMask + MN::CredentialRulesSupport::TypeInfo::Type value; + UN::CredentialRulesSupport::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfCredentialsSupportedPerUser::Id: { // type is int8u + MN::NumberOfCredentialsSupportedPerUser::TypeInfo::Type value; + UN::NumberOfCredentialsSupportedPerUser::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Language::Id: { // type is char_string + MN::Language::TypeInfo::Type value; + UN::Language::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LEDSettings::Id: { // type is int8u + MN::LEDSettings::TypeInfo::Type value; + UN::LEDSettings::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AutoRelockTime::Id: { // type is int32u + MN::AutoRelockTime::TypeInfo::Type value; + UN::AutoRelockTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SoundVolume::Id: { // type is int8u + MN::SoundVolume::TypeInfo::Type value; + UN::SoundVolume::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OperatingMode::Id: { // type is DlOperatingMode + MN::OperatingMode::TypeInfo::Type value; + UN::OperatingMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SupportedOperatingModes::Id: { // type is DlSupportedOperatingModes + MN::SupportedOperatingModes::TypeInfo::Type value; + UN::SupportedOperatingModes::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DefaultConfigurationRegister::Id: { // type is DlDefaultConfigurationRegister + MN::DefaultConfigurationRegister::TypeInfo::Type value; + UN::DefaultConfigurationRegister::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EnableLocalProgramming::Id: { // type is boolean + MN::EnableLocalProgramming::TypeInfo::Type value; + UN::EnableLocalProgramming::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EnableOneTouchLocking::Id: { // type is boolean + MN::EnableOneTouchLocking::TypeInfo::Type value; + UN::EnableOneTouchLocking::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EnableInsideStatusLED::Id: { // type is boolean + MN::EnableInsideStatusLED::TypeInfo::Type value; + UN::EnableInsideStatusLED::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EnablePrivacyModeButton::Id: { // type is boolean + MN::EnablePrivacyModeButton::TypeInfo::Type value; + UN::EnablePrivacyModeButton::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LocalProgrammingFeatures::Id: { // type is DlLocalProgrammingFeatures + MN::LocalProgrammingFeatures::TypeInfo::Type value; + UN::LocalProgrammingFeatures::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WrongCodeEntryLimit::Id: { // type is int8u + MN::WrongCodeEntryLimit::TypeInfo::Type value; + UN::WrongCodeEntryLimit::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UserCodeTemporaryDisableTime::Id: { // type is int8u + MN::UserCodeTemporaryDisableTime::TypeInfo::Type value; + UN::UserCodeTemporaryDisableTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SendPINOverTheAir::Id: { // type is boolean + MN::SendPINOverTheAir::TypeInfo::Type value; + UN::SendPINOverTheAir::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RequirePINforRemoteOperation::Id: { // type is boolean + MN::RequirePINforRemoteOperation::TypeInfo::Type value; + UN::RequirePINforRemoteOperation::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ExpiringUserTimeout::Id: { // type is int16u + MN::ExpiringUserTimeout::TypeInfo::Type value; + UN::ExpiringUserTimeout::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR DoorLockAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::DoorLock; + + if (aPath.mClusterId != Clusters::DoorLock::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/DoorLock/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void DoorLockAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::DoorLock::Attributes; + namespace UN = unify::matter_bridge::DoorLock::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::DoorLock::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::DoorLock::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is DlLockState + case MN::LockState::Id: { + using T = MN::LockState::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LockState attribute value is %s",unify_value.dump().c_str() ); + UN::LockState::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::LockState::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is DlLockType + case MN::LockType::Id: { + using T = MN::LockType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LockType attribute value is %s",unify_value.dump().c_str() ); + UN::LockType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::LockType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::ActuatorEnabled::Id: { + using T = MN::ActuatorEnabled::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActuatorEnabled attribute value is %s",unify_value.dump().c_str() ); + UN::ActuatorEnabled::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::ActuatorEnabled::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is DlDoorState + case MN::DoorState::Id: { + using T = MN::DoorState::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DoorState attribute value is %s",unify_value.dump().c_str() ); + UN::DoorState::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::DoorState::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::DoorOpenEvents::Id: { + using T = MN::DoorOpenEvents::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DoorOpenEvents attribute value is %s",unify_value.dump().c_str() ); + UN::DoorOpenEvents::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::DoorOpenEvents::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::DoorClosedEvents::Id: { + using T = MN::DoorClosedEvents::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DoorClosedEvents attribute value is %s",unify_value.dump().c_str() ); + UN::DoorClosedEvents::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::DoorClosedEvents::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::OpenPeriod::Id: { + using T = MN::OpenPeriod::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OpenPeriod attribute value is %s",unify_value.dump().c_str() ); + UN::OpenPeriod::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::OpenPeriod::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::NumberOfTotalUsersSupported::Id: { + using T = MN::NumberOfTotalUsersSupported::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfTotalUsersSupported attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfTotalUsersSupported::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::NumberOfTotalUsersSupported::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::NumberOfPINUsersSupported::Id: { + using T = MN::NumberOfPINUsersSupported::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfPINUsersSupported attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfPINUsersSupported::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::NumberOfPINUsersSupported::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::NumberOfRFIDUsersSupported::Id: { + using T = MN::NumberOfRFIDUsersSupported::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfRFIDUsersSupported attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfRFIDUsersSupported::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::NumberOfRFIDUsersSupported::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::NumberOfWeekDaySchedulesSupportedPerUser::Id: { + using T = MN::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfWeekDaySchedulesSupportedPerUser attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfWeekDaySchedulesSupportedPerUser::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::NumberOfWeekDaySchedulesSupportedPerUser::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::NumberOfYearDaySchedulesSupportedPerUser::Id: { + using T = MN::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfYearDaySchedulesSupportedPerUser attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfYearDaySchedulesSupportedPerUser::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::NumberOfYearDaySchedulesSupportedPerUser::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::NumberOfHolidaySchedulesSupported::Id: { + using T = MN::NumberOfHolidaySchedulesSupported::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfHolidaySchedulesSupported attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfHolidaySchedulesSupported::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::NumberOfHolidaySchedulesSupported::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::MaxPINCodeLength::Id: { + using T = MN::MaxPINCodeLength::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxPINCodeLength attribute value is %s",unify_value.dump().c_str() ); + UN::MaxPINCodeLength::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::MaxPINCodeLength::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::MinPINCodeLength::Id: { + using T = MN::MinPINCodeLength::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinPINCodeLength attribute value is %s",unify_value.dump().c_str() ); + UN::MinPINCodeLength::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::MinPINCodeLength::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::MaxRFIDCodeLength::Id: { + using T = MN::MaxRFIDCodeLength::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxRFIDCodeLength attribute value is %s",unify_value.dump().c_str() ); + UN::MaxRFIDCodeLength::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::MaxRFIDCodeLength::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::MinRFIDCodeLength::Id: { + using T = MN::MinRFIDCodeLength::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinRFIDCodeLength attribute value is %s",unify_value.dump().c_str() ); + UN::MinRFIDCodeLength::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::MinRFIDCodeLength::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is DlCredentialRuleMask + case MN::CredentialRulesSupport::Id: { + using T = MN::CredentialRulesSupport::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CredentialRulesSupport attribute value is %s",unify_value.dump().c_str() ); + UN::CredentialRulesSupport::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::CredentialRulesSupport::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::NumberOfCredentialsSupportedPerUser::Id: { + using T = MN::NumberOfCredentialsSupportedPerUser::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfCredentialsSupportedPerUser attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfCredentialsSupportedPerUser::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::NumberOfCredentialsSupportedPerUser::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::Language::Id: { + using T = MN::Language::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Language attribute value is %s",unify_value.dump().c_str() ); + UN::Language::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::Language::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::LEDSettings::Id: { + using T = MN::LEDSettings::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LEDSettings attribute value is %s",unify_value.dump().c_str() ); + UN::LEDSettings::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::LEDSettings::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::AutoRelockTime::Id: { + using T = MN::AutoRelockTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AutoRelockTime attribute value is %s",unify_value.dump().c_str() ); + UN::AutoRelockTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::AutoRelockTime::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::SoundVolume::Id: { + using T = MN::SoundVolume::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SoundVolume attribute value is %s",unify_value.dump().c_str() ); + UN::SoundVolume::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::SoundVolume::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is DlOperatingMode + case MN::OperatingMode::Id: { + using T = MN::OperatingMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OperatingMode attribute value is %s",unify_value.dump().c_str() ); + UN::OperatingMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::OperatingMode::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is DlSupportedOperatingModes + case MN::SupportedOperatingModes::Id: { + using T = MN::SupportedOperatingModes::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SupportedOperatingModes attribute value is %s",unify_value.dump().c_str() ); + UN::SupportedOperatingModes::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::SupportedOperatingModes::Id, + ZCL_BITMAP16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is DlDefaultConfigurationRegister + case MN::DefaultConfigurationRegister::Id: { + using T = MN::DefaultConfigurationRegister::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DefaultConfigurationRegister attribute value is %s",unify_value.dump().c_str() ); + UN::DefaultConfigurationRegister::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::DefaultConfigurationRegister::Id, + ZCL_BITMAP16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::EnableLocalProgramming::Id: { + using T = MN::EnableLocalProgramming::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EnableLocalProgramming attribute value is %s",unify_value.dump().c_str() ); + UN::EnableLocalProgramming::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::EnableLocalProgramming::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::EnableOneTouchLocking::Id: { + using T = MN::EnableOneTouchLocking::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EnableOneTouchLocking attribute value is %s",unify_value.dump().c_str() ); + UN::EnableOneTouchLocking::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::EnableOneTouchLocking::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::EnableInsideStatusLED::Id: { + using T = MN::EnableInsideStatusLED::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EnableInsideStatusLED attribute value is %s",unify_value.dump().c_str() ); + UN::EnableInsideStatusLED::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::EnableInsideStatusLED::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::EnablePrivacyModeButton::Id: { + using T = MN::EnablePrivacyModeButton::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EnablePrivacyModeButton attribute value is %s",unify_value.dump().c_str() ); + UN::EnablePrivacyModeButton::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::EnablePrivacyModeButton::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is DlLocalProgrammingFeatures + case MN::LocalProgrammingFeatures::Id: { + using T = MN::LocalProgrammingFeatures::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LocalProgrammingFeatures attribute value is %s",unify_value.dump().c_str() ); + UN::LocalProgrammingFeatures::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::LocalProgrammingFeatures::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::WrongCodeEntryLimit::Id: { + using T = MN::WrongCodeEntryLimit::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WrongCodeEntryLimit attribute value is %s",unify_value.dump().c_str() ); + UN::WrongCodeEntryLimit::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::WrongCodeEntryLimit::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::UserCodeTemporaryDisableTime::Id: { + using T = MN::UserCodeTemporaryDisableTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UserCodeTemporaryDisableTime attribute value is %s",unify_value.dump().c_str() ); + UN::UserCodeTemporaryDisableTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::UserCodeTemporaryDisableTime::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::SendPINOverTheAir::Id: { + using T = MN::SendPINOverTheAir::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SendPINOverTheAir attribute value is %s",unify_value.dump().c_str() ); + UN::SendPINOverTheAir::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::SendPINOverTheAir::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::RequirePINforRemoteOperation::Id: { + using T = MN::RequirePINforRemoteOperation::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RequirePINforRemoteOperation attribute value is %s",unify_value.dump().c_str() ); + UN::RequirePINforRemoteOperation::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::RequirePINforRemoteOperation::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ExpiringUserTimeout::Id: { + using T = MN::ExpiringUserTimeout::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ExpiringUserTimeout attribute value is %s",unify_value.dump().c_str() ); + UN::ExpiringUserTimeout::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::ExpiringUserTimeout::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::DoorLock::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +WindowCoveringAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::WindowCovering::Attributes; + namespace UN = unify::matter_bridge::WindowCovering::Attributes; + if (aPath.mClusterId != Clusters::WindowCovering::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::Type::Id: { // type is Type + MN::Type::TypeInfo::Type value; + UN::Type::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PhysicalClosedLimitLift::Id: { // type is int16u + MN::PhysicalClosedLimitLift::TypeInfo::Type value; + UN::PhysicalClosedLimitLift::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PhysicalClosedLimitTilt::Id: { // type is int16u + MN::PhysicalClosedLimitTilt::TypeInfo::Type value; + UN::PhysicalClosedLimitTilt::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentPositionLift::Id: { // type is int16u + MN::CurrentPositionLift::TypeInfo::Type value; + UN::CurrentPositionLift::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentPositionTilt::Id: { // type is int16u + MN::CurrentPositionTilt::TypeInfo::Type value; + UN::CurrentPositionTilt::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfActuationsLift::Id: { // type is int16u + MN::NumberOfActuationsLift::TypeInfo::Type value; + UN::NumberOfActuationsLift::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfActuationsTilt::Id: { // type is int16u + MN::NumberOfActuationsTilt::TypeInfo::Type value; + UN::NumberOfActuationsTilt::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ConfigStatus::Id: { // type is ConfigStatus + MN::ConfigStatus::TypeInfo::Type value; + UN::ConfigStatus::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentPositionLiftPercentage::Id: { // type is Percent + MN::CurrentPositionLiftPercentage::TypeInfo::Type value; + UN::CurrentPositionLiftPercentage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentPositionTiltPercentage::Id: { // type is Percent + MN::CurrentPositionTiltPercentage::TypeInfo::Type value; + UN::CurrentPositionTiltPercentage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OperationalStatus::Id: { // type is OperationalStatus + MN::OperationalStatus::TypeInfo::Type value; + UN::OperationalStatus::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TargetPositionLiftPercent100ths::Id: { // type is Percent100ths + MN::TargetPositionLiftPercent100ths::TypeInfo::Type value; + UN::TargetPositionLiftPercent100ths::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TargetPositionTiltPercent100ths::Id: { // type is Percent100ths + MN::TargetPositionTiltPercent100ths::TypeInfo::Type value; + UN::TargetPositionTiltPercent100ths::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EndProductType::Id: { // type is EndProductType + MN::EndProductType::TypeInfo::Type value; + UN::EndProductType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentPositionLiftPercent100ths::Id: { // type is Percent100ths + MN::CurrentPositionLiftPercent100ths::TypeInfo::Type value; + UN::CurrentPositionLiftPercent100ths::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentPositionTiltPercent100ths::Id: { // type is Percent100ths + MN::CurrentPositionTiltPercent100ths::TypeInfo::Type value; + UN::CurrentPositionTiltPercent100ths::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::InstalledOpenLimitLift::Id: { // type is int16u + MN::InstalledOpenLimitLift::TypeInfo::Type value; + UN::InstalledOpenLimitLift::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::InstalledClosedLimitLift::Id: { // type is int16u + MN::InstalledClosedLimitLift::TypeInfo::Type value; + UN::InstalledClosedLimitLift::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::InstalledOpenLimitTilt::Id: { // type is int16u + MN::InstalledOpenLimitTilt::TypeInfo::Type value; + UN::InstalledOpenLimitTilt::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::InstalledClosedLimitTilt::Id: { // type is int16u + MN::InstalledClosedLimitTilt::TypeInfo::Type value; + UN::InstalledClosedLimitTilt::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Mode::Id: { // type is Mode + MN::Mode::TypeInfo::Type value; + UN::Mode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SafetyStatus::Id: { // type is SafetyStatus + MN::SafetyStatus::TypeInfo::Type value; + UN::SafetyStatus::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR WindowCoveringAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::WindowCovering; + + if (aPath.mClusterId != Clusters::WindowCovering::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/WindowCovering/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void WindowCoveringAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::WindowCovering::Attributes; + namespace UN = unify::matter_bridge::WindowCovering::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::WindowCovering::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::WindowCovering::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is Type + case MN::Type::Id: { + using T = MN::Type::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Type attribute value is %s",unify_value.dump().c_str() ); + UN::Type::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::Type::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::PhysicalClosedLimitLift::Id: { + using T = MN::PhysicalClosedLimitLift::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PhysicalClosedLimitLift attribute value is %s",unify_value.dump().c_str() ); + UN::PhysicalClosedLimitLift::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::PhysicalClosedLimitLift::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::PhysicalClosedLimitTilt::Id: { + using T = MN::PhysicalClosedLimitTilt::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PhysicalClosedLimitTilt attribute value is %s",unify_value.dump().c_str() ); + UN::PhysicalClosedLimitTilt::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::PhysicalClosedLimitTilt::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::CurrentPositionLift::Id: { + using T = MN::CurrentPositionLift::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentPositionLift attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentPositionLift::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::CurrentPositionLift::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::CurrentPositionTilt::Id: { + using T = MN::CurrentPositionTilt::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentPositionTilt attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentPositionTilt::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::CurrentPositionTilt::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::NumberOfActuationsLift::Id: { + using T = MN::NumberOfActuationsLift::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfActuationsLift attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfActuationsLift::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::NumberOfActuationsLift::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::NumberOfActuationsTilt::Id: { + using T = MN::NumberOfActuationsTilt::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfActuationsTilt attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfActuationsTilt::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::NumberOfActuationsTilt::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is ConfigStatus + case MN::ConfigStatus::Id: { + using T = MN::ConfigStatus::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ConfigStatus attribute value is %s",unify_value.dump().c_str() ); + UN::ConfigStatus::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::ConfigStatus::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Percent + case MN::CurrentPositionLiftPercentage::Id: { + using T = MN::CurrentPositionLiftPercentage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentPositionLiftPercentage attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentPositionLiftPercentage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::CurrentPositionLiftPercentage::Id, + ZCL_PERCENT_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Percent + case MN::CurrentPositionTiltPercentage::Id: { + using T = MN::CurrentPositionTiltPercentage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentPositionTiltPercentage attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentPositionTiltPercentage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::CurrentPositionTiltPercentage::Id, + ZCL_PERCENT_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is OperationalStatus + case MN::OperationalStatus::Id: { + using T = MN::OperationalStatus::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OperationalStatus attribute value is %s",unify_value.dump().c_str() ); + UN::OperationalStatus::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::OperationalStatus::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Percent100ths + case MN::TargetPositionLiftPercent100ths::Id: { + using T = MN::TargetPositionLiftPercent100ths::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TargetPositionLiftPercent100ths attribute value is %s",unify_value.dump().c_str() ); + UN::TargetPositionLiftPercent100ths::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::TargetPositionLiftPercent100ths::Id, + ZCL_PERCENT100THS_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Percent100ths + case MN::TargetPositionTiltPercent100ths::Id: { + using T = MN::TargetPositionTiltPercent100ths::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TargetPositionTiltPercent100ths attribute value is %s",unify_value.dump().c_str() ); + UN::TargetPositionTiltPercent100ths::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::TargetPositionTiltPercent100ths::Id, + ZCL_PERCENT100THS_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is EndProductType + case MN::EndProductType::Id: { + using T = MN::EndProductType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EndProductType attribute value is %s",unify_value.dump().c_str() ); + UN::EndProductType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::EndProductType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Percent100ths + case MN::CurrentPositionLiftPercent100ths::Id: { + using T = MN::CurrentPositionLiftPercent100ths::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentPositionLiftPercent100ths attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentPositionLiftPercent100ths::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::CurrentPositionLiftPercent100ths::Id, + ZCL_PERCENT100THS_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Percent100ths + case MN::CurrentPositionTiltPercent100ths::Id: { + using T = MN::CurrentPositionTiltPercent100ths::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentPositionTiltPercent100ths attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentPositionTiltPercent100ths::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::CurrentPositionTiltPercent100ths::Id, + ZCL_PERCENT100THS_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::InstalledOpenLimitLift::Id: { + using T = MN::InstalledOpenLimitLift::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"InstalledOpenLimitLift attribute value is %s",unify_value.dump().c_str() ); + UN::InstalledOpenLimitLift::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::InstalledOpenLimitLift::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::InstalledClosedLimitLift::Id: { + using T = MN::InstalledClosedLimitLift::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"InstalledClosedLimitLift attribute value is %s",unify_value.dump().c_str() ); + UN::InstalledClosedLimitLift::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::InstalledClosedLimitLift::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::InstalledOpenLimitTilt::Id: { + using T = MN::InstalledOpenLimitTilt::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"InstalledOpenLimitTilt attribute value is %s",unify_value.dump().c_str() ); + UN::InstalledOpenLimitTilt::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::InstalledOpenLimitTilt::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::InstalledClosedLimitTilt::Id: { + using T = MN::InstalledClosedLimitTilt::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"InstalledClosedLimitTilt attribute value is %s",unify_value.dump().c_str() ); + UN::InstalledClosedLimitTilt::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::InstalledClosedLimitTilt::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Mode + case MN::Mode::Id: { + using T = MN::Mode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Mode attribute value is %s",unify_value.dump().c_str() ); + UN::Mode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::Mode::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is SafetyStatus + case MN::SafetyStatus::Id: { + using T = MN::SafetyStatus::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SafetyStatus attribute value is %s",unify_value.dump().c_str() ); + UN::SafetyStatus::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::SafetyStatus::Id, + ZCL_BITMAP16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WindowCovering::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +BarrierControlAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::BarrierControl::Attributes; + namespace UN = unify::matter_bridge::BarrierControl::Attributes; + if (aPath.mClusterId != Clusters::BarrierControl::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::BarrierMovingState::Id: { // type is enum8 + MN::BarrierMovingState::TypeInfo::Type value; + UN::BarrierMovingState::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BarrierSafetyStatus::Id: { // type is bitmap16 + MN::BarrierSafetyStatus::TypeInfo::Type value; + UN::BarrierSafetyStatus::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BarrierCapabilities::Id: { // type is bitmap8 + MN::BarrierCapabilities::TypeInfo::Type value; + UN::BarrierCapabilities::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BarrierOpenEvents::Id: { // type is int16u + MN::BarrierOpenEvents::TypeInfo::Type value; + UN::BarrierOpenEvents::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BarrierCloseEvents::Id: { // type is int16u + MN::BarrierCloseEvents::TypeInfo::Type value; + UN::BarrierCloseEvents::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BarrierCommandOpenEvents::Id: { // type is int16u + MN::BarrierCommandOpenEvents::TypeInfo::Type value; + UN::BarrierCommandOpenEvents::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BarrierCommandCloseEvents::Id: { // type is int16u + MN::BarrierCommandCloseEvents::TypeInfo::Type value; + UN::BarrierCommandCloseEvents::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BarrierOpenPeriod::Id: { // type is int16u + MN::BarrierOpenPeriod::TypeInfo::Type value; + UN::BarrierOpenPeriod::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BarrierClosePeriod::Id: { // type is int16u + MN::BarrierClosePeriod::TypeInfo::Type value; + UN::BarrierClosePeriod::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BarrierPosition::Id: { // type is int8u + MN::BarrierPosition::TypeInfo::Type value; + UN::BarrierPosition::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR BarrierControlAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::BarrierControl; + + if (aPath.mClusterId != Clusters::BarrierControl::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/BarrierControl/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void BarrierControlAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::BarrierControl::Attributes; + namespace UN = unify::matter_bridge::BarrierControl::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::BarrierControl::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::BarrierControl::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is enum8 + case MN::BarrierMovingState::Id: { + using T = MN::BarrierMovingState::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BarrierMovingState attribute value is %s",unify_value.dump().c_str() ); + UN::BarrierMovingState::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::BarrierMovingState::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap16 + case MN::BarrierSafetyStatus::Id: { + using T = MN::BarrierSafetyStatus::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BarrierSafetyStatus attribute value is %s",unify_value.dump().c_str() ); + UN::BarrierSafetyStatus::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::BarrierSafetyStatus::Id, + ZCL_BITMAP16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::BarrierCapabilities::Id: { + using T = MN::BarrierCapabilities::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BarrierCapabilities attribute value is %s",unify_value.dump().c_str() ); + UN::BarrierCapabilities::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::BarrierCapabilities::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::BarrierOpenEvents::Id: { + using T = MN::BarrierOpenEvents::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BarrierOpenEvents attribute value is %s",unify_value.dump().c_str() ); + UN::BarrierOpenEvents::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::BarrierOpenEvents::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::BarrierCloseEvents::Id: { + using T = MN::BarrierCloseEvents::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BarrierCloseEvents attribute value is %s",unify_value.dump().c_str() ); + UN::BarrierCloseEvents::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::BarrierCloseEvents::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::BarrierCommandOpenEvents::Id: { + using T = MN::BarrierCommandOpenEvents::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BarrierCommandOpenEvents attribute value is %s",unify_value.dump().c_str() ); + UN::BarrierCommandOpenEvents::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::BarrierCommandOpenEvents::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::BarrierCommandCloseEvents::Id: { + using T = MN::BarrierCommandCloseEvents::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BarrierCommandCloseEvents attribute value is %s",unify_value.dump().c_str() ); + UN::BarrierCommandCloseEvents::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::BarrierCommandCloseEvents::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::BarrierOpenPeriod::Id: { + using T = MN::BarrierOpenPeriod::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BarrierOpenPeriod attribute value is %s",unify_value.dump().c_str() ); + UN::BarrierOpenPeriod::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::BarrierOpenPeriod::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::BarrierClosePeriod::Id: { + using T = MN::BarrierClosePeriod::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BarrierClosePeriod attribute value is %s",unify_value.dump().c_str() ); + UN::BarrierClosePeriod::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::BarrierClosePeriod::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::BarrierPosition::Id: { + using T = MN::BarrierPosition::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BarrierPosition attribute value is %s",unify_value.dump().c_str() ); + UN::BarrierPosition::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::BarrierPosition::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BarrierControl::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +PumpConfigurationAndControlAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::PumpConfigurationAndControl::Attributes; + namespace UN = unify::matter_bridge::PumpConfigurationAndControl::Attributes; + if (aPath.mClusterId != Clusters::PumpConfigurationAndControl::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::MaxPressure::Id: { // type is int16s + MN::MaxPressure::TypeInfo::Type value; + UN::MaxPressure::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxSpeed::Id: { // type is int16u + MN::MaxSpeed::TypeInfo::Type value; + UN::MaxSpeed::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxFlow::Id: { // type is int16u + MN::MaxFlow::TypeInfo::Type value; + UN::MaxFlow::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinConstPressure::Id: { // type is int16s + MN::MinConstPressure::TypeInfo::Type value; + UN::MinConstPressure::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxConstPressure::Id: { // type is int16s + MN::MaxConstPressure::TypeInfo::Type value; + UN::MaxConstPressure::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinCompPressure::Id: { // type is int16s + MN::MinCompPressure::TypeInfo::Type value; + UN::MinCompPressure::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxCompPressure::Id: { // type is int16s + MN::MaxCompPressure::TypeInfo::Type value; + UN::MaxCompPressure::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinConstSpeed::Id: { // type is int16u + MN::MinConstSpeed::TypeInfo::Type value; + UN::MinConstSpeed::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxConstSpeed::Id: { // type is int16u + MN::MaxConstSpeed::TypeInfo::Type value; + UN::MaxConstSpeed::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinConstFlow::Id: { // type is int16u + MN::MinConstFlow::TypeInfo::Type value; + UN::MinConstFlow::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxConstFlow::Id: { // type is int16u + MN::MaxConstFlow::TypeInfo::Type value; + UN::MaxConstFlow::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinConstTemp::Id: { // type is int16s + MN::MinConstTemp::TypeInfo::Type value; + UN::MinConstTemp::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxConstTemp::Id: { // type is int16s + MN::MaxConstTemp::TypeInfo::Type value; + UN::MaxConstTemp::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PumpStatus::Id: { // type is PumpStatus + MN::PumpStatus::TypeInfo::Type value; + UN::PumpStatus::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EffectiveOperationMode::Id: { // type is PumpOperationMode + MN::EffectiveOperationMode::TypeInfo::Type value; + UN::EffectiveOperationMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EffectiveControlMode::Id: { // type is PumpControlMode + MN::EffectiveControlMode::TypeInfo::Type value; + UN::EffectiveControlMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Capacity::Id: { // type is int16s + MN::Capacity::TypeInfo::Type value; + UN::Capacity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Speed::Id: { // type is int16u + MN::Speed::TypeInfo::Type value; + UN::Speed::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LifetimeRunningHours::Id: { // type is int24u + MN::LifetimeRunningHours::TypeInfo::Type value; + UN::LifetimeRunningHours::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Power::Id: { // type is int24u + MN::Power::TypeInfo::Type value; + UN::Power::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LifetimeEnergyConsumed::Id: { // type is int32u + MN::LifetimeEnergyConsumed::TypeInfo::Type value; + UN::LifetimeEnergyConsumed::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OperationMode::Id: { // type is PumpOperationMode + MN::OperationMode::TypeInfo::Type value; + UN::OperationMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ControlMode::Id: { // type is PumpControlMode + MN::ControlMode::TypeInfo::Type value; + UN::ControlMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR PumpConfigurationAndControlAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::PumpConfigurationAndControl; + + if (aPath.mClusterId != Clusters::PumpConfigurationAndControl::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/PumpConfigurationAndControl/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void PumpConfigurationAndControlAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::PumpConfigurationAndControl::Attributes; + namespace UN = unify::matter_bridge::PumpConfigurationAndControl::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::PumpConfigurationAndControl::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::PumpConfigurationAndControl::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16s + case MN::MaxPressure::Id: { + using T = MN::MaxPressure::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxPressure attribute value is %s",unify_value.dump().c_str() ); + UN::MaxPressure::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MaxPressure::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MaxSpeed::Id: { + using T = MN::MaxSpeed::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxSpeed attribute value is %s",unify_value.dump().c_str() ); + UN::MaxSpeed::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MaxSpeed::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MaxFlow::Id: { + using T = MN::MaxFlow::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxFlow attribute value is %s",unify_value.dump().c_str() ); + UN::MaxFlow::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MaxFlow::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MinConstPressure::Id: { + using T = MN::MinConstPressure::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinConstPressure attribute value is %s",unify_value.dump().c_str() ); + UN::MinConstPressure::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MinConstPressure::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MaxConstPressure::Id: { + using T = MN::MaxConstPressure::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxConstPressure attribute value is %s",unify_value.dump().c_str() ); + UN::MaxConstPressure::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MaxConstPressure::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MinCompPressure::Id: { + using T = MN::MinCompPressure::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinCompPressure attribute value is %s",unify_value.dump().c_str() ); + UN::MinCompPressure::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MinCompPressure::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MaxCompPressure::Id: { + using T = MN::MaxCompPressure::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxCompPressure attribute value is %s",unify_value.dump().c_str() ); + UN::MaxCompPressure::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MaxCompPressure::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MinConstSpeed::Id: { + using T = MN::MinConstSpeed::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinConstSpeed attribute value is %s",unify_value.dump().c_str() ); + UN::MinConstSpeed::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MinConstSpeed::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MaxConstSpeed::Id: { + using T = MN::MaxConstSpeed::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxConstSpeed attribute value is %s",unify_value.dump().c_str() ); + UN::MaxConstSpeed::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MaxConstSpeed::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MinConstFlow::Id: { + using T = MN::MinConstFlow::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinConstFlow attribute value is %s",unify_value.dump().c_str() ); + UN::MinConstFlow::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MinConstFlow::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MaxConstFlow::Id: { + using T = MN::MaxConstFlow::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxConstFlow attribute value is %s",unify_value.dump().c_str() ); + UN::MaxConstFlow::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MaxConstFlow::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MinConstTemp::Id: { + using T = MN::MinConstTemp::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinConstTemp attribute value is %s",unify_value.dump().c_str() ); + UN::MinConstTemp::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MinConstTemp::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MaxConstTemp::Id: { + using T = MN::MaxConstTemp::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxConstTemp attribute value is %s",unify_value.dump().c_str() ); + UN::MaxConstTemp::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::MaxConstTemp::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is PumpStatus + case MN::PumpStatus::Id: { + using T = MN::PumpStatus::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PumpStatus attribute value is %s",unify_value.dump().c_str() ); + UN::PumpStatus::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::PumpStatus::Id, + ZCL_BITMAP16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is PumpOperationMode + case MN::EffectiveOperationMode::Id: { + using T = MN::EffectiveOperationMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EffectiveOperationMode attribute value is %s",unify_value.dump().c_str() ); + UN::EffectiveOperationMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::EffectiveOperationMode::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is PumpControlMode + case MN::EffectiveControlMode::Id: { + using T = MN::EffectiveControlMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EffectiveControlMode attribute value is %s",unify_value.dump().c_str() ); + UN::EffectiveControlMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::EffectiveControlMode::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::Capacity::Id: { + using T = MN::Capacity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Capacity attribute value is %s",unify_value.dump().c_str() ); + UN::Capacity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::Capacity::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Speed::Id: { + using T = MN::Speed::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Speed attribute value is %s",unify_value.dump().c_str() ); + UN::Speed::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::Speed::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int24u + case MN::LifetimeRunningHours::Id: { + using T = MN::LifetimeRunningHours::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LifetimeRunningHours attribute value is %s",unify_value.dump().c_str() ); + UN::LifetimeRunningHours::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::LifetimeRunningHours::Id, + ZCL_INT24U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int24u + case MN::Power::Id: { + using T = MN::Power::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Power attribute value is %s",unify_value.dump().c_str() ); + UN::Power::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::Power::Id, + ZCL_INT24U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::LifetimeEnergyConsumed::Id: { + using T = MN::LifetimeEnergyConsumed::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LifetimeEnergyConsumed attribute value is %s",unify_value.dump().c_str() ); + UN::LifetimeEnergyConsumed::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::LifetimeEnergyConsumed::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is PumpOperationMode + case MN::OperationMode::Id: { + using T = MN::OperationMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OperationMode attribute value is %s",unify_value.dump().c_str() ); + UN::OperationMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::OperationMode::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is PumpControlMode + case MN::ControlMode::Id: { + using T = MN::ControlMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ControlMode attribute value is %s",unify_value.dump().c_str() ); + UN::ControlMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::ControlMode::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PumpConfigurationAndControl::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ThermostatAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::Thermostat::Attributes; + namespace UN = unify::matter_bridge::Thermostat::Attributes; + if (aPath.mClusterId != Clusters::Thermostat::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::LocalTemperature::Id: { // type is int16s + MN::LocalTemperature::TypeInfo::Type value; + UN::LocalTemperature::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OutdoorTemperature::Id: { // type is int16s + MN::OutdoorTemperature::TypeInfo::Type value; + UN::OutdoorTemperature::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Occupancy::Id: { // type is bitmap8 + MN::Occupancy::TypeInfo::Type value; + UN::Occupancy::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AbsMinHeatSetpointLimit::Id: { // type is int16s + MN::AbsMinHeatSetpointLimit::TypeInfo::Type value; + UN::AbsMinHeatSetpointLimit::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AbsMaxHeatSetpointLimit::Id: { // type is int16s + MN::AbsMaxHeatSetpointLimit::TypeInfo::Type value; + UN::AbsMaxHeatSetpointLimit::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AbsMinCoolSetpointLimit::Id: { // type is int16s + MN::AbsMinCoolSetpointLimit::TypeInfo::Type value; + UN::AbsMinCoolSetpointLimit::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AbsMaxCoolSetpointLimit::Id: { // type is int16s + MN::AbsMaxCoolSetpointLimit::TypeInfo::Type value; + UN::AbsMaxCoolSetpointLimit::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PICoolingDemand::Id: { // type is int8u + MN::PICoolingDemand::TypeInfo::Type value; + UN::PICoolingDemand::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PIHeatingDemand::Id: { // type is int8u + MN::PIHeatingDemand::TypeInfo::Type value; + UN::PIHeatingDemand::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::HVACSystemTypeConfiguration::Id: { // type is bitmap8 + MN::HVACSystemTypeConfiguration::TypeInfo::Type value; + UN::HVACSystemTypeConfiguration::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LocalTemperatureCalibration::Id: { // type is int8s + MN::LocalTemperatureCalibration::TypeInfo::Type value; + UN::LocalTemperatureCalibration::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OccupiedCoolingSetpoint::Id: { // type is int16s + MN::OccupiedCoolingSetpoint::TypeInfo::Type value; + UN::OccupiedCoolingSetpoint::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OccupiedHeatingSetpoint::Id: { // type is int16s + MN::OccupiedHeatingSetpoint::TypeInfo::Type value; + UN::OccupiedHeatingSetpoint::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UnoccupiedCoolingSetpoint::Id: { // type is int16s + MN::UnoccupiedCoolingSetpoint::TypeInfo::Type value; + UN::UnoccupiedCoolingSetpoint::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UnoccupiedHeatingSetpoint::Id: { // type is int16s + MN::UnoccupiedHeatingSetpoint::TypeInfo::Type value; + UN::UnoccupiedHeatingSetpoint::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinHeatSetpointLimit::Id: { // type is int16s + MN::MinHeatSetpointLimit::TypeInfo::Type value; + UN::MinHeatSetpointLimit::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxHeatSetpointLimit::Id: { // type is int16s + MN::MaxHeatSetpointLimit::TypeInfo::Type value; + UN::MaxHeatSetpointLimit::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinCoolSetpointLimit::Id: { // type is int16s + MN::MinCoolSetpointLimit::TypeInfo::Type value; + UN::MinCoolSetpointLimit::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxCoolSetpointLimit::Id: { // type is int16s + MN::MaxCoolSetpointLimit::TypeInfo::Type value; + UN::MaxCoolSetpointLimit::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinSetpointDeadBand::Id: { // type is int8s + MN::MinSetpointDeadBand::TypeInfo::Type value; + UN::MinSetpointDeadBand::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RemoteSensing::Id: { // type is bitmap8 + MN::RemoteSensing::TypeInfo::Type value; + UN::RemoteSensing::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ControlSequenceOfOperation::Id: { // type is ThermostatControlSequence + MN::ControlSequenceOfOperation::TypeInfo::Type value; + UN::ControlSequenceOfOperation::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SystemMode::Id: { // type is enum8 + MN::SystemMode::TypeInfo::Type value; + UN::SystemMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ThermostatRunningMode::Id: { // type is enum8 + MN::ThermostatRunningMode::TypeInfo::Type value; + UN::ThermostatRunningMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::StartOfWeek::Id: { // type is enum8 + MN::StartOfWeek::TypeInfo::Type value; + UN::StartOfWeek::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfWeeklyTransitions::Id: { // type is int8u + MN::NumberOfWeeklyTransitions::TypeInfo::Type value; + UN::NumberOfWeeklyTransitions::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfDailyTransitions::Id: { // type is int8u + MN::NumberOfDailyTransitions::TypeInfo::Type value; + UN::NumberOfDailyTransitions::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TemperatureSetpointHold::Id: { // type is enum8 + MN::TemperatureSetpointHold::TypeInfo::Type value; + UN::TemperatureSetpointHold::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TemperatureSetpointHoldDuration::Id: { // type is int16u + MN::TemperatureSetpointHoldDuration::TypeInfo::Type value; + UN::TemperatureSetpointHoldDuration::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ThermostatProgrammingOperationMode::Id: { // type is bitmap8 + MN::ThermostatProgrammingOperationMode::TypeInfo::Type value; + UN::ThermostatProgrammingOperationMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ThermostatRunningState::Id: { // type is bitmap16 + MN::ThermostatRunningState::TypeInfo::Type value; + UN::ThermostatRunningState::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SetpointChangeSource::Id: { // type is enum8 + MN::SetpointChangeSource::TypeInfo::Type value; + UN::SetpointChangeSource::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SetpointChangeAmount::Id: { // type is int16s + MN::SetpointChangeAmount::TypeInfo::Type value; + UN::SetpointChangeAmount::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SetpointChangeSourceTimestamp::Id: { // type is utc + MN::SetpointChangeSourceTimestamp::TypeInfo::Type value; + UN::SetpointChangeSourceTimestamp::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OccupiedSetback::Id: { // type is int8u + MN::OccupiedSetback::TypeInfo::Type value; + UN::OccupiedSetback::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OccupiedSetbackMin::Id: { // type is int8u + MN::OccupiedSetbackMin::TypeInfo::Type value; + UN::OccupiedSetbackMin::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OccupiedSetbackMax::Id: { // type is int8u + MN::OccupiedSetbackMax::TypeInfo::Type value; + UN::OccupiedSetbackMax::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UnoccupiedSetback::Id: { // type is int8u + MN::UnoccupiedSetback::TypeInfo::Type value; + UN::UnoccupiedSetback::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UnoccupiedSetbackMin::Id: { // type is int8u + MN::UnoccupiedSetbackMin::TypeInfo::Type value; + UN::UnoccupiedSetbackMin::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UnoccupiedSetbackMax::Id: { // type is int8u + MN::UnoccupiedSetbackMax::TypeInfo::Type value; + UN::UnoccupiedSetbackMax::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EmergencyHeatDelta::Id: { // type is int8u + MN::EmergencyHeatDelta::TypeInfo::Type value; + UN::EmergencyHeatDelta::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ACType::Id: { // type is enum8 + MN::ACType::TypeInfo::Type value; + UN::ACType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ACCapacity::Id: { // type is int16u + MN::ACCapacity::TypeInfo::Type value; + UN::ACCapacity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ACRefrigerantType::Id: { // type is enum8 + MN::ACRefrigerantType::TypeInfo::Type value; + UN::ACRefrigerantType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ACCompressorType::Id: { // type is enum8 + MN::ACCompressorType::TypeInfo::Type value; + UN::ACCompressorType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ACErrorCode::Id: { // type is bitmap32 + MN::ACErrorCode::TypeInfo::Type value; + UN::ACErrorCode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ACLouverPosition::Id: { // type is enum8 + MN::ACLouverPosition::TypeInfo::Type value; + UN::ACLouverPosition::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ACCoilTemperature::Id: { // type is int16s + MN::ACCoilTemperature::TypeInfo::Type value; + UN::ACCoilTemperature::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ACCapacityformat::Id: { // type is enum8 + MN::ACCapacityformat::TypeInfo::Type value; + UN::ACCapacityformat::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThermostatAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::Thermostat; + + if (aPath.mClusterId != Clusters::Thermostat::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/Thermostat/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ThermostatAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::Thermostat::Attributes; + namespace UN = unify::matter_bridge::Thermostat::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::Thermostat::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::Thermostat::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16s + case MN::LocalTemperature::Id: { + using T = MN::LocalTemperature::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LocalTemperature attribute value is %s",unify_value.dump().c_str() ); + UN::LocalTemperature::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::LocalTemperature::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::OutdoorTemperature::Id: { + using T = MN::OutdoorTemperature::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OutdoorTemperature attribute value is %s",unify_value.dump().c_str() ); + UN::OutdoorTemperature::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::OutdoorTemperature::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::Occupancy::Id: { + using T = MN::Occupancy::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Occupancy attribute value is %s",unify_value.dump().c_str() ); + UN::Occupancy::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::Occupancy::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::AbsMinHeatSetpointLimit::Id: { + using T = MN::AbsMinHeatSetpointLimit::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AbsMinHeatSetpointLimit attribute value is %s",unify_value.dump().c_str() ); + UN::AbsMinHeatSetpointLimit::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::AbsMinHeatSetpointLimit::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::AbsMaxHeatSetpointLimit::Id: { + using T = MN::AbsMaxHeatSetpointLimit::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AbsMaxHeatSetpointLimit attribute value is %s",unify_value.dump().c_str() ); + UN::AbsMaxHeatSetpointLimit::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::AbsMaxHeatSetpointLimit::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::AbsMinCoolSetpointLimit::Id: { + using T = MN::AbsMinCoolSetpointLimit::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AbsMinCoolSetpointLimit attribute value is %s",unify_value.dump().c_str() ); + UN::AbsMinCoolSetpointLimit::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::AbsMinCoolSetpointLimit::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::AbsMaxCoolSetpointLimit::Id: { + using T = MN::AbsMaxCoolSetpointLimit::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AbsMaxCoolSetpointLimit attribute value is %s",unify_value.dump().c_str() ); + UN::AbsMaxCoolSetpointLimit::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::AbsMaxCoolSetpointLimit::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::PICoolingDemand::Id: { + using T = MN::PICoolingDemand::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PICoolingDemand attribute value is %s",unify_value.dump().c_str() ); + UN::PICoolingDemand::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::PICoolingDemand::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::PIHeatingDemand::Id: { + using T = MN::PIHeatingDemand::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PIHeatingDemand attribute value is %s",unify_value.dump().c_str() ); + UN::PIHeatingDemand::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::PIHeatingDemand::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::HVACSystemTypeConfiguration::Id: { + using T = MN::HVACSystemTypeConfiguration::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"HVACSystemTypeConfiguration attribute value is %s",unify_value.dump().c_str() ); + UN::HVACSystemTypeConfiguration::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::HVACSystemTypeConfiguration::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::LocalTemperatureCalibration::Id: { + using T = MN::LocalTemperatureCalibration::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LocalTemperatureCalibration attribute value is %s",unify_value.dump().c_str() ); + UN::LocalTemperatureCalibration::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::LocalTemperatureCalibration::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::OccupiedCoolingSetpoint::Id: { + using T = MN::OccupiedCoolingSetpoint::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OccupiedCoolingSetpoint attribute value is %s",unify_value.dump().c_str() ); + UN::OccupiedCoolingSetpoint::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::OccupiedCoolingSetpoint::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::OccupiedHeatingSetpoint::Id: { + using T = MN::OccupiedHeatingSetpoint::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OccupiedHeatingSetpoint attribute value is %s",unify_value.dump().c_str() ); + UN::OccupiedHeatingSetpoint::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::OccupiedHeatingSetpoint::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::UnoccupiedCoolingSetpoint::Id: { + using T = MN::UnoccupiedCoolingSetpoint::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UnoccupiedCoolingSetpoint attribute value is %s",unify_value.dump().c_str() ); + UN::UnoccupiedCoolingSetpoint::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::UnoccupiedCoolingSetpoint::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::UnoccupiedHeatingSetpoint::Id: { + using T = MN::UnoccupiedHeatingSetpoint::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UnoccupiedHeatingSetpoint attribute value is %s",unify_value.dump().c_str() ); + UN::UnoccupiedHeatingSetpoint::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::UnoccupiedHeatingSetpoint::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MinHeatSetpointLimit::Id: { + using T = MN::MinHeatSetpointLimit::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinHeatSetpointLimit attribute value is %s",unify_value.dump().c_str() ); + UN::MinHeatSetpointLimit::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::MinHeatSetpointLimit::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MaxHeatSetpointLimit::Id: { + using T = MN::MaxHeatSetpointLimit::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxHeatSetpointLimit attribute value is %s",unify_value.dump().c_str() ); + UN::MaxHeatSetpointLimit::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::MaxHeatSetpointLimit::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MinCoolSetpointLimit::Id: { + using T = MN::MinCoolSetpointLimit::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinCoolSetpointLimit attribute value is %s",unify_value.dump().c_str() ); + UN::MinCoolSetpointLimit::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::MinCoolSetpointLimit::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MaxCoolSetpointLimit::Id: { + using T = MN::MaxCoolSetpointLimit::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxCoolSetpointLimit attribute value is %s",unify_value.dump().c_str() ); + UN::MaxCoolSetpointLimit::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::MaxCoolSetpointLimit::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::MinSetpointDeadBand::Id: { + using T = MN::MinSetpointDeadBand::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinSetpointDeadBand attribute value is %s",unify_value.dump().c_str() ); + UN::MinSetpointDeadBand::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::MinSetpointDeadBand::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::RemoteSensing::Id: { + using T = MN::RemoteSensing::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RemoteSensing attribute value is %s",unify_value.dump().c_str() ); + UN::RemoteSensing::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::RemoteSensing::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is ThermostatControlSequence + case MN::ControlSequenceOfOperation::Id: { + using T = MN::ControlSequenceOfOperation::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ControlSequenceOfOperation attribute value is %s",unify_value.dump().c_str() ); + UN::ControlSequenceOfOperation::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ControlSequenceOfOperation::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::SystemMode::Id: { + using T = MN::SystemMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SystemMode attribute value is %s",unify_value.dump().c_str() ); + UN::SystemMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::SystemMode::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::ThermostatRunningMode::Id: { + using T = MN::ThermostatRunningMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ThermostatRunningMode attribute value is %s",unify_value.dump().c_str() ); + UN::ThermostatRunningMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ThermostatRunningMode::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::StartOfWeek::Id: { + using T = MN::StartOfWeek::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"StartOfWeek attribute value is %s",unify_value.dump().c_str() ); + UN::StartOfWeek::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::StartOfWeek::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::NumberOfWeeklyTransitions::Id: { + using T = MN::NumberOfWeeklyTransitions::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfWeeklyTransitions attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfWeeklyTransitions::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::NumberOfWeeklyTransitions::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::NumberOfDailyTransitions::Id: { + using T = MN::NumberOfDailyTransitions::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfDailyTransitions attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfDailyTransitions::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::NumberOfDailyTransitions::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::TemperatureSetpointHold::Id: { + using T = MN::TemperatureSetpointHold::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TemperatureSetpointHold attribute value is %s",unify_value.dump().c_str() ); + UN::TemperatureSetpointHold::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::TemperatureSetpointHold::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::TemperatureSetpointHoldDuration::Id: { + using T = MN::TemperatureSetpointHoldDuration::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TemperatureSetpointHoldDuration attribute value is %s",unify_value.dump().c_str() ); + UN::TemperatureSetpointHoldDuration::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::TemperatureSetpointHoldDuration::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::ThermostatProgrammingOperationMode::Id: { + using T = MN::ThermostatProgrammingOperationMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ThermostatProgrammingOperationMode attribute value is %s",unify_value.dump().c_str() ); + UN::ThermostatProgrammingOperationMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ThermostatProgrammingOperationMode::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap16 + case MN::ThermostatRunningState::Id: { + using T = MN::ThermostatRunningState::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ThermostatRunningState attribute value is %s",unify_value.dump().c_str() ); + UN::ThermostatRunningState::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ThermostatRunningState::Id, + ZCL_BITMAP16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::SetpointChangeSource::Id: { + using T = MN::SetpointChangeSource::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SetpointChangeSource attribute value is %s",unify_value.dump().c_str() ); + UN::SetpointChangeSource::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::SetpointChangeSource::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::SetpointChangeAmount::Id: { + using T = MN::SetpointChangeAmount::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SetpointChangeAmount attribute value is %s",unify_value.dump().c_str() ); + UN::SetpointChangeAmount::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::SetpointChangeAmount::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is utc + case MN::SetpointChangeSourceTimestamp::Id: { + using T = MN::SetpointChangeSourceTimestamp::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SetpointChangeSourceTimestamp attribute value is %s",unify_value.dump().c_str() ); + UN::SetpointChangeSourceTimestamp::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::SetpointChangeSourceTimestamp::Id, + ZCL_UTC_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::OccupiedSetback::Id: { + using T = MN::OccupiedSetback::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OccupiedSetback attribute value is %s",unify_value.dump().c_str() ); + UN::OccupiedSetback::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::OccupiedSetback::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::OccupiedSetbackMin::Id: { + using T = MN::OccupiedSetbackMin::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OccupiedSetbackMin attribute value is %s",unify_value.dump().c_str() ); + UN::OccupiedSetbackMin::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::OccupiedSetbackMin::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::OccupiedSetbackMax::Id: { + using T = MN::OccupiedSetbackMax::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OccupiedSetbackMax attribute value is %s",unify_value.dump().c_str() ); + UN::OccupiedSetbackMax::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::OccupiedSetbackMax::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::UnoccupiedSetback::Id: { + using T = MN::UnoccupiedSetback::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UnoccupiedSetback attribute value is %s",unify_value.dump().c_str() ); + UN::UnoccupiedSetback::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::UnoccupiedSetback::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::UnoccupiedSetbackMin::Id: { + using T = MN::UnoccupiedSetbackMin::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UnoccupiedSetbackMin attribute value is %s",unify_value.dump().c_str() ); + UN::UnoccupiedSetbackMin::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::UnoccupiedSetbackMin::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::UnoccupiedSetbackMax::Id: { + using T = MN::UnoccupiedSetbackMax::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UnoccupiedSetbackMax attribute value is %s",unify_value.dump().c_str() ); + UN::UnoccupiedSetbackMax::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::UnoccupiedSetbackMax::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::EmergencyHeatDelta::Id: { + using T = MN::EmergencyHeatDelta::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EmergencyHeatDelta attribute value is %s",unify_value.dump().c_str() ); + UN::EmergencyHeatDelta::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::EmergencyHeatDelta::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::ACType::Id: { + using T = MN::ACType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ACType attribute value is %s",unify_value.dump().c_str() ); + UN::ACType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ACType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ACCapacity::Id: { + using T = MN::ACCapacity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ACCapacity attribute value is %s",unify_value.dump().c_str() ); + UN::ACCapacity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ACCapacity::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::ACRefrigerantType::Id: { + using T = MN::ACRefrigerantType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ACRefrigerantType attribute value is %s",unify_value.dump().c_str() ); + UN::ACRefrigerantType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ACRefrigerantType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::ACCompressorType::Id: { + using T = MN::ACCompressorType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ACCompressorType attribute value is %s",unify_value.dump().c_str() ); + UN::ACCompressorType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ACCompressorType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::ACErrorCode::Id: { + using T = MN::ACErrorCode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ACErrorCode attribute value is %s",unify_value.dump().c_str() ); + UN::ACErrorCode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ACErrorCode::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::ACLouverPosition::Id: { + using T = MN::ACLouverPosition::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ACLouverPosition attribute value is %s",unify_value.dump().c_str() ); + UN::ACLouverPosition::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ACLouverPosition::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ACCoilTemperature::Id: { + using T = MN::ACCoilTemperature::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ACCoilTemperature attribute value is %s",unify_value.dump().c_str() ); + UN::ACCoilTemperature::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ACCoilTemperature::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::ACCapacityformat::Id: { + using T = MN::ACCapacityformat::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ACCapacityformat attribute value is %s",unify_value.dump().c_str() ); + UN::ACCapacityformat::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ACCapacityformat::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Thermostat::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +FanControlAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::FanControl::Attributes; + namespace UN = unify::matter_bridge::FanControl::Attributes; + if (aPath.mClusterId != Clusters::FanControl::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::FanMode::Id: { // type is FanModeType + MN::FanMode::TypeInfo::Type value; + UN::FanMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::FanModeSequence::Id: { // type is FanModeSequenceType + MN::FanModeSequence::TypeInfo::Type value; + UN::FanModeSequence::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PercentSetting::Id: { // type is int8u + MN::PercentSetting::TypeInfo::Type value; + UN::PercentSetting::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PercentCurrent::Id: { // type is int8u + MN::PercentCurrent::TypeInfo::Type value; + UN::PercentCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SpeedMax::Id: { // type is int8u + MN::SpeedMax::TypeInfo::Type value; + UN::SpeedMax::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SpeedSetting::Id: { // type is int8u + MN::SpeedSetting::TypeInfo::Type value; + UN::SpeedSetting::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SpeedCurrent::Id: { // type is int8u + MN::SpeedCurrent::TypeInfo::Type value; + UN::SpeedCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RockSupport::Id: { // type is bitmap8 + MN::RockSupport::TypeInfo::Type value; + UN::RockSupport::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RockSetting::Id: { // type is bitmap8 + MN::RockSetting::TypeInfo::Type value; + UN::RockSetting::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WindSupport::Id: { // type is bitmap8 + MN::WindSupport::TypeInfo::Type value; + UN::WindSupport::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WindSetting::Id: { // type is bitmap8 + MN::WindSetting::TypeInfo::Type value; + UN::WindSetting::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR FanControlAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::FanControl; + + if (aPath.mClusterId != Clusters::FanControl::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/FanControl/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void FanControlAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::FanControl::Attributes; + namespace UN = unify::matter_bridge::FanControl::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::FanControl::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::FanControl::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is FanModeType + case MN::FanMode::Id: { + using T = MN::FanMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FanMode attribute value is %s",unify_value.dump().c_str() ); + UN::FanMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::FanMode::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is FanModeSequenceType + case MN::FanModeSequence::Id: { + using T = MN::FanModeSequence::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FanModeSequence attribute value is %s",unify_value.dump().c_str() ); + UN::FanModeSequence::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::FanModeSequence::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::PercentSetting::Id: { + using T = MN::PercentSetting::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PercentSetting attribute value is %s",unify_value.dump().c_str() ); + UN::PercentSetting::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::PercentSetting::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::PercentCurrent::Id: { + using T = MN::PercentCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PercentCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::PercentCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::PercentCurrent::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::SpeedMax::Id: { + using T = MN::SpeedMax::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SpeedMax attribute value is %s",unify_value.dump().c_str() ); + UN::SpeedMax::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::SpeedMax::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::SpeedSetting::Id: { + using T = MN::SpeedSetting::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SpeedSetting attribute value is %s",unify_value.dump().c_str() ); + UN::SpeedSetting::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::SpeedSetting::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::SpeedCurrent::Id: { + using T = MN::SpeedCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SpeedCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::SpeedCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::SpeedCurrent::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::RockSupport::Id: { + using T = MN::RockSupport::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RockSupport attribute value is %s",unify_value.dump().c_str() ); + UN::RockSupport::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::RockSupport::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::RockSetting::Id: { + using T = MN::RockSetting::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RockSetting attribute value is %s",unify_value.dump().c_str() ); + UN::RockSetting::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::RockSetting::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::WindSupport::Id: { + using T = MN::WindSupport::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WindSupport attribute value is %s",unify_value.dump().c_str() ); + UN::WindSupport::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::WindSupport::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::WindSetting::Id: { + using T = MN::WindSetting::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WindSetting attribute value is %s",unify_value.dump().c_str() ); + UN::WindSetting::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::WindSetting::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FanControl::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ThermostatUserInterfaceConfigurationAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes; + namespace UN = unify::matter_bridge::ThermostatUserInterfaceConfiguration::Attributes; + if (aPath.mClusterId != Clusters::ThermostatUserInterfaceConfiguration::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::TemperatureDisplayMode::Id: { // type is enum8 + MN::TemperatureDisplayMode::TypeInfo::Type value; + UN::TemperatureDisplayMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::KeypadLockout::Id: { // type is enum8 + MN::KeypadLockout::TypeInfo::Type value; + UN::KeypadLockout::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ScheduleProgrammingVisibility::Id: { // type is enum8 + MN::ScheduleProgrammingVisibility::TypeInfo::Type value; + UN::ScheduleProgrammingVisibility::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThermostatUserInterfaceConfigurationAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::ThermostatUserInterfaceConfiguration; + + if (aPath.mClusterId != Clusters::ThermostatUserInterfaceConfiguration::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/ThermostatUserInterfaceConfiguration/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ThermostatUserInterfaceConfigurationAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes; + namespace UN = unify::matter_bridge::ThermostatUserInterfaceConfiguration::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::ThermostatUserInterfaceConfiguration::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::ThermostatUserInterfaceConfiguration::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is enum8 + case MN::TemperatureDisplayMode::Id: { + using T = MN::TemperatureDisplayMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TemperatureDisplayMode attribute value is %s",unify_value.dump().c_str() ); + UN::TemperatureDisplayMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThermostatUserInterfaceConfiguration::Id, + MN::TemperatureDisplayMode::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::KeypadLockout::Id: { + using T = MN::KeypadLockout::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"KeypadLockout attribute value is %s",unify_value.dump().c_str() ); + UN::KeypadLockout::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThermostatUserInterfaceConfiguration::Id, + MN::KeypadLockout::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::ScheduleProgrammingVisibility::Id: { + using T = MN::ScheduleProgrammingVisibility::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ScheduleProgrammingVisibility attribute value is %s",unify_value.dump().c_str() ); + UN::ScheduleProgrammingVisibility::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThermostatUserInterfaceConfiguration::Id, + MN::ScheduleProgrammingVisibility::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThermostatUserInterfaceConfiguration::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ThermostatUserInterfaceConfiguration::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ColorControlAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::ColorControl::Attributes; + namespace UN = unify::matter_bridge::ColorControl::Attributes; + if (aPath.mClusterId != Clusters::ColorControl::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::CurrentHue::Id: { // type is int8u + MN::CurrentHue::TypeInfo::Type value; + UN::CurrentHue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentSaturation::Id: { // type is int8u + MN::CurrentSaturation::TypeInfo::Type value; + UN::CurrentSaturation::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RemainingTime::Id: { // type is int16u + MN::RemainingTime::TypeInfo::Type value; + UN::RemainingTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentX::Id: { // type is int16u + MN::CurrentX::TypeInfo::Type value; + UN::CurrentX::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentY::Id: { // type is int16u + MN::CurrentY::TypeInfo::Type value; + UN::CurrentY::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DriftCompensation::Id: { // type is enum8 + MN::DriftCompensation::TypeInfo::Type value; + UN::DriftCompensation::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CompensationText::Id: { // type is char_string + MN::CompensationText::TypeInfo::Type value; + UN::CompensationText::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorTemperatureMireds::Id: { // type is int16u + MN::ColorTemperatureMireds::TypeInfo::Type value; + UN::ColorTemperatureMireds::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorMode::Id: { // type is enum8 + MN::ColorMode::TypeInfo::Type value; + UN::ColorMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Options::Id: { // type is bitmap8 + MN::Options::TypeInfo::Type value; + UN::Options::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NumberOfPrimaries::Id: { // type is int8u + MN::NumberOfPrimaries::TypeInfo::Type value; + UN::NumberOfPrimaries::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary1X::Id: { // type is int16u + MN::Primary1X::TypeInfo::Type value; + UN::Primary1X::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary1Y::Id: { // type is int16u + MN::Primary1Y::TypeInfo::Type value; + UN::Primary1Y::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary1Intensity::Id: { // type is int8u + MN::Primary1Intensity::TypeInfo::Type value; + UN::Primary1Intensity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary2X::Id: { // type is int16u + MN::Primary2X::TypeInfo::Type value; + UN::Primary2X::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary2Y::Id: { // type is int16u + MN::Primary2Y::TypeInfo::Type value; + UN::Primary2Y::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary2Intensity::Id: { // type is int8u + MN::Primary2Intensity::TypeInfo::Type value; + UN::Primary2Intensity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary3X::Id: { // type is int16u + MN::Primary3X::TypeInfo::Type value; + UN::Primary3X::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary3Y::Id: { // type is int16u + MN::Primary3Y::TypeInfo::Type value; + UN::Primary3Y::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary3Intensity::Id: { // type is int8u + MN::Primary3Intensity::TypeInfo::Type value; + UN::Primary3Intensity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary4X::Id: { // type is int16u + MN::Primary4X::TypeInfo::Type value; + UN::Primary4X::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary4Y::Id: { // type is int16u + MN::Primary4Y::TypeInfo::Type value; + UN::Primary4Y::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary4Intensity::Id: { // type is int8u + MN::Primary4Intensity::TypeInfo::Type value; + UN::Primary4Intensity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary5X::Id: { // type is int16u + MN::Primary5X::TypeInfo::Type value; + UN::Primary5X::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary5Y::Id: { // type is int16u + MN::Primary5Y::TypeInfo::Type value; + UN::Primary5Y::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary5Intensity::Id: { // type is int8u + MN::Primary5Intensity::TypeInfo::Type value; + UN::Primary5Intensity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary6X::Id: { // type is int16u + MN::Primary6X::TypeInfo::Type value; + UN::Primary6X::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary6Y::Id: { // type is int16u + MN::Primary6Y::TypeInfo::Type value; + UN::Primary6Y::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Primary6Intensity::Id: { // type is int8u + MN::Primary6Intensity::TypeInfo::Type value; + UN::Primary6Intensity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WhitePointX::Id: { // type is int16u + MN::WhitePointX::TypeInfo::Type value; + UN::WhitePointX::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WhitePointY::Id: { // type is int16u + MN::WhitePointY::TypeInfo::Type value; + UN::WhitePointY::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorPointRX::Id: { // type is int16u + MN::ColorPointRX::TypeInfo::Type value; + UN::ColorPointRX::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorPointRY::Id: { // type is int16u + MN::ColorPointRY::TypeInfo::Type value; + UN::ColorPointRY::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorPointRIntensity::Id: { // type is int8u + MN::ColorPointRIntensity::TypeInfo::Type value; + UN::ColorPointRIntensity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorPointGX::Id: { // type is int16u + MN::ColorPointGX::TypeInfo::Type value; + UN::ColorPointGX::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorPointGY::Id: { // type is int16u + MN::ColorPointGY::TypeInfo::Type value; + UN::ColorPointGY::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorPointGIntensity::Id: { // type is int8u + MN::ColorPointGIntensity::TypeInfo::Type value; + UN::ColorPointGIntensity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorPointBX::Id: { // type is int16u + MN::ColorPointBX::TypeInfo::Type value; + UN::ColorPointBX::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorPointBY::Id: { // type is int16u + MN::ColorPointBY::TypeInfo::Type value; + UN::ColorPointBY::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorPointBIntensity::Id: { // type is int8u + MN::ColorPointBIntensity::TypeInfo::Type value; + UN::ColorPointBIntensity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EnhancedCurrentHue::Id: { // type is int16u + MN::EnhancedCurrentHue::TypeInfo::Type value; + UN::EnhancedCurrentHue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EnhancedColorMode::Id: { // type is enum8 + MN::EnhancedColorMode::TypeInfo::Type value; + UN::EnhancedColorMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorLoopActive::Id: { // type is int8u + MN::ColorLoopActive::TypeInfo::Type value; + UN::ColorLoopActive::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorLoopDirection::Id: { // type is int8u + MN::ColorLoopDirection::TypeInfo::Type value; + UN::ColorLoopDirection::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorLoopTime::Id: { // type is int16u + MN::ColorLoopTime::TypeInfo::Type value; + UN::ColorLoopTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorLoopStartEnhancedHue::Id: { // type is int16u + MN::ColorLoopStartEnhancedHue::TypeInfo::Type value; + UN::ColorLoopStartEnhancedHue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorLoopStoredEnhancedHue::Id: { // type is int16u + MN::ColorLoopStoredEnhancedHue::TypeInfo::Type value; + UN::ColorLoopStoredEnhancedHue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorCapabilities::Id: { // type is bitmap16 + MN::ColorCapabilities::TypeInfo::Type value; + UN::ColorCapabilities::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorTempPhysicalMinMireds::Id: { // type is int16u + MN::ColorTempPhysicalMinMireds::TypeInfo::Type value; + UN::ColorTempPhysicalMinMireds::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ColorTempPhysicalMaxMireds::Id: { // type is int16u + MN::ColorTempPhysicalMaxMireds::TypeInfo::Type value; + UN::ColorTempPhysicalMaxMireds::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CoupleColorTempToLevelMinMireds::Id: { // type is int16u + MN::CoupleColorTempToLevelMinMireds::TypeInfo::Type value; + UN::CoupleColorTempToLevelMinMireds::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::StartUpColorTemperatureMireds::Id: { // type is int16u + MN::StartUpColorTemperatureMireds::TypeInfo::Type value; + UN::StartUpColorTemperatureMireds::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ColorControlAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::ColorControl; + + if (aPath.mClusterId != Clusters::ColorControl::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/ColorControl/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ColorControlAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::ColorControl::Attributes; + namespace UN = unify::matter_bridge::ColorControl::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::ColorControl::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::ColorControl::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int8u + case MN::CurrentHue::Id: { + using T = MN::CurrentHue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentHue attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentHue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::CurrentHue::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::CurrentSaturation::Id: { + using T = MN::CurrentSaturation::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentSaturation attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentSaturation::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::CurrentSaturation::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RemainingTime::Id: { + using T = MN::RemainingTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RemainingTime attribute value is %s",unify_value.dump().c_str() ); + UN::RemainingTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::RemainingTime::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::CurrentX::Id: { + using T = MN::CurrentX::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentX attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentX::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::CurrentX::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::CurrentY::Id: { + using T = MN::CurrentY::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentY attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentY::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::CurrentY::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::DriftCompensation::Id: { + using T = MN::DriftCompensation::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DriftCompensation attribute value is %s",unify_value.dump().c_str() ); + UN::DriftCompensation::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::DriftCompensation::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::CompensationText::Id: { + using T = MN::CompensationText::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CompensationText attribute value is %s",unify_value.dump().c_str() ); + UN::CompensationText::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::CompensationText::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorTemperatureMireds::Id: { + using T = MN::ColorTemperatureMireds::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorTemperatureMireds attribute value is %s",unify_value.dump().c_str() ); + UN::ColorTemperatureMireds::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorTemperatureMireds::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::ColorMode::Id: { + using T = MN::ColorMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorMode attribute value is %s",unify_value.dump().c_str() ); + UN::ColorMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorMode::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::Options::Id: { + using T = MN::Options::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Options attribute value is %s",unify_value.dump().c_str() ); + UN::Options::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Options::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::NumberOfPrimaries::Id: { + using T = MN::NumberOfPrimaries::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NumberOfPrimaries attribute value is %s",unify_value.dump().c_str() ); + UN::NumberOfPrimaries::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::NumberOfPrimaries::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary1X::Id: { + using T = MN::Primary1X::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary1X attribute value is %s",unify_value.dump().c_str() ); + UN::Primary1X::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary1X::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary1Y::Id: { + using T = MN::Primary1Y::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary1Y attribute value is %s",unify_value.dump().c_str() ); + UN::Primary1Y::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary1Y::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::Primary1Intensity::Id: { + using T = MN::Primary1Intensity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary1Intensity attribute value is %s",unify_value.dump().c_str() ); + UN::Primary1Intensity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary1Intensity::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary2X::Id: { + using T = MN::Primary2X::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary2X attribute value is %s",unify_value.dump().c_str() ); + UN::Primary2X::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary2X::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary2Y::Id: { + using T = MN::Primary2Y::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary2Y attribute value is %s",unify_value.dump().c_str() ); + UN::Primary2Y::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary2Y::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::Primary2Intensity::Id: { + using T = MN::Primary2Intensity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary2Intensity attribute value is %s",unify_value.dump().c_str() ); + UN::Primary2Intensity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary2Intensity::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary3X::Id: { + using T = MN::Primary3X::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary3X attribute value is %s",unify_value.dump().c_str() ); + UN::Primary3X::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary3X::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary3Y::Id: { + using T = MN::Primary3Y::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary3Y attribute value is %s",unify_value.dump().c_str() ); + UN::Primary3Y::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary3Y::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::Primary3Intensity::Id: { + using T = MN::Primary3Intensity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary3Intensity attribute value is %s",unify_value.dump().c_str() ); + UN::Primary3Intensity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary3Intensity::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary4X::Id: { + using T = MN::Primary4X::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary4X attribute value is %s",unify_value.dump().c_str() ); + UN::Primary4X::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary4X::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary4Y::Id: { + using T = MN::Primary4Y::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary4Y attribute value is %s",unify_value.dump().c_str() ); + UN::Primary4Y::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary4Y::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::Primary4Intensity::Id: { + using T = MN::Primary4Intensity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary4Intensity attribute value is %s",unify_value.dump().c_str() ); + UN::Primary4Intensity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary4Intensity::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary5X::Id: { + using T = MN::Primary5X::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary5X attribute value is %s",unify_value.dump().c_str() ); + UN::Primary5X::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary5X::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary5Y::Id: { + using T = MN::Primary5Y::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary5Y attribute value is %s",unify_value.dump().c_str() ); + UN::Primary5Y::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary5Y::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::Primary5Intensity::Id: { + using T = MN::Primary5Intensity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary5Intensity attribute value is %s",unify_value.dump().c_str() ); + UN::Primary5Intensity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary5Intensity::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary6X::Id: { + using T = MN::Primary6X::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary6X attribute value is %s",unify_value.dump().c_str() ); + UN::Primary6X::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary6X::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Primary6Y::Id: { + using T = MN::Primary6Y::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary6Y attribute value is %s",unify_value.dump().c_str() ); + UN::Primary6Y::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary6Y::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::Primary6Intensity::Id: { + using T = MN::Primary6Intensity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Primary6Intensity attribute value is %s",unify_value.dump().c_str() ); + UN::Primary6Intensity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::Primary6Intensity::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::WhitePointX::Id: { + using T = MN::WhitePointX::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WhitePointX attribute value is %s",unify_value.dump().c_str() ); + UN::WhitePointX::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::WhitePointX::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::WhitePointY::Id: { + using T = MN::WhitePointY::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WhitePointY attribute value is %s",unify_value.dump().c_str() ); + UN::WhitePointY::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::WhitePointY::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorPointRX::Id: { + using T = MN::ColorPointRX::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorPointRX attribute value is %s",unify_value.dump().c_str() ); + UN::ColorPointRX::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorPointRX::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorPointRY::Id: { + using T = MN::ColorPointRY::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorPointRY attribute value is %s",unify_value.dump().c_str() ); + UN::ColorPointRY::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorPointRY::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::ColorPointRIntensity::Id: { + using T = MN::ColorPointRIntensity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorPointRIntensity attribute value is %s",unify_value.dump().c_str() ); + UN::ColorPointRIntensity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorPointRIntensity::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorPointGX::Id: { + using T = MN::ColorPointGX::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorPointGX attribute value is %s",unify_value.dump().c_str() ); + UN::ColorPointGX::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorPointGX::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorPointGY::Id: { + using T = MN::ColorPointGY::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorPointGY attribute value is %s",unify_value.dump().c_str() ); + UN::ColorPointGY::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorPointGY::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::ColorPointGIntensity::Id: { + using T = MN::ColorPointGIntensity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorPointGIntensity attribute value is %s",unify_value.dump().c_str() ); + UN::ColorPointGIntensity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorPointGIntensity::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorPointBX::Id: { + using T = MN::ColorPointBX::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorPointBX attribute value is %s",unify_value.dump().c_str() ); + UN::ColorPointBX::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorPointBX::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorPointBY::Id: { + using T = MN::ColorPointBY::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorPointBY attribute value is %s",unify_value.dump().c_str() ); + UN::ColorPointBY::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorPointBY::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::ColorPointBIntensity::Id: { + using T = MN::ColorPointBIntensity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorPointBIntensity attribute value is %s",unify_value.dump().c_str() ); + UN::ColorPointBIntensity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorPointBIntensity::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::EnhancedCurrentHue::Id: { + using T = MN::EnhancedCurrentHue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EnhancedCurrentHue attribute value is %s",unify_value.dump().c_str() ); + UN::EnhancedCurrentHue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::EnhancedCurrentHue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::EnhancedColorMode::Id: { + using T = MN::EnhancedColorMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EnhancedColorMode attribute value is %s",unify_value.dump().c_str() ); + UN::EnhancedColorMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::EnhancedColorMode::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::ColorLoopActive::Id: { + using T = MN::ColorLoopActive::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorLoopActive attribute value is %s",unify_value.dump().c_str() ); + UN::ColorLoopActive::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorLoopActive::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::ColorLoopDirection::Id: { + using T = MN::ColorLoopDirection::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorLoopDirection attribute value is %s",unify_value.dump().c_str() ); + UN::ColorLoopDirection::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorLoopDirection::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorLoopTime::Id: { + using T = MN::ColorLoopTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorLoopTime attribute value is %s",unify_value.dump().c_str() ); + UN::ColorLoopTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorLoopTime::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorLoopStartEnhancedHue::Id: { + using T = MN::ColorLoopStartEnhancedHue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorLoopStartEnhancedHue attribute value is %s",unify_value.dump().c_str() ); + UN::ColorLoopStartEnhancedHue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorLoopStartEnhancedHue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorLoopStoredEnhancedHue::Id: { + using T = MN::ColorLoopStoredEnhancedHue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorLoopStoredEnhancedHue attribute value is %s",unify_value.dump().c_str() ); + UN::ColorLoopStoredEnhancedHue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorLoopStoredEnhancedHue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap16 + case MN::ColorCapabilities::Id: { + using T = MN::ColorCapabilities::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorCapabilities attribute value is %s",unify_value.dump().c_str() ); + UN::ColorCapabilities::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorCapabilities::Id, + ZCL_BITMAP16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorTempPhysicalMinMireds::Id: { + using T = MN::ColorTempPhysicalMinMireds::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorTempPhysicalMinMireds attribute value is %s",unify_value.dump().c_str() ); + UN::ColorTempPhysicalMinMireds::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorTempPhysicalMinMireds::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ColorTempPhysicalMaxMireds::Id: { + using T = MN::ColorTempPhysicalMaxMireds::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ColorTempPhysicalMaxMireds attribute value is %s",unify_value.dump().c_str() ); + UN::ColorTempPhysicalMaxMireds::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ColorTempPhysicalMaxMireds::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::CoupleColorTempToLevelMinMireds::Id: { + using T = MN::CoupleColorTempToLevelMinMireds::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CoupleColorTempToLevelMinMireds attribute value is %s",unify_value.dump().c_str() ); + UN::CoupleColorTempToLevelMinMireds::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::CoupleColorTempToLevelMinMireds::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::StartUpColorTemperatureMireds::Id: { + using T = MN::StartUpColorTemperatureMireds::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"StartUpColorTemperatureMireds attribute value is %s",unify_value.dump().c_str() ); + UN::StartUpColorTemperatureMireds::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::StartUpColorTemperatureMireds::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ColorControl::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +BallastConfigurationAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::BallastConfiguration::Attributes; + namespace UN = unify::matter_bridge::BallastConfiguration::Attributes; + if (aPath.mClusterId != Clusters::BallastConfiguration::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::PhysicalMinLevel::Id: { // type is int8u + MN::PhysicalMinLevel::TypeInfo::Type value; + UN::PhysicalMinLevel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PhysicalMaxLevel::Id: { // type is int8u + MN::PhysicalMaxLevel::TypeInfo::Type value; + UN::PhysicalMaxLevel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BallastStatus::Id: { // type is bitmap8 + MN::BallastStatus::TypeInfo::Type value; + UN::BallastStatus::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinLevel::Id: { // type is int8u + MN::MinLevel::TypeInfo::Type value; + UN::MinLevel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxLevel::Id: { // type is int8u + MN::MaxLevel::TypeInfo::Type value; + UN::MaxLevel::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::IntrinsicBalanceFactor::Id: { // type is int8u + MN::IntrinsicBalanceFactor::TypeInfo::Type value; + UN::IntrinsicBalanceFactor::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::BallastFactorAdjustment::Id: { // type is int8u + MN::BallastFactorAdjustment::TypeInfo::Type value; + UN::BallastFactorAdjustment::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LampQuantity::Id: { // type is int8u + MN::LampQuantity::TypeInfo::Type value; + UN::LampQuantity::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LampType::Id: { // type is char_string + MN::LampType::TypeInfo::Type value; + UN::LampType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LampManufacturer::Id: { // type is char_string + MN::LampManufacturer::TypeInfo::Type value; + UN::LampManufacturer::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LampRatedHours::Id: { // type is int24u + MN::LampRatedHours::TypeInfo::Type value; + UN::LampRatedHours::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LampBurnHours::Id: { // type is int24u + MN::LampBurnHours::TypeInfo::Type value; + UN::LampBurnHours::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LampAlarmMode::Id: { // type is bitmap8 + MN::LampAlarmMode::TypeInfo::Type value; + UN::LampAlarmMode::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LampBurnHoursTripPoint::Id: { // type is int24u + MN::LampBurnHoursTripPoint::TypeInfo::Type value; + UN::LampBurnHoursTripPoint::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR BallastConfigurationAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::BallastConfiguration; + + if (aPath.mClusterId != Clusters::BallastConfiguration::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/BallastConfiguration/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void BallastConfigurationAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::BallastConfiguration::Attributes; + namespace UN = unify::matter_bridge::BallastConfiguration::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::BallastConfiguration::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::BallastConfiguration::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int8u + case MN::PhysicalMinLevel::Id: { + using T = MN::PhysicalMinLevel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PhysicalMinLevel attribute value is %s",unify_value.dump().c_str() ); + UN::PhysicalMinLevel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::PhysicalMinLevel::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::PhysicalMaxLevel::Id: { + using T = MN::PhysicalMaxLevel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PhysicalMaxLevel attribute value is %s",unify_value.dump().c_str() ); + UN::PhysicalMaxLevel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::PhysicalMaxLevel::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::BallastStatus::Id: { + using T = MN::BallastStatus::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BallastStatus attribute value is %s",unify_value.dump().c_str() ); + UN::BallastStatus::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::BallastStatus::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::MinLevel::Id: { + using T = MN::MinLevel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinLevel attribute value is %s",unify_value.dump().c_str() ); + UN::MinLevel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::MinLevel::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::MaxLevel::Id: { + using T = MN::MaxLevel::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxLevel attribute value is %s",unify_value.dump().c_str() ); + UN::MaxLevel::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::MaxLevel::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::IntrinsicBalanceFactor::Id: { + using T = MN::IntrinsicBalanceFactor::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"IntrinsicBalanceFactor attribute value is %s",unify_value.dump().c_str() ); + UN::IntrinsicBalanceFactor::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::IntrinsicBalanceFactor::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::BallastFactorAdjustment::Id: { + using T = MN::BallastFactorAdjustment::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"BallastFactorAdjustment attribute value is %s",unify_value.dump().c_str() ); + UN::BallastFactorAdjustment::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::BallastFactorAdjustment::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::LampQuantity::Id: { + using T = MN::LampQuantity::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LampQuantity attribute value is %s",unify_value.dump().c_str() ); + UN::LampQuantity::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::LampQuantity::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::LampType::Id: { + using T = MN::LampType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LampType attribute value is %s",unify_value.dump().c_str() ); + UN::LampType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::LampType::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::LampManufacturer::Id: { + using T = MN::LampManufacturer::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LampManufacturer attribute value is %s",unify_value.dump().c_str() ); + UN::LampManufacturer::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::LampManufacturer::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int24u + case MN::LampRatedHours::Id: { + using T = MN::LampRatedHours::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LampRatedHours attribute value is %s",unify_value.dump().c_str() ); + UN::LampRatedHours::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::LampRatedHours::Id, + ZCL_INT24U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int24u + case MN::LampBurnHours::Id: { + using T = MN::LampBurnHours::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LampBurnHours attribute value is %s",unify_value.dump().c_str() ); + UN::LampBurnHours::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::LampBurnHours::Id, + ZCL_INT24U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::LampAlarmMode::Id: { + using T = MN::LampAlarmMode::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LampAlarmMode attribute value is %s",unify_value.dump().c_str() ); + UN::LampAlarmMode::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::LampAlarmMode::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int24u + case MN::LampBurnHoursTripPoint::Id: { + using T = MN::LampBurnHoursTripPoint::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LampBurnHoursTripPoint attribute value is %s",unify_value.dump().c_str() ); + UN::LampBurnHoursTripPoint::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::LampBurnHoursTripPoint::Id, + ZCL_INT24U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::BallastConfiguration::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +IlluminanceMeasurementAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::IlluminanceMeasurement::Attributes; + namespace UN = unify::matter_bridge::IlluminanceMeasurement::Attributes; + if (aPath.mClusterId != Clusters::IlluminanceMeasurement::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::MeasuredValue::Id: { // type is int16u + MN::MeasuredValue::TypeInfo::Type value; + UN::MeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinMeasuredValue::Id: { // type is int16u + MN::MinMeasuredValue::TypeInfo::Type value; + UN::MinMeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxMeasuredValue::Id: { // type is int16u + MN::MaxMeasuredValue::TypeInfo::Type value; + UN::MaxMeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Tolerance::Id: { // type is int16u + MN::Tolerance::TypeInfo::Type value; + UN::Tolerance::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LightSensorType::Id: { // type is enum8 + MN::LightSensorType::TypeInfo::Type value; + UN::LightSensorType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR IlluminanceMeasurementAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::IlluminanceMeasurement; + + if (aPath.mClusterId != Clusters::IlluminanceMeasurement::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/IlluminanceMeasurement/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void IlluminanceMeasurementAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::IlluminanceMeasurement::Attributes; + namespace UN = unify::matter_bridge::IlluminanceMeasurement::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::IlluminanceMeasurement::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::IlluminanceMeasurement::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16u + case MN::MeasuredValue::Id: { + using T = MN::MeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::IlluminanceMeasurement::Id, + MN::MeasuredValue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MinMeasuredValue::Id: { + using T = MN::MinMeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinMeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MinMeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::IlluminanceMeasurement::Id, + MN::MinMeasuredValue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MaxMeasuredValue::Id: { + using T = MN::MaxMeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxMeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MaxMeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::IlluminanceMeasurement::Id, + MN::MaxMeasuredValue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Tolerance::Id: { + using T = MN::Tolerance::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Tolerance attribute value is %s",unify_value.dump().c_str() ); + UN::Tolerance::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::IlluminanceMeasurement::Id, + MN::Tolerance::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::LightSensorType::Id: { + using T = MN::LightSensorType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LightSensorType attribute value is %s",unify_value.dump().c_str() ); + UN::LightSensorType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::IlluminanceMeasurement::Id, + MN::LightSensorType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::IlluminanceMeasurement::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::IlluminanceMeasurement::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +TemperatureMeasurementAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::TemperatureMeasurement::Attributes; + namespace UN = unify::matter_bridge::TemperatureMeasurement::Attributes; + if (aPath.mClusterId != Clusters::TemperatureMeasurement::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::MeasuredValue::Id: { // type is int16s + MN::MeasuredValue::TypeInfo::Type value; + UN::MeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinMeasuredValue::Id: { // type is int16s + MN::MinMeasuredValue::TypeInfo::Type value; + UN::MinMeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxMeasuredValue::Id: { // type is int16s + MN::MaxMeasuredValue::TypeInfo::Type value; + UN::MaxMeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Tolerance::Id: { // type is int16u + MN::Tolerance::TypeInfo::Type value; + UN::Tolerance::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR TemperatureMeasurementAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::TemperatureMeasurement; + + if (aPath.mClusterId != Clusters::TemperatureMeasurement::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/TemperatureMeasurement/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void TemperatureMeasurementAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::TemperatureMeasurement::Attributes; + namespace UN = unify::matter_bridge::TemperatureMeasurement::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::TemperatureMeasurement::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::TemperatureMeasurement::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16s + case MN::MeasuredValue::Id: { + using T = MN::MeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TemperatureMeasurement::Id, + MN::MeasuredValue::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MinMeasuredValue::Id: { + using T = MN::MinMeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinMeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MinMeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TemperatureMeasurement::Id, + MN::MinMeasuredValue::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MaxMeasuredValue::Id: { + using T = MN::MaxMeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxMeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MaxMeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TemperatureMeasurement::Id, + MN::MaxMeasuredValue::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Tolerance::Id: { + using T = MN::Tolerance::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Tolerance attribute value is %s",unify_value.dump().c_str() ); + UN::Tolerance::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TemperatureMeasurement::Id, + MN::Tolerance::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TemperatureMeasurement::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TemperatureMeasurement::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +PressureMeasurementAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::PressureMeasurement::Attributes; + namespace UN = unify::matter_bridge::PressureMeasurement::Attributes; + if (aPath.mClusterId != Clusters::PressureMeasurement::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::MeasuredValue::Id: { // type is int16s + MN::MeasuredValue::TypeInfo::Type value; + UN::MeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinMeasuredValue::Id: { // type is int16s + MN::MinMeasuredValue::TypeInfo::Type value; + UN::MinMeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxMeasuredValue::Id: { // type is int16s + MN::MaxMeasuredValue::TypeInfo::Type value; + UN::MaxMeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Tolerance::Id: { // type is int16u + MN::Tolerance::TypeInfo::Type value; + UN::Tolerance::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ScaledValue::Id: { // type is int16s + MN::ScaledValue::TypeInfo::Type value; + UN::ScaledValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinScaledValue::Id: { // type is int16s + MN::MinScaledValue::TypeInfo::Type value; + UN::MinScaledValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxScaledValue::Id: { // type is int16s + MN::MaxScaledValue::TypeInfo::Type value; + UN::MaxScaledValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ScaledTolerance::Id: { // type is int16u + MN::ScaledTolerance::TypeInfo::Type value; + UN::ScaledTolerance::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Scale::Id: { // type is int8s + MN::Scale::TypeInfo::Type value; + UN::Scale::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR PressureMeasurementAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::PressureMeasurement; + + if (aPath.mClusterId != Clusters::PressureMeasurement::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/PressureMeasurement/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void PressureMeasurementAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::PressureMeasurement::Attributes; + namespace UN = unify::matter_bridge::PressureMeasurement::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::PressureMeasurement::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::PressureMeasurement::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16s + case MN::MeasuredValue::Id: { + using T = MN::MeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PressureMeasurement::Id, + MN::MeasuredValue::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MinMeasuredValue::Id: { + using T = MN::MinMeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinMeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MinMeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PressureMeasurement::Id, + MN::MinMeasuredValue::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MaxMeasuredValue::Id: { + using T = MN::MaxMeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxMeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MaxMeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PressureMeasurement::Id, + MN::MaxMeasuredValue::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Tolerance::Id: { + using T = MN::Tolerance::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Tolerance attribute value is %s",unify_value.dump().c_str() ); + UN::Tolerance::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PressureMeasurement::Id, + MN::Tolerance::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ScaledValue::Id: { + using T = MN::ScaledValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ScaledValue attribute value is %s",unify_value.dump().c_str() ); + UN::ScaledValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PressureMeasurement::Id, + MN::ScaledValue::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MinScaledValue::Id: { + using T = MN::MinScaledValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinScaledValue attribute value is %s",unify_value.dump().c_str() ); + UN::MinScaledValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PressureMeasurement::Id, + MN::MinScaledValue::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MaxScaledValue::Id: { + using T = MN::MaxScaledValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxScaledValue attribute value is %s",unify_value.dump().c_str() ); + UN::MaxScaledValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PressureMeasurement::Id, + MN::MaxScaledValue::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ScaledTolerance::Id: { + using T = MN::ScaledTolerance::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ScaledTolerance attribute value is %s",unify_value.dump().c_str() ); + UN::ScaledTolerance::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PressureMeasurement::Id, + MN::ScaledTolerance::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::Scale::Id: { + using T = MN::Scale::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Scale attribute value is %s",unify_value.dump().c_str() ); + UN::Scale::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PressureMeasurement::Id, + MN::Scale::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PressureMeasurement::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::PressureMeasurement::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +FlowMeasurementAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::FlowMeasurement::Attributes; + namespace UN = unify::matter_bridge::FlowMeasurement::Attributes; + if (aPath.mClusterId != Clusters::FlowMeasurement::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::MeasuredValue::Id: { // type is int16u + MN::MeasuredValue::TypeInfo::Type value; + UN::MeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinMeasuredValue::Id: { // type is int16u + MN::MinMeasuredValue::TypeInfo::Type value; + UN::MinMeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxMeasuredValue::Id: { // type is int16u + MN::MaxMeasuredValue::TypeInfo::Type value; + UN::MaxMeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Tolerance::Id: { // type is int16u + MN::Tolerance::TypeInfo::Type value; + UN::Tolerance::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR FlowMeasurementAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::FlowMeasurement; + + if (aPath.mClusterId != Clusters::FlowMeasurement::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/FlowMeasurement/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void FlowMeasurementAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::FlowMeasurement::Attributes; + namespace UN = unify::matter_bridge::FlowMeasurement::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::FlowMeasurement::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::FlowMeasurement::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16u + case MN::MeasuredValue::Id: { + using T = MN::MeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FlowMeasurement::Id, + MN::MeasuredValue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MinMeasuredValue::Id: { + using T = MN::MinMeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinMeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MinMeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FlowMeasurement::Id, + MN::MinMeasuredValue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MaxMeasuredValue::Id: { + using T = MN::MaxMeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxMeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MaxMeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FlowMeasurement::Id, + MN::MaxMeasuredValue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Tolerance::Id: { + using T = MN::Tolerance::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Tolerance attribute value is %s",unify_value.dump().c_str() ); + UN::Tolerance::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FlowMeasurement::Id, + MN::Tolerance::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FlowMeasurement::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FlowMeasurement::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +RelativeHumidityMeasurementAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::RelativeHumidityMeasurement::Attributes; + namespace UN = unify::matter_bridge::RelativeHumidityMeasurement::Attributes; + if (aPath.mClusterId != Clusters::RelativeHumidityMeasurement::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::MeasuredValue::Id: { // type is int16u + MN::MeasuredValue::TypeInfo::Type value; + UN::MeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MinMeasuredValue::Id: { // type is int16u + MN::MinMeasuredValue::TypeInfo::Type value; + UN::MinMeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MaxMeasuredValue::Id: { // type is int16u + MN::MaxMeasuredValue::TypeInfo::Type value; + UN::MaxMeasuredValue::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Tolerance::Id: { // type is int16u + MN::Tolerance::TypeInfo::Type value; + UN::Tolerance::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR RelativeHumidityMeasurementAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::RelativeHumidityMeasurement; + + if (aPath.mClusterId != Clusters::RelativeHumidityMeasurement::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/RelativeHumidityMeasurement/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void RelativeHumidityMeasurementAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::RelativeHumidityMeasurement::Attributes; + namespace UN = unify::matter_bridge::RelativeHumidityMeasurement::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::RelativeHumidityMeasurement::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::RelativeHumidityMeasurement::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int16u + case MN::MeasuredValue::Id: { + using T = MN::MeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::RelativeHumidityMeasurement::Id, + MN::MeasuredValue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MinMeasuredValue::Id: { + using T = MN::MinMeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MinMeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MinMeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::RelativeHumidityMeasurement::Id, + MN::MinMeasuredValue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::MaxMeasuredValue::Id: { + using T = MN::MaxMeasuredValue::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MaxMeasuredValue attribute value is %s",unify_value.dump().c_str() ); + UN::MaxMeasuredValue::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::RelativeHumidityMeasurement::Id, + MN::MaxMeasuredValue::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Tolerance::Id: { + using T = MN::Tolerance::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Tolerance attribute value is %s",unify_value.dump().c_str() ); + UN::Tolerance::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::RelativeHumidityMeasurement::Id, + MN::Tolerance::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::RelativeHumidityMeasurement::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::RelativeHumidityMeasurement::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +OccupancySensingAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::OccupancySensing::Attributes; + namespace UN = unify::matter_bridge::OccupancySensing::Attributes; + if (aPath.mClusterId != Clusters::OccupancySensing::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::Occupancy::Id: { // type is bitmap8 + MN::Occupancy::TypeInfo::Type value; + UN::Occupancy::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OccupancySensorType::Id: { // type is enum8 + MN::OccupancySensorType::TypeInfo::Type value; + UN::OccupancySensorType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OccupancySensorTypeBitmap::Id: { // type is bitmap8 + MN::OccupancySensorTypeBitmap::TypeInfo::Type value; + UN::OccupancySensorTypeBitmap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PirOccupiedToUnoccupiedDelay::Id: { // type is int16u + MN::PirOccupiedToUnoccupiedDelay::TypeInfo::Type value; + UN::PirOccupiedToUnoccupiedDelay::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PirUnoccupiedToOccupiedDelay::Id: { // type is int16u + MN::PirUnoccupiedToOccupiedDelay::TypeInfo::Type value; + UN::PirUnoccupiedToOccupiedDelay::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PirUnoccupiedToOccupiedThreshold::Id: { // type is int8u + MN::PirUnoccupiedToOccupiedThreshold::TypeInfo::Type value; + UN::PirUnoccupiedToOccupiedThreshold::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UltrasonicOccupiedToUnoccupiedDelay::Id: { // type is int16u + MN::UltrasonicOccupiedToUnoccupiedDelay::TypeInfo::Type value; + UN::UltrasonicOccupiedToUnoccupiedDelay::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UltrasonicUnoccupiedToOccupiedDelay::Id: { // type is int16u + MN::UltrasonicUnoccupiedToOccupiedDelay::TypeInfo::Type value; + UN::UltrasonicUnoccupiedToOccupiedDelay::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::UltrasonicUnoccupiedToOccupiedThreshold::Id: { // type is int8u + MN::UltrasonicUnoccupiedToOccupiedThreshold::TypeInfo::Type value; + UN::UltrasonicUnoccupiedToOccupiedThreshold::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PhysicalContactOccupiedToUnoccupiedDelay::Id: { // type is int16u + MN::PhysicalContactOccupiedToUnoccupiedDelay::TypeInfo::Type value; + UN::PhysicalContactOccupiedToUnoccupiedDelay::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PhysicalContactUnoccupiedToOccupiedDelay::Id: { // type is int16u + MN::PhysicalContactUnoccupiedToOccupiedDelay::TypeInfo::Type value; + UN::PhysicalContactUnoccupiedToOccupiedDelay::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PhysicalContactUnoccupiedToOccupiedThreshold::Id: { // type is int8u + MN::PhysicalContactUnoccupiedToOccupiedThreshold::TypeInfo::Type value; + UN::PhysicalContactUnoccupiedToOccupiedThreshold::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR OccupancySensingAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::OccupancySensing; + + if (aPath.mClusterId != Clusters::OccupancySensing::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/OccupancySensing/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void OccupancySensingAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::OccupancySensing::Attributes; + namespace UN = unify::matter_bridge::OccupancySensing::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::OccupancySensing::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::OccupancySensing::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap8 + case MN::Occupancy::Id: { + using T = MN::Occupancy::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Occupancy attribute value is %s",unify_value.dump().c_str() ); + UN::Occupancy::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::Occupancy::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::OccupancySensorType::Id: { + using T = MN::OccupancySensorType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OccupancySensorType attribute value is %s",unify_value.dump().c_str() ); + UN::OccupancySensorType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::OccupancySensorType::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::OccupancySensorTypeBitmap::Id: { + using T = MN::OccupancySensorTypeBitmap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OccupancySensorTypeBitmap attribute value is %s",unify_value.dump().c_str() ); + UN::OccupancySensorTypeBitmap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::OccupancySensorTypeBitmap::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::PirOccupiedToUnoccupiedDelay::Id: { + using T = MN::PirOccupiedToUnoccupiedDelay::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PirOccupiedToUnoccupiedDelay attribute value is %s",unify_value.dump().c_str() ); + UN::PirOccupiedToUnoccupiedDelay::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::PirOccupiedToUnoccupiedDelay::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::PirUnoccupiedToOccupiedDelay::Id: { + using T = MN::PirUnoccupiedToOccupiedDelay::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PirUnoccupiedToOccupiedDelay attribute value is %s",unify_value.dump().c_str() ); + UN::PirUnoccupiedToOccupiedDelay::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::PirUnoccupiedToOccupiedDelay::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::PirUnoccupiedToOccupiedThreshold::Id: { + using T = MN::PirUnoccupiedToOccupiedThreshold::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PirUnoccupiedToOccupiedThreshold attribute value is %s",unify_value.dump().c_str() ); + UN::PirUnoccupiedToOccupiedThreshold::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::PirUnoccupiedToOccupiedThreshold::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::UltrasonicOccupiedToUnoccupiedDelay::Id: { + using T = MN::UltrasonicOccupiedToUnoccupiedDelay::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UltrasonicOccupiedToUnoccupiedDelay attribute value is %s",unify_value.dump().c_str() ); + UN::UltrasonicOccupiedToUnoccupiedDelay::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::UltrasonicOccupiedToUnoccupiedDelay::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::UltrasonicUnoccupiedToOccupiedDelay::Id: { + using T = MN::UltrasonicUnoccupiedToOccupiedDelay::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UltrasonicUnoccupiedToOccupiedDelay attribute value is %s",unify_value.dump().c_str() ); + UN::UltrasonicUnoccupiedToOccupiedDelay::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::UltrasonicUnoccupiedToOccupiedDelay::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::UltrasonicUnoccupiedToOccupiedThreshold::Id: { + using T = MN::UltrasonicUnoccupiedToOccupiedThreshold::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"UltrasonicUnoccupiedToOccupiedThreshold attribute value is %s",unify_value.dump().c_str() ); + UN::UltrasonicUnoccupiedToOccupiedThreshold::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::UltrasonicUnoccupiedToOccupiedThreshold::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::PhysicalContactOccupiedToUnoccupiedDelay::Id: { + using T = MN::PhysicalContactOccupiedToUnoccupiedDelay::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PhysicalContactOccupiedToUnoccupiedDelay attribute value is %s",unify_value.dump().c_str() ); + UN::PhysicalContactOccupiedToUnoccupiedDelay::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::PhysicalContactOccupiedToUnoccupiedDelay::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::PhysicalContactUnoccupiedToOccupiedDelay::Id: { + using T = MN::PhysicalContactUnoccupiedToOccupiedDelay::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PhysicalContactUnoccupiedToOccupiedDelay attribute value is %s",unify_value.dump().c_str() ); + UN::PhysicalContactUnoccupiedToOccupiedDelay::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::PhysicalContactUnoccupiedToOccupiedDelay::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::PhysicalContactUnoccupiedToOccupiedThreshold::Id: { + using T = MN::PhysicalContactUnoccupiedToOccupiedThreshold::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PhysicalContactUnoccupiedToOccupiedThreshold attribute value is %s",unify_value.dump().c_str() ); + UN::PhysicalContactUnoccupiedToOccupiedThreshold::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::PhysicalContactUnoccupiedToOccupiedThreshold::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::OccupancySensing::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +WakeOnLanAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::WakeOnLan::Attributes; + namespace UN = unify::matter_bridge::WakeOnLan::Attributes; + if (aPath.mClusterId != Clusters::WakeOnLan::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::MACAddress::Id: { // type is char_string + MN::MACAddress::TypeInfo::Type value; + UN::MACAddress::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR WakeOnLanAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::WakeOnLan; + + if (aPath.mClusterId != Clusters::WakeOnLan::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/WakeOnLan/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void WakeOnLanAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::WakeOnLan::Attributes; + namespace UN = unify::matter_bridge::WakeOnLan::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::WakeOnLan::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::WakeOnLan::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is char_string + case MN::MACAddress::Id: { + using T = MN::MACAddress::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MACAddress attribute value is %s",unify_value.dump().c_str() ); + UN::MACAddress::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WakeOnLan::Id, + MN::MACAddress::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WakeOnLan::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::WakeOnLan::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ChannelAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::Channel::Attributes; + namespace UN = unify::matter_bridge::Channel::Attributes; + if (aPath.mClusterId != Clusters::Channel::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ChannelAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::Channel; + + if (aPath.mClusterId != Clusters::Channel::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/Channel/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ChannelAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::Channel::Attributes; + namespace UN = unify::matter_bridge::Channel::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::Channel::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::Channel::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Channel::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::Channel::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +TargetNavigatorAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::TargetNavigator::Attributes; + namespace UN = unify::matter_bridge::TargetNavigator::Attributes; + if (aPath.mClusterId != Clusters::TargetNavigator::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + case MN::CurrentTarget::Id: { // type is int8u + MN::CurrentTarget::TypeInfo::Type value; + UN::CurrentTarget::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR TargetNavigatorAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::TargetNavigator; + + if (aPath.mClusterId != Clusters::TargetNavigator::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/TargetNavigator/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void TargetNavigatorAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::TargetNavigator::Attributes; + namespace UN = unify::matter_bridge::TargetNavigator::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::TargetNavigator::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::TargetNavigator::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int8u + case MN::CurrentTarget::Id: { + using T = MN::CurrentTarget::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentTarget attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentTarget::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TargetNavigator::Id, + MN::CurrentTarget::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TargetNavigator::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TargetNavigator::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +MediaPlaybackAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::MediaPlayback::Attributes; + namespace UN = unify::matter_bridge::MediaPlayback::Attributes; + if (aPath.mClusterId != Clusters::MediaPlayback::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::CurrentState::Id: { // type is PlaybackStateEnum + MN::CurrentState::TypeInfo::Type value; + UN::CurrentState::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::StartTime::Id: { // type is epoch_us + MN::StartTime::TypeInfo::Type value; + UN::StartTime::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Duration::Id: { // type is int64u + MN::Duration::TypeInfo::Type value; + UN::Duration::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::PlaybackSpeed::Id: { // type is single + MN::PlaybackSpeed::TypeInfo::Type value; + UN::PlaybackSpeed::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SeekRangeEnd::Id: { // type is int64u + MN::SeekRangeEnd::TypeInfo::Type value; + UN::SeekRangeEnd::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::SeekRangeStart::Id: { // type is int64u + MN::SeekRangeStart::TypeInfo::Type value; + UN::SeekRangeStart::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR MediaPlaybackAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::MediaPlayback; + + if (aPath.mClusterId != Clusters::MediaPlayback::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/MediaPlayback/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void MediaPlaybackAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::MediaPlayback::Attributes; + namespace UN = unify::matter_bridge::MediaPlayback::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::MediaPlayback::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::MediaPlayback::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is PlaybackStateEnum + case MN::CurrentState::Id: { + using T = MN::CurrentState::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentState attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentState::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::MediaPlayback::Id, + MN::CurrentState::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is epoch_us + case MN::StartTime::Id: { + using T = MN::StartTime::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"StartTime attribute value is %s",unify_value.dump().c_str() ); + UN::StartTime::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::MediaPlayback::Id, + MN::StartTime::Id, + ZCL_EPOCH_US_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::Duration::Id: { + using T = MN::Duration::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Duration attribute value is %s",unify_value.dump().c_str() ); + UN::Duration::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::MediaPlayback::Id, + MN::Duration::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is single + case MN::PlaybackSpeed::Id: { + using T = MN::PlaybackSpeed::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PlaybackSpeed attribute value is %s",unify_value.dump().c_str() ); + UN::PlaybackSpeed::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::MediaPlayback::Id, + MN::PlaybackSpeed::Id, + ZCL_SINGLE_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::SeekRangeEnd::Id: { + using T = MN::SeekRangeEnd::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SeekRangeEnd attribute value is %s",unify_value.dump().c_str() ); + UN::SeekRangeEnd::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::MediaPlayback::Id, + MN::SeekRangeEnd::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::SeekRangeStart::Id: { + using T = MN::SeekRangeStart::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SeekRangeStart attribute value is %s",unify_value.dump().c_str() ); + UN::SeekRangeStart::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::MediaPlayback::Id, + MN::SeekRangeStart::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::MediaPlayback::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::MediaPlayback::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +MediaInputAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::MediaInput::Attributes; + namespace UN = unify::matter_bridge::MediaInput::Attributes; + if (aPath.mClusterId != Clusters::MediaInput::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + case MN::CurrentInput::Id: { // type is int8u + MN::CurrentInput::TypeInfo::Type value; + UN::CurrentInput::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR MediaInputAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::MediaInput; + + if (aPath.mClusterId != Clusters::MediaInput::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/MediaInput/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void MediaInputAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::MediaInput::Attributes; + namespace UN = unify::matter_bridge::MediaInput::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::MediaInput::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::MediaInput::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int8u + case MN::CurrentInput::Id: { + using T = MN::CurrentInput::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentInput attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentInput::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::MediaInput::Id, + MN::CurrentInput::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::MediaInput::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::MediaInput::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +LowPowerAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::LowPower::Attributes; + namespace UN = unify::matter_bridge::LowPower::Attributes; + if (aPath.mClusterId != Clusters::LowPower::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR LowPowerAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::LowPower; + + if (aPath.mClusterId != Clusters::LowPower::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/LowPower/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void LowPowerAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::LowPower::Attributes; + namespace UN = unify::matter_bridge::LowPower::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::LowPower::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::LowPower::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LowPower::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::LowPower::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +KeypadInputAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::KeypadInput::Attributes; + namespace UN = unify::matter_bridge::KeypadInput::Attributes; + if (aPath.mClusterId != Clusters::KeypadInput::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR KeypadInputAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::KeypadInput; + + if (aPath.mClusterId != Clusters::KeypadInput::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/KeypadInput/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void KeypadInputAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::KeypadInput::Attributes; + namespace UN = unify::matter_bridge::KeypadInput::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::KeypadInput::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::KeypadInput::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::KeypadInput::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::KeypadInput::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ContentLauncherAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::ContentLauncher::Attributes; + namespace UN = unify::matter_bridge::ContentLauncher::Attributes; + if (aPath.mClusterId != Clusters::ContentLauncher::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + case MN::SupportedStreamingProtocols::Id: { // type is bitmap32 + MN::SupportedStreamingProtocols::TypeInfo::Type value; + UN::SupportedStreamingProtocols::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ContentLauncherAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::ContentLauncher; + + if (aPath.mClusterId != Clusters::ContentLauncher::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/ContentLauncher/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ContentLauncherAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::ContentLauncher::Attributes; + namespace UN = unify::matter_bridge::ContentLauncher::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::ContentLauncher::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::ContentLauncher::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::SupportedStreamingProtocols::Id: { + using T = MN::SupportedStreamingProtocols::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"SupportedStreamingProtocols attribute value is %s",unify_value.dump().c_str() ); + UN::SupportedStreamingProtocols::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ContentLauncher::Id, + MN::SupportedStreamingProtocols::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ContentLauncher::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ContentLauncher::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +AudioOutputAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::AudioOutput::Attributes; + namespace UN = unify::matter_bridge::AudioOutput::Attributes; + if (aPath.mClusterId != Clusters::AudioOutput::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + case MN::CurrentOutput::Id: { // type is int8u + MN::CurrentOutput::TypeInfo::Type value; + UN::CurrentOutput::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR AudioOutputAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::AudioOutput; + + if (aPath.mClusterId != Clusters::AudioOutput::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/AudioOutput/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void AudioOutputAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::AudioOutput::Attributes; + namespace UN = unify::matter_bridge::AudioOutput::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::AudioOutput::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::AudioOutput::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is int8u + case MN::CurrentOutput::Id: { + using T = MN::CurrentOutput::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentOutput attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentOutput::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AudioOutput::Id, + MN::CurrentOutput::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AudioOutput::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AudioOutput::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ApplicationLauncherAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::ApplicationLauncher::Attributes; + namespace UN = unify::matter_bridge::ApplicationLauncher::Attributes; + if (aPath.mClusterId != Clusters::ApplicationLauncher::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ApplicationLauncherAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::ApplicationLauncher; + + if (aPath.mClusterId != Clusters::ApplicationLauncher::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/ApplicationLauncher/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ApplicationLauncherAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::ApplicationLauncher::Attributes; + namespace UN = unify::matter_bridge::ApplicationLauncher::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::ApplicationLauncher::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::ApplicationLauncher::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ApplicationLauncher::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ApplicationLauncher::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ApplicationBasicAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::ApplicationBasic::Attributes; + namespace UN = unify::matter_bridge::ApplicationBasic::Attributes; + if (aPath.mClusterId != Clusters::ApplicationBasic::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::VendorName::Id: { // type is char_string + MN::VendorName::TypeInfo::Type value; + UN::VendorName::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::VendorID::Id: { // type is vendor_id + MN::VendorID::TypeInfo::Type value; + UN::VendorID::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ApplicationName::Id: { // type is char_string + MN::ApplicationName::TypeInfo::Type value; + UN::ApplicationName::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ProductID::Id: { // type is int16u + MN::ProductID::TypeInfo::Type value; + UN::ProductID::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::Status::Id: { // type is ApplicationStatusEnum + MN::Status::TypeInfo::Type value; + UN::Status::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ApplicationVersion::Id: { // type is char_string + MN::ApplicationVersion::TypeInfo::Type value; + UN::ApplicationVersion::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ApplicationBasicAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::ApplicationBasic; + + if (aPath.mClusterId != Clusters::ApplicationBasic::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/ApplicationBasic/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ApplicationBasicAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::ApplicationBasic::Attributes; + namespace UN = unify::matter_bridge::ApplicationBasic::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::ApplicationBasic::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::ApplicationBasic::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is char_string + case MN::VendorName::Id: { + using T = MN::VendorName::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"VendorName attribute value is %s",unify_value.dump().c_str() ); + UN::VendorName::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ApplicationBasic::Id, + MN::VendorName::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is vendor_id + case MN::VendorID::Id: { + using T = MN::VendorID::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"VendorID attribute value is %s",unify_value.dump().c_str() ); + UN::VendorID::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ApplicationBasic::Id, + MN::VendorID::Id, + ZCL_VENDOR_ID_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::ApplicationName::Id: { + using T = MN::ApplicationName::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ApplicationName attribute value is %s",unify_value.dump().c_str() ); + UN::ApplicationName::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ApplicationBasic::Id, + MN::ApplicationName::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ProductID::Id: { + using T = MN::ProductID::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ProductID attribute value is %s",unify_value.dump().c_str() ); + UN::ProductID::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ApplicationBasic::Id, + MN::ProductID::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is ApplicationStatusEnum + case MN::Status::Id: { + using T = MN::Status::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Status attribute value is %s",unify_value.dump().c_str() ); + UN::Status::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ApplicationBasic::Id, + MN::Status::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::ApplicationVersion::Id: { + using T = MN::ApplicationVersion::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ApplicationVersion attribute value is %s",unify_value.dump().c_str() ); + UN::ApplicationVersion::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ApplicationBasic::Id, + MN::ApplicationVersion::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ApplicationBasic::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ApplicationBasic::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +AccountLoginAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::AccountLogin::Attributes; + namespace UN = unify::matter_bridge::AccountLogin::Attributes; + if (aPath.mClusterId != Clusters::AccountLogin::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR AccountLoginAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::AccountLogin; + + if (aPath.mClusterId != Clusters::AccountLogin::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/AccountLogin/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void AccountLoginAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::AccountLogin::Attributes; + namespace UN = unify::matter_bridge::AccountLogin::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::AccountLogin::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::AccountLogin::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AccountLogin::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::AccountLogin::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +ElectricalMeasurementAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::ElectricalMeasurement::Attributes; + namespace UN = unify::matter_bridge::ElectricalMeasurement::Attributes; + if (aPath.mClusterId != Clusters::ElectricalMeasurement::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::MeasurementType::Id: { // type is bitmap32 + MN::MeasurementType::TypeInfo::Type value; + UN::MeasurementType::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcVoltage::Id: { // type is int16s + MN::DcVoltage::TypeInfo::Type value; + UN::DcVoltage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcVoltageMin::Id: { // type is int16s + MN::DcVoltageMin::TypeInfo::Type value; + UN::DcVoltageMin::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcVoltageMax::Id: { // type is int16s + MN::DcVoltageMax::TypeInfo::Type value; + UN::DcVoltageMax::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcCurrent::Id: { // type is int16s + MN::DcCurrent::TypeInfo::Type value; + UN::DcCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcCurrentMin::Id: { // type is int16s + MN::DcCurrentMin::TypeInfo::Type value; + UN::DcCurrentMin::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcCurrentMax::Id: { // type is int16s + MN::DcCurrentMax::TypeInfo::Type value; + UN::DcCurrentMax::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcPower::Id: { // type is int16s + MN::DcPower::TypeInfo::Type value; + UN::DcPower::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcPowerMin::Id: { // type is int16s + MN::DcPowerMin::TypeInfo::Type value; + UN::DcPowerMin::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcPowerMax::Id: { // type is int16s + MN::DcPowerMax::TypeInfo::Type value; + UN::DcPowerMax::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcVoltageMultiplier::Id: { // type is int16u + MN::DcVoltageMultiplier::TypeInfo::Type value; + UN::DcVoltageMultiplier::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcVoltageDivisor::Id: { // type is int16u + MN::DcVoltageDivisor::TypeInfo::Type value; + UN::DcVoltageDivisor::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcCurrentMultiplier::Id: { // type is int16u + MN::DcCurrentMultiplier::TypeInfo::Type value; + UN::DcCurrentMultiplier::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcCurrentDivisor::Id: { // type is int16u + MN::DcCurrentDivisor::TypeInfo::Type value; + UN::DcCurrentDivisor::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcPowerMultiplier::Id: { // type is int16u + MN::DcPowerMultiplier::TypeInfo::Type value; + UN::DcPowerMultiplier::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::DcPowerDivisor::Id: { // type is int16u + MN::DcPowerDivisor::TypeInfo::Type value; + UN::DcPowerDivisor::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcFrequency::Id: { // type is int16u + MN::AcFrequency::TypeInfo::Type value; + UN::AcFrequency::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcFrequencyMin::Id: { // type is int16u + MN::AcFrequencyMin::TypeInfo::Type value; + UN::AcFrequencyMin::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcFrequencyMax::Id: { // type is int16u + MN::AcFrequencyMax::TypeInfo::Type value; + UN::AcFrequencyMax::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NeutralCurrent::Id: { // type is int16u + MN::NeutralCurrent::TypeInfo::Type value; + UN::NeutralCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TotalActivePower::Id: { // type is int32s + MN::TotalActivePower::TypeInfo::Type value; + UN::TotalActivePower::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TotalReactivePower::Id: { // type is int32s + MN::TotalReactivePower::TypeInfo::Type value; + UN::TotalReactivePower::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::TotalApparentPower::Id: { // type is int32u + MN::TotalApparentPower::TypeInfo::Type value; + UN::TotalApparentPower::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Measured1stHarmonicCurrent::Id: { // type is int16s + MN::Measured1stHarmonicCurrent::TypeInfo::Type value; + UN::Measured1stHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Measured3rdHarmonicCurrent::Id: { // type is int16s + MN::Measured3rdHarmonicCurrent::TypeInfo::Type value; + UN::Measured3rdHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Measured5thHarmonicCurrent::Id: { // type is int16s + MN::Measured5thHarmonicCurrent::TypeInfo::Type value; + UN::Measured5thHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Measured7thHarmonicCurrent::Id: { // type is int16s + MN::Measured7thHarmonicCurrent::TypeInfo::Type value; + UN::Measured7thHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Measured9thHarmonicCurrent::Id: { // type is int16s + MN::Measured9thHarmonicCurrent::TypeInfo::Type value; + UN::Measured9thHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Measured11thHarmonicCurrent::Id: { // type is int16s + MN::Measured11thHarmonicCurrent::TypeInfo::Type value; + UN::Measured11thHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MeasuredPhase1stHarmonicCurrent::Id: { // type is int16s + MN::MeasuredPhase1stHarmonicCurrent::TypeInfo::Type value; + UN::MeasuredPhase1stHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MeasuredPhase3rdHarmonicCurrent::Id: { // type is int16s + MN::MeasuredPhase3rdHarmonicCurrent::TypeInfo::Type value; + UN::MeasuredPhase3rdHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MeasuredPhase5thHarmonicCurrent::Id: { // type is int16s + MN::MeasuredPhase5thHarmonicCurrent::TypeInfo::Type value; + UN::MeasuredPhase5thHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MeasuredPhase7thHarmonicCurrent::Id: { // type is int16s + MN::MeasuredPhase7thHarmonicCurrent::TypeInfo::Type value; + UN::MeasuredPhase7thHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MeasuredPhase9thHarmonicCurrent::Id: { // type is int16s + MN::MeasuredPhase9thHarmonicCurrent::TypeInfo::Type value; + UN::MeasuredPhase9thHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::MeasuredPhase11thHarmonicCurrent::Id: { // type is int16s + MN::MeasuredPhase11thHarmonicCurrent::TypeInfo::Type value; + UN::MeasuredPhase11thHarmonicCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcFrequencyMultiplier::Id: { // type is int16u + MN::AcFrequencyMultiplier::TypeInfo::Type value; + UN::AcFrequencyMultiplier::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcFrequencyDivisor::Id: { // type is int16u + MN::AcFrequencyDivisor::TypeInfo::Type value; + UN::AcFrequencyDivisor::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PowerMultiplier::Id: { // type is int32u + MN::PowerMultiplier::TypeInfo::Type value; + UN::PowerMultiplier::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PowerDivisor::Id: { // type is int32u + MN::PowerDivisor::TypeInfo::Type value; + UN::PowerDivisor::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::HarmonicCurrentMultiplier::Id: { // type is int8s + MN::HarmonicCurrentMultiplier::TypeInfo::Type value; + UN::HarmonicCurrentMultiplier::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PhaseHarmonicCurrentMultiplier::Id: { // type is int8s + MN::PhaseHarmonicCurrentMultiplier::TypeInfo::Type value; + UN::PhaseHarmonicCurrentMultiplier::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::InstantaneousVoltage::Id: { // type is int16s + MN::InstantaneousVoltage::TypeInfo::Type value; + UN::InstantaneousVoltage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::InstantaneousLineCurrent::Id: { // type is int16u + MN::InstantaneousLineCurrent::TypeInfo::Type value; + UN::InstantaneousLineCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::InstantaneousActiveCurrent::Id: { // type is int16s + MN::InstantaneousActiveCurrent::TypeInfo::Type value; + UN::InstantaneousActiveCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::InstantaneousReactiveCurrent::Id: { // type is int16s + MN::InstantaneousReactiveCurrent::TypeInfo::Type value; + UN::InstantaneousReactiveCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::InstantaneousPower::Id: { // type is int16s + MN::InstantaneousPower::TypeInfo::Type value; + UN::InstantaneousPower::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltage::Id: { // type is int16u + MN::RmsVoltage::TypeInfo::Type value; + UN::RmsVoltage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageMin::Id: { // type is int16u + MN::RmsVoltageMin::TypeInfo::Type value; + UN::RmsVoltageMin::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageMax::Id: { // type is int16u + MN::RmsVoltageMax::TypeInfo::Type value; + UN::RmsVoltageMax::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsCurrent::Id: { // type is int16u + MN::RmsCurrent::TypeInfo::Type value; + UN::RmsCurrent::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsCurrentMin::Id: { // type is int16u + MN::RmsCurrentMin::TypeInfo::Type value; + UN::RmsCurrentMin::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsCurrentMax::Id: { // type is int16u + MN::RmsCurrentMax::TypeInfo::Type value; + UN::RmsCurrentMax::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActivePower::Id: { // type is int16s + MN::ActivePower::TypeInfo::Type value; + UN::ActivePower::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActivePowerMin::Id: { // type is int16s + MN::ActivePowerMin::TypeInfo::Type value; + UN::ActivePowerMin::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActivePowerMax::Id: { // type is int16s + MN::ActivePowerMax::TypeInfo::Type value; + UN::ActivePowerMax::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ReactivePower::Id: { // type is int16s + MN::ReactivePower::TypeInfo::Type value; + UN::ReactivePower::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ApparentPower::Id: { // type is int16u + MN::ApparentPower::TypeInfo::Type value; + UN::ApparentPower::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PowerFactor::Id: { // type is int8s + MN::PowerFactor::TypeInfo::Type value; + UN::PowerFactor::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AverageRmsVoltageMeasurementPeriod::Id: { // type is int16u + MN::AverageRmsVoltageMeasurementPeriod::TypeInfo::Type value; + UN::AverageRmsVoltageMeasurementPeriod::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AverageRmsUnderVoltageCounter::Id: { // type is int16u + MN::AverageRmsUnderVoltageCounter::TypeInfo::Type value; + UN::AverageRmsUnderVoltageCounter::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsExtremeOverVoltagePeriod::Id: { // type is int16u + MN::RmsExtremeOverVoltagePeriod::TypeInfo::Type value; + UN::RmsExtremeOverVoltagePeriod::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsExtremeUnderVoltagePeriod::Id: { // type is int16u + MN::RmsExtremeUnderVoltagePeriod::TypeInfo::Type value; + UN::RmsExtremeUnderVoltagePeriod::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageSagPeriod::Id: { // type is int16u + MN::RmsVoltageSagPeriod::TypeInfo::Type value; + UN::RmsVoltageSagPeriod::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageSwellPeriod::Id: { // type is int16u + MN::RmsVoltageSwellPeriod::TypeInfo::Type value; + UN::RmsVoltageSwellPeriod::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcVoltageMultiplier::Id: { // type is int16u + MN::AcVoltageMultiplier::TypeInfo::Type value; + UN::AcVoltageMultiplier::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcVoltageDivisor::Id: { // type is int16u + MN::AcVoltageDivisor::TypeInfo::Type value; + UN::AcVoltageDivisor::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcCurrentMultiplier::Id: { // type is int16u + MN::AcCurrentMultiplier::TypeInfo::Type value; + UN::AcCurrentMultiplier::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcCurrentDivisor::Id: { // type is int16u + MN::AcCurrentDivisor::TypeInfo::Type value; + UN::AcCurrentDivisor::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcPowerMultiplier::Id: { // type is int16u + MN::AcPowerMultiplier::TypeInfo::Type value; + UN::AcPowerMultiplier::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcPowerDivisor::Id: { // type is int16u + MN::AcPowerDivisor::TypeInfo::Type value; + UN::AcPowerDivisor::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OverloadAlarmsMask::Id: { // type is bitmap8 + MN::OverloadAlarmsMask::TypeInfo::Type value; + UN::OverloadAlarmsMask::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::VoltageOverload::Id: { // type is int16s + MN::VoltageOverload::TypeInfo::Type value; + UN::VoltageOverload::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CurrentOverload::Id: { // type is int16s + MN::CurrentOverload::TypeInfo::Type value; + UN::CurrentOverload::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcOverloadAlarmsMask::Id: { // type is bitmap16 + MN::AcOverloadAlarmsMask::TypeInfo::Type value; + UN::AcOverloadAlarmsMask::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcVoltageOverload::Id: { // type is int16s + MN::AcVoltageOverload::TypeInfo::Type value; + UN::AcVoltageOverload::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcCurrentOverload::Id: { // type is int16s + MN::AcCurrentOverload::TypeInfo::Type value; + UN::AcCurrentOverload::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcActivePowerOverload::Id: { // type is int16s + MN::AcActivePowerOverload::TypeInfo::Type value; + UN::AcActivePowerOverload::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AcReactivePowerOverload::Id: { // type is int16s + MN::AcReactivePowerOverload::TypeInfo::Type value; + UN::AcReactivePowerOverload::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AverageRmsOverVoltage::Id: { // type is int16s + MN::AverageRmsOverVoltage::TypeInfo::Type value; + UN::AverageRmsOverVoltage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AverageRmsUnderVoltage::Id: { // type is int16s + MN::AverageRmsUnderVoltage::TypeInfo::Type value; + UN::AverageRmsUnderVoltage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsExtremeOverVoltage::Id: { // type is int16s + MN::RmsExtremeOverVoltage::TypeInfo::Type value; + UN::RmsExtremeOverVoltage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsExtremeUnderVoltage::Id: { // type is int16s + MN::RmsExtremeUnderVoltage::TypeInfo::Type value; + UN::RmsExtremeUnderVoltage::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageSag::Id: { // type is int16s + MN::RmsVoltageSag::TypeInfo::Type value; + UN::RmsVoltageSag::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageSwell::Id: { // type is int16s + MN::RmsVoltageSwell::TypeInfo::Type value; + UN::RmsVoltageSwell::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LineCurrentPhaseB::Id: { // type is int16u + MN::LineCurrentPhaseB::TypeInfo::Type value; + UN::LineCurrentPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActiveCurrentPhaseB::Id: { // type is int16s + MN::ActiveCurrentPhaseB::TypeInfo::Type value; + UN::ActiveCurrentPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ReactiveCurrentPhaseB::Id: { // type is int16s + MN::ReactiveCurrentPhaseB::TypeInfo::Type value; + UN::ReactiveCurrentPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltagePhaseB::Id: { // type is int16u + MN::RmsVoltagePhaseB::TypeInfo::Type value; + UN::RmsVoltagePhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageMinPhaseB::Id: { // type is int16u + MN::RmsVoltageMinPhaseB::TypeInfo::Type value; + UN::RmsVoltageMinPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageMaxPhaseB::Id: { // type is int16u + MN::RmsVoltageMaxPhaseB::TypeInfo::Type value; + UN::RmsVoltageMaxPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsCurrentPhaseB::Id: { // type is int16u + MN::RmsCurrentPhaseB::TypeInfo::Type value; + UN::RmsCurrentPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsCurrentMinPhaseB::Id: { // type is int16u + MN::RmsCurrentMinPhaseB::TypeInfo::Type value; + UN::RmsCurrentMinPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsCurrentMaxPhaseB::Id: { // type is int16u + MN::RmsCurrentMaxPhaseB::TypeInfo::Type value; + UN::RmsCurrentMaxPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActivePowerPhaseB::Id: { // type is int16s + MN::ActivePowerPhaseB::TypeInfo::Type value; + UN::ActivePowerPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActivePowerMinPhaseB::Id: { // type is int16s + MN::ActivePowerMinPhaseB::TypeInfo::Type value; + UN::ActivePowerMinPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActivePowerMaxPhaseB::Id: { // type is int16s + MN::ActivePowerMaxPhaseB::TypeInfo::Type value; + UN::ActivePowerMaxPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ReactivePowerPhaseB::Id: { // type is int16s + MN::ReactivePowerPhaseB::TypeInfo::Type value; + UN::ReactivePowerPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ApparentPowerPhaseB::Id: { // type is int16u + MN::ApparentPowerPhaseB::TypeInfo::Type value; + UN::ApparentPowerPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PowerFactorPhaseB::Id: { // type is int8s + MN::PowerFactorPhaseB::TypeInfo::Type value; + UN::PowerFactorPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AverageRmsVoltageMeasurementPeriodPhaseB::Id: { // type is int16u + MN::AverageRmsVoltageMeasurementPeriodPhaseB::TypeInfo::Type value; + UN::AverageRmsVoltageMeasurementPeriodPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AverageRmsOverVoltageCounterPhaseB::Id: { // type is int16u + MN::AverageRmsOverVoltageCounterPhaseB::TypeInfo::Type value; + UN::AverageRmsOverVoltageCounterPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AverageRmsUnderVoltageCounterPhaseB::Id: { // type is int16u + MN::AverageRmsUnderVoltageCounterPhaseB::TypeInfo::Type value; + UN::AverageRmsUnderVoltageCounterPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsExtremeOverVoltagePeriodPhaseB::Id: { // type is int16u + MN::RmsExtremeOverVoltagePeriodPhaseB::TypeInfo::Type value; + UN::RmsExtremeOverVoltagePeriodPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsExtremeUnderVoltagePeriodPhaseB::Id: { // type is int16u + MN::RmsExtremeUnderVoltagePeriodPhaseB::TypeInfo::Type value; + UN::RmsExtremeUnderVoltagePeriodPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageSagPeriodPhaseB::Id: { // type is int16u + MN::RmsVoltageSagPeriodPhaseB::TypeInfo::Type value; + UN::RmsVoltageSagPeriodPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageSwellPeriodPhaseB::Id: { // type is int16u + MN::RmsVoltageSwellPeriodPhaseB::TypeInfo::Type value; + UN::RmsVoltageSwellPeriodPhaseB::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LineCurrentPhaseC::Id: { // type is int16u + MN::LineCurrentPhaseC::TypeInfo::Type value; + UN::LineCurrentPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActiveCurrentPhaseC::Id: { // type is int16s + MN::ActiveCurrentPhaseC::TypeInfo::Type value; + UN::ActiveCurrentPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ReactiveCurrentPhaseC::Id: { // type is int16s + MN::ReactiveCurrentPhaseC::TypeInfo::Type value; + UN::ReactiveCurrentPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltagePhaseC::Id: { // type is int16u + MN::RmsVoltagePhaseC::TypeInfo::Type value; + UN::RmsVoltagePhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageMinPhaseC::Id: { // type is int16u + MN::RmsVoltageMinPhaseC::TypeInfo::Type value; + UN::RmsVoltageMinPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageMaxPhaseC::Id: { // type is int16u + MN::RmsVoltageMaxPhaseC::TypeInfo::Type value; + UN::RmsVoltageMaxPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsCurrentPhaseC::Id: { // type is int16u + MN::RmsCurrentPhaseC::TypeInfo::Type value; + UN::RmsCurrentPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsCurrentMinPhaseC::Id: { // type is int16u + MN::RmsCurrentMinPhaseC::TypeInfo::Type value; + UN::RmsCurrentMinPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsCurrentMaxPhaseC::Id: { // type is int16u + MN::RmsCurrentMaxPhaseC::TypeInfo::Type value; + UN::RmsCurrentMaxPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActivePowerPhaseC::Id: { // type is int16s + MN::ActivePowerPhaseC::TypeInfo::Type value; + UN::ActivePowerPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActivePowerMinPhaseC::Id: { // type is int16s + MN::ActivePowerMinPhaseC::TypeInfo::Type value; + UN::ActivePowerMinPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ActivePowerMaxPhaseC::Id: { // type is int16s + MN::ActivePowerMaxPhaseC::TypeInfo::Type value; + UN::ActivePowerMaxPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ReactivePowerPhaseC::Id: { // type is int16s + MN::ReactivePowerPhaseC::TypeInfo::Type value; + UN::ReactivePowerPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ApparentPowerPhaseC::Id: { // type is int16u + MN::ApparentPowerPhaseC::TypeInfo::Type value; + UN::ApparentPowerPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::PowerFactorPhaseC::Id: { // type is int8s + MN::PowerFactorPhaseC::TypeInfo::Type value; + UN::PowerFactorPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AverageRmsVoltageMeasurementPeriodPhaseC::Id: { // type is int16u + MN::AverageRmsVoltageMeasurementPeriodPhaseC::TypeInfo::Type value; + UN::AverageRmsVoltageMeasurementPeriodPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AverageRmsOverVoltageCounterPhaseC::Id: { // type is int16u + MN::AverageRmsOverVoltageCounterPhaseC::TypeInfo::Type value; + UN::AverageRmsOverVoltageCounterPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::AverageRmsUnderVoltageCounterPhaseC::Id: { // type is int16u + MN::AverageRmsUnderVoltageCounterPhaseC::TypeInfo::Type value; + UN::AverageRmsUnderVoltageCounterPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsExtremeOverVoltagePeriodPhaseC::Id: { // type is int16u + MN::RmsExtremeOverVoltagePeriodPhaseC::TypeInfo::Type value; + UN::RmsExtremeOverVoltagePeriodPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsExtremeUnderVoltagePeriodPhaseC::Id: { // type is int16u + MN::RmsExtremeUnderVoltagePeriodPhaseC::TypeInfo::Type value; + UN::RmsExtremeUnderVoltagePeriodPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageSagPeriodPhaseC::Id: { // type is int16u + MN::RmsVoltageSagPeriodPhaseC::TypeInfo::Type value; + UN::RmsVoltageSagPeriodPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RmsVoltageSwellPeriodPhaseC::Id: { // type is int16u + MN::RmsVoltageSwellPeriodPhaseC::TypeInfo::Type value; + UN::RmsVoltageSwellPeriodPhaseC::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ElectricalMeasurementAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::ElectricalMeasurement; + + if (aPath.mClusterId != Clusters::ElectricalMeasurement::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/ElectricalMeasurement/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void ElectricalMeasurementAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::ElectricalMeasurement::Attributes; + namespace UN = unify::matter_bridge::ElectricalMeasurement::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::ElectricalMeasurement::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::ElectricalMeasurement::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::MeasurementType::Id: { + using T = MN::MeasurementType::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasurementType attribute value is %s",unify_value.dump().c_str() ); + UN::MeasurementType::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::MeasurementType::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::DcVoltage::Id: { + using T = MN::DcVoltage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcVoltage attribute value is %s",unify_value.dump().c_str() ); + UN::DcVoltage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcVoltage::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::DcVoltageMin::Id: { + using T = MN::DcVoltageMin::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcVoltageMin attribute value is %s",unify_value.dump().c_str() ); + UN::DcVoltageMin::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcVoltageMin::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::DcVoltageMax::Id: { + using T = MN::DcVoltageMax::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcVoltageMax attribute value is %s",unify_value.dump().c_str() ); + UN::DcVoltageMax::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcVoltageMax::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::DcCurrent::Id: { + using T = MN::DcCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::DcCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::DcCurrentMin::Id: { + using T = MN::DcCurrentMin::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcCurrentMin attribute value is %s",unify_value.dump().c_str() ); + UN::DcCurrentMin::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcCurrentMin::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::DcCurrentMax::Id: { + using T = MN::DcCurrentMax::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcCurrentMax attribute value is %s",unify_value.dump().c_str() ); + UN::DcCurrentMax::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcCurrentMax::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::DcPower::Id: { + using T = MN::DcPower::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcPower attribute value is %s",unify_value.dump().c_str() ); + UN::DcPower::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcPower::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::DcPowerMin::Id: { + using T = MN::DcPowerMin::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcPowerMin attribute value is %s",unify_value.dump().c_str() ); + UN::DcPowerMin::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcPowerMin::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::DcPowerMax::Id: { + using T = MN::DcPowerMax::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcPowerMax attribute value is %s",unify_value.dump().c_str() ); + UN::DcPowerMax::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcPowerMax::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::DcVoltageMultiplier::Id: { + using T = MN::DcVoltageMultiplier::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcVoltageMultiplier attribute value is %s",unify_value.dump().c_str() ); + UN::DcVoltageMultiplier::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcVoltageMultiplier::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::DcVoltageDivisor::Id: { + using T = MN::DcVoltageDivisor::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcVoltageDivisor attribute value is %s",unify_value.dump().c_str() ); + UN::DcVoltageDivisor::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcVoltageDivisor::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::DcCurrentMultiplier::Id: { + using T = MN::DcCurrentMultiplier::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcCurrentMultiplier attribute value is %s",unify_value.dump().c_str() ); + UN::DcCurrentMultiplier::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcCurrentMultiplier::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::DcCurrentDivisor::Id: { + using T = MN::DcCurrentDivisor::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcCurrentDivisor attribute value is %s",unify_value.dump().c_str() ); + UN::DcCurrentDivisor::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcCurrentDivisor::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::DcPowerMultiplier::Id: { + using T = MN::DcPowerMultiplier::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcPowerMultiplier attribute value is %s",unify_value.dump().c_str() ); + UN::DcPowerMultiplier::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcPowerMultiplier::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::DcPowerDivisor::Id: { + using T = MN::DcPowerDivisor::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"DcPowerDivisor attribute value is %s",unify_value.dump().c_str() ); + UN::DcPowerDivisor::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::DcPowerDivisor::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AcFrequency::Id: { + using T = MN::AcFrequency::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcFrequency attribute value is %s",unify_value.dump().c_str() ); + UN::AcFrequency::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcFrequency::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AcFrequencyMin::Id: { + using T = MN::AcFrequencyMin::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcFrequencyMin attribute value is %s",unify_value.dump().c_str() ); + UN::AcFrequencyMin::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcFrequencyMin::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AcFrequencyMax::Id: { + using T = MN::AcFrequencyMax::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcFrequencyMax attribute value is %s",unify_value.dump().c_str() ); + UN::AcFrequencyMax::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcFrequencyMax::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::NeutralCurrent::Id: { + using T = MN::NeutralCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NeutralCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::NeutralCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::NeutralCurrent::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32s + case MN::TotalActivePower::Id: { + using T = MN::TotalActivePower::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TotalActivePower attribute value is %s",unify_value.dump().c_str() ); + UN::TotalActivePower::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::TotalActivePower::Id, + ZCL_INT32S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32s + case MN::TotalReactivePower::Id: { + using T = MN::TotalReactivePower::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TotalReactivePower attribute value is %s",unify_value.dump().c_str() ); + UN::TotalReactivePower::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::TotalReactivePower::Id, + ZCL_INT32S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::TotalApparentPower::Id: { + using T = MN::TotalApparentPower::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TotalApparentPower attribute value is %s",unify_value.dump().c_str() ); + UN::TotalApparentPower::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::TotalApparentPower::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::Measured1stHarmonicCurrent::Id: { + using T = MN::Measured1stHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Measured1stHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::Measured1stHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::Measured1stHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::Measured3rdHarmonicCurrent::Id: { + using T = MN::Measured3rdHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Measured3rdHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::Measured3rdHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::Measured3rdHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::Measured5thHarmonicCurrent::Id: { + using T = MN::Measured5thHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Measured5thHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::Measured5thHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::Measured5thHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::Measured7thHarmonicCurrent::Id: { + using T = MN::Measured7thHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Measured7thHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::Measured7thHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::Measured7thHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::Measured9thHarmonicCurrent::Id: { + using T = MN::Measured9thHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Measured9thHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::Measured9thHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::Measured9thHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::Measured11thHarmonicCurrent::Id: { + using T = MN::Measured11thHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Measured11thHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::Measured11thHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::Measured11thHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MeasuredPhase1stHarmonicCurrent::Id: { + using T = MN::MeasuredPhase1stHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasuredPhase1stHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::MeasuredPhase1stHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::MeasuredPhase1stHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MeasuredPhase3rdHarmonicCurrent::Id: { + using T = MN::MeasuredPhase3rdHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasuredPhase3rdHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::MeasuredPhase3rdHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::MeasuredPhase3rdHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MeasuredPhase5thHarmonicCurrent::Id: { + using T = MN::MeasuredPhase5thHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasuredPhase5thHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::MeasuredPhase5thHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::MeasuredPhase5thHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MeasuredPhase7thHarmonicCurrent::Id: { + using T = MN::MeasuredPhase7thHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasuredPhase7thHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::MeasuredPhase7thHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::MeasuredPhase7thHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MeasuredPhase9thHarmonicCurrent::Id: { + using T = MN::MeasuredPhase9thHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasuredPhase9thHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::MeasuredPhase9thHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::MeasuredPhase9thHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::MeasuredPhase11thHarmonicCurrent::Id: { + using T = MN::MeasuredPhase11thHarmonicCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"MeasuredPhase11thHarmonicCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::MeasuredPhase11thHarmonicCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::MeasuredPhase11thHarmonicCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AcFrequencyMultiplier::Id: { + using T = MN::AcFrequencyMultiplier::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcFrequencyMultiplier attribute value is %s",unify_value.dump().c_str() ); + UN::AcFrequencyMultiplier::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcFrequencyMultiplier::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AcFrequencyDivisor::Id: { + using T = MN::AcFrequencyDivisor::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcFrequencyDivisor attribute value is %s",unify_value.dump().c_str() ); + UN::AcFrequencyDivisor::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcFrequencyDivisor::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::PowerMultiplier::Id: { + using T = MN::PowerMultiplier::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PowerMultiplier attribute value is %s",unify_value.dump().c_str() ); + UN::PowerMultiplier::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::PowerMultiplier::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::PowerDivisor::Id: { + using T = MN::PowerDivisor::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PowerDivisor attribute value is %s",unify_value.dump().c_str() ); + UN::PowerDivisor::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::PowerDivisor::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::HarmonicCurrentMultiplier::Id: { + using T = MN::HarmonicCurrentMultiplier::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"HarmonicCurrentMultiplier attribute value is %s",unify_value.dump().c_str() ); + UN::HarmonicCurrentMultiplier::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::HarmonicCurrentMultiplier::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::PhaseHarmonicCurrentMultiplier::Id: { + using T = MN::PhaseHarmonicCurrentMultiplier::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PhaseHarmonicCurrentMultiplier attribute value is %s",unify_value.dump().c_str() ); + UN::PhaseHarmonicCurrentMultiplier::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::PhaseHarmonicCurrentMultiplier::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::InstantaneousVoltage::Id: { + using T = MN::InstantaneousVoltage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"InstantaneousVoltage attribute value is %s",unify_value.dump().c_str() ); + UN::InstantaneousVoltage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::InstantaneousVoltage::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::InstantaneousLineCurrent::Id: { + using T = MN::InstantaneousLineCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"InstantaneousLineCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::InstantaneousLineCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::InstantaneousLineCurrent::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::InstantaneousActiveCurrent::Id: { + using T = MN::InstantaneousActiveCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"InstantaneousActiveCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::InstantaneousActiveCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::InstantaneousActiveCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::InstantaneousReactiveCurrent::Id: { + using T = MN::InstantaneousReactiveCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"InstantaneousReactiveCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::InstantaneousReactiveCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::InstantaneousReactiveCurrent::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::InstantaneousPower::Id: { + using T = MN::InstantaneousPower::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"InstantaneousPower attribute value is %s",unify_value.dump().c_str() ); + UN::InstantaneousPower::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::InstantaneousPower::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltage::Id: { + using T = MN::RmsVoltage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltage attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltage::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageMin::Id: { + using T = MN::RmsVoltageMin::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageMin attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageMin::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageMin::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageMax::Id: { + using T = MN::RmsVoltageMax::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageMax attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageMax::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageMax::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsCurrent::Id: { + using T = MN::RmsCurrent::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsCurrent attribute value is %s",unify_value.dump().c_str() ); + UN::RmsCurrent::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsCurrent::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsCurrentMin::Id: { + using T = MN::RmsCurrentMin::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsCurrentMin attribute value is %s",unify_value.dump().c_str() ); + UN::RmsCurrentMin::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsCurrentMin::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsCurrentMax::Id: { + using T = MN::RmsCurrentMax::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsCurrentMax attribute value is %s",unify_value.dump().c_str() ); + UN::RmsCurrentMax::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsCurrentMax::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ActivePower::Id: { + using T = MN::ActivePower::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActivePower attribute value is %s",unify_value.dump().c_str() ); + UN::ActivePower::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ActivePower::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ActivePowerMin::Id: { + using T = MN::ActivePowerMin::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActivePowerMin attribute value is %s",unify_value.dump().c_str() ); + UN::ActivePowerMin::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ActivePowerMin::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ActivePowerMax::Id: { + using T = MN::ActivePowerMax::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActivePowerMax attribute value is %s",unify_value.dump().c_str() ); + UN::ActivePowerMax::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ActivePowerMax::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ReactivePower::Id: { + using T = MN::ReactivePower::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ReactivePower attribute value is %s",unify_value.dump().c_str() ); + UN::ReactivePower::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ReactivePower::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ApparentPower::Id: { + using T = MN::ApparentPower::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ApparentPower attribute value is %s",unify_value.dump().c_str() ); + UN::ApparentPower::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ApparentPower::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::PowerFactor::Id: { + using T = MN::PowerFactor::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PowerFactor attribute value is %s",unify_value.dump().c_str() ); + UN::PowerFactor::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::PowerFactor::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AverageRmsVoltageMeasurementPeriod::Id: { + using T = MN::AverageRmsVoltageMeasurementPeriod::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AverageRmsVoltageMeasurementPeriod attribute value is %s",unify_value.dump().c_str() ); + UN::AverageRmsVoltageMeasurementPeriod::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AverageRmsVoltageMeasurementPeriod::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AverageRmsUnderVoltageCounter::Id: { + using T = MN::AverageRmsUnderVoltageCounter::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AverageRmsUnderVoltageCounter attribute value is %s",unify_value.dump().c_str() ); + UN::AverageRmsUnderVoltageCounter::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AverageRmsUnderVoltageCounter::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsExtremeOverVoltagePeriod::Id: { + using T = MN::RmsExtremeOverVoltagePeriod::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsExtremeOverVoltagePeriod attribute value is %s",unify_value.dump().c_str() ); + UN::RmsExtremeOverVoltagePeriod::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsExtremeOverVoltagePeriod::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsExtremeUnderVoltagePeriod::Id: { + using T = MN::RmsExtremeUnderVoltagePeriod::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsExtremeUnderVoltagePeriod attribute value is %s",unify_value.dump().c_str() ); + UN::RmsExtremeUnderVoltagePeriod::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsExtremeUnderVoltagePeriod::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageSagPeriod::Id: { + using T = MN::RmsVoltageSagPeriod::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageSagPeriod attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageSagPeriod::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageSagPeriod::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageSwellPeriod::Id: { + using T = MN::RmsVoltageSwellPeriod::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageSwellPeriod attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageSwellPeriod::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageSwellPeriod::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AcVoltageMultiplier::Id: { + using T = MN::AcVoltageMultiplier::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcVoltageMultiplier attribute value is %s",unify_value.dump().c_str() ); + UN::AcVoltageMultiplier::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcVoltageMultiplier::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AcVoltageDivisor::Id: { + using T = MN::AcVoltageDivisor::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcVoltageDivisor attribute value is %s",unify_value.dump().c_str() ); + UN::AcVoltageDivisor::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcVoltageDivisor::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AcCurrentMultiplier::Id: { + using T = MN::AcCurrentMultiplier::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcCurrentMultiplier attribute value is %s",unify_value.dump().c_str() ); + UN::AcCurrentMultiplier::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcCurrentMultiplier::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AcCurrentDivisor::Id: { + using T = MN::AcCurrentDivisor::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcCurrentDivisor attribute value is %s",unify_value.dump().c_str() ); + UN::AcCurrentDivisor::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcCurrentDivisor::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AcPowerMultiplier::Id: { + using T = MN::AcPowerMultiplier::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcPowerMultiplier attribute value is %s",unify_value.dump().c_str() ); + UN::AcPowerMultiplier::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcPowerMultiplier::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AcPowerDivisor::Id: { + using T = MN::AcPowerDivisor::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcPowerDivisor attribute value is %s",unify_value.dump().c_str() ); + UN::AcPowerDivisor::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcPowerDivisor::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap8 + case MN::OverloadAlarmsMask::Id: { + using T = MN::OverloadAlarmsMask::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OverloadAlarmsMask attribute value is %s",unify_value.dump().c_str() ); + UN::OverloadAlarmsMask::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::OverloadAlarmsMask::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::VoltageOverload::Id: { + using T = MN::VoltageOverload::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"VoltageOverload attribute value is %s",unify_value.dump().c_str() ); + UN::VoltageOverload::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::VoltageOverload::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::CurrentOverload::Id: { + using T = MN::CurrentOverload::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CurrentOverload attribute value is %s",unify_value.dump().c_str() ); + UN::CurrentOverload::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::CurrentOverload::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap16 + case MN::AcOverloadAlarmsMask::Id: { + using T = MN::AcOverloadAlarmsMask::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcOverloadAlarmsMask attribute value is %s",unify_value.dump().c_str() ); + UN::AcOverloadAlarmsMask::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcOverloadAlarmsMask::Id, + ZCL_BITMAP16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::AcVoltageOverload::Id: { + using T = MN::AcVoltageOverload::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcVoltageOverload attribute value is %s",unify_value.dump().c_str() ); + UN::AcVoltageOverload::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcVoltageOverload::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::AcCurrentOverload::Id: { + using T = MN::AcCurrentOverload::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcCurrentOverload attribute value is %s",unify_value.dump().c_str() ); + UN::AcCurrentOverload::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcCurrentOverload::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::AcActivePowerOverload::Id: { + using T = MN::AcActivePowerOverload::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcActivePowerOverload attribute value is %s",unify_value.dump().c_str() ); + UN::AcActivePowerOverload::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcActivePowerOverload::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::AcReactivePowerOverload::Id: { + using T = MN::AcReactivePowerOverload::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AcReactivePowerOverload attribute value is %s",unify_value.dump().c_str() ); + UN::AcReactivePowerOverload::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AcReactivePowerOverload::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::AverageRmsOverVoltage::Id: { + using T = MN::AverageRmsOverVoltage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AverageRmsOverVoltage attribute value is %s",unify_value.dump().c_str() ); + UN::AverageRmsOverVoltage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AverageRmsOverVoltage::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::AverageRmsUnderVoltage::Id: { + using T = MN::AverageRmsUnderVoltage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AverageRmsUnderVoltage attribute value is %s",unify_value.dump().c_str() ); + UN::AverageRmsUnderVoltage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AverageRmsUnderVoltage::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::RmsExtremeOverVoltage::Id: { + using T = MN::RmsExtremeOverVoltage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsExtremeOverVoltage attribute value is %s",unify_value.dump().c_str() ); + UN::RmsExtremeOverVoltage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsExtremeOverVoltage::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::RmsExtremeUnderVoltage::Id: { + using T = MN::RmsExtremeUnderVoltage::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsExtremeUnderVoltage attribute value is %s",unify_value.dump().c_str() ); + UN::RmsExtremeUnderVoltage::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsExtremeUnderVoltage::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::RmsVoltageSag::Id: { + using T = MN::RmsVoltageSag::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageSag attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageSag::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageSag::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::RmsVoltageSwell::Id: { + using T = MN::RmsVoltageSwell::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageSwell attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageSwell::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageSwell::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::LineCurrentPhaseB::Id: { + using T = MN::LineCurrentPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LineCurrentPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::LineCurrentPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::LineCurrentPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ActiveCurrentPhaseB::Id: { + using T = MN::ActiveCurrentPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActiveCurrentPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::ActiveCurrentPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ActiveCurrentPhaseB::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ReactiveCurrentPhaseB::Id: { + using T = MN::ReactiveCurrentPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ReactiveCurrentPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::ReactiveCurrentPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ReactiveCurrentPhaseB::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltagePhaseB::Id: { + using T = MN::RmsVoltagePhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltagePhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltagePhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltagePhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageMinPhaseB::Id: { + using T = MN::RmsVoltageMinPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageMinPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageMinPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageMinPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageMaxPhaseB::Id: { + using T = MN::RmsVoltageMaxPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageMaxPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageMaxPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageMaxPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsCurrentPhaseB::Id: { + using T = MN::RmsCurrentPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsCurrentPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::RmsCurrentPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsCurrentPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsCurrentMinPhaseB::Id: { + using T = MN::RmsCurrentMinPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsCurrentMinPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::RmsCurrentMinPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsCurrentMinPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsCurrentMaxPhaseB::Id: { + using T = MN::RmsCurrentMaxPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsCurrentMaxPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::RmsCurrentMaxPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsCurrentMaxPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ActivePowerPhaseB::Id: { + using T = MN::ActivePowerPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActivePowerPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::ActivePowerPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ActivePowerPhaseB::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ActivePowerMinPhaseB::Id: { + using T = MN::ActivePowerMinPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActivePowerMinPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::ActivePowerMinPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ActivePowerMinPhaseB::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ActivePowerMaxPhaseB::Id: { + using T = MN::ActivePowerMaxPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActivePowerMaxPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::ActivePowerMaxPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ActivePowerMaxPhaseB::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ReactivePowerPhaseB::Id: { + using T = MN::ReactivePowerPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ReactivePowerPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::ReactivePowerPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ReactivePowerPhaseB::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ApparentPowerPhaseB::Id: { + using T = MN::ApparentPowerPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ApparentPowerPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::ApparentPowerPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ApparentPowerPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::PowerFactorPhaseB::Id: { + using T = MN::PowerFactorPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PowerFactorPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::PowerFactorPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::PowerFactorPhaseB::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AverageRmsVoltageMeasurementPeriodPhaseB::Id: { + using T = MN::AverageRmsVoltageMeasurementPeriodPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AverageRmsVoltageMeasurementPeriodPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::AverageRmsVoltageMeasurementPeriodPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AverageRmsVoltageMeasurementPeriodPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AverageRmsOverVoltageCounterPhaseB::Id: { + using T = MN::AverageRmsOverVoltageCounterPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AverageRmsOverVoltageCounterPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::AverageRmsOverVoltageCounterPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AverageRmsOverVoltageCounterPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AverageRmsUnderVoltageCounterPhaseB::Id: { + using T = MN::AverageRmsUnderVoltageCounterPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AverageRmsUnderVoltageCounterPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::AverageRmsUnderVoltageCounterPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AverageRmsUnderVoltageCounterPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsExtremeOverVoltagePeriodPhaseB::Id: { + using T = MN::RmsExtremeOverVoltagePeriodPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsExtremeOverVoltagePeriodPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::RmsExtremeOverVoltagePeriodPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsExtremeOverVoltagePeriodPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsExtremeUnderVoltagePeriodPhaseB::Id: { + using T = MN::RmsExtremeUnderVoltagePeriodPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsExtremeUnderVoltagePeriodPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::RmsExtremeUnderVoltagePeriodPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsExtremeUnderVoltagePeriodPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageSagPeriodPhaseB::Id: { + using T = MN::RmsVoltageSagPeriodPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageSagPeriodPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageSagPeriodPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageSagPeriodPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageSwellPeriodPhaseB::Id: { + using T = MN::RmsVoltageSwellPeriodPhaseB::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageSwellPeriodPhaseB attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageSwellPeriodPhaseB::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageSwellPeriodPhaseB::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::LineCurrentPhaseC::Id: { + using T = MN::LineCurrentPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LineCurrentPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::LineCurrentPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::LineCurrentPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ActiveCurrentPhaseC::Id: { + using T = MN::ActiveCurrentPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActiveCurrentPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::ActiveCurrentPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ActiveCurrentPhaseC::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ReactiveCurrentPhaseC::Id: { + using T = MN::ReactiveCurrentPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ReactiveCurrentPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::ReactiveCurrentPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ReactiveCurrentPhaseC::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltagePhaseC::Id: { + using T = MN::RmsVoltagePhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltagePhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltagePhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltagePhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageMinPhaseC::Id: { + using T = MN::RmsVoltageMinPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageMinPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageMinPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageMinPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageMaxPhaseC::Id: { + using T = MN::RmsVoltageMaxPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageMaxPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageMaxPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageMaxPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsCurrentPhaseC::Id: { + using T = MN::RmsCurrentPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsCurrentPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::RmsCurrentPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsCurrentPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsCurrentMinPhaseC::Id: { + using T = MN::RmsCurrentMinPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsCurrentMinPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::RmsCurrentMinPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsCurrentMinPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsCurrentMaxPhaseC::Id: { + using T = MN::RmsCurrentMaxPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsCurrentMaxPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::RmsCurrentMaxPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsCurrentMaxPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ActivePowerPhaseC::Id: { + using T = MN::ActivePowerPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActivePowerPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::ActivePowerPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ActivePowerPhaseC::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ActivePowerMinPhaseC::Id: { + using T = MN::ActivePowerMinPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActivePowerMinPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::ActivePowerMinPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ActivePowerMinPhaseC::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ActivePowerMaxPhaseC::Id: { + using T = MN::ActivePowerMaxPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ActivePowerMaxPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::ActivePowerMaxPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ActivePowerMaxPhaseC::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::ReactivePowerPhaseC::Id: { + using T = MN::ReactivePowerPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ReactivePowerPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::ReactivePowerPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ReactivePowerPhaseC::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ApparentPowerPhaseC::Id: { + using T = MN::ApparentPowerPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ApparentPowerPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::ApparentPowerPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ApparentPowerPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::PowerFactorPhaseC::Id: { + using T = MN::PowerFactorPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"PowerFactorPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::PowerFactorPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::PowerFactorPhaseC::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AverageRmsVoltageMeasurementPeriodPhaseC::Id: { + using T = MN::AverageRmsVoltageMeasurementPeriodPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AverageRmsVoltageMeasurementPeriodPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::AverageRmsVoltageMeasurementPeriodPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AverageRmsVoltageMeasurementPeriodPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AverageRmsOverVoltageCounterPhaseC::Id: { + using T = MN::AverageRmsOverVoltageCounterPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AverageRmsOverVoltageCounterPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::AverageRmsOverVoltageCounterPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AverageRmsOverVoltageCounterPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::AverageRmsUnderVoltageCounterPhaseC::Id: { + using T = MN::AverageRmsUnderVoltageCounterPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"AverageRmsUnderVoltageCounterPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::AverageRmsUnderVoltageCounterPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::AverageRmsUnderVoltageCounterPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsExtremeOverVoltagePeriodPhaseC::Id: { + using T = MN::RmsExtremeOverVoltagePeriodPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsExtremeOverVoltagePeriodPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::RmsExtremeOverVoltagePeriodPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsExtremeOverVoltagePeriodPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsExtremeUnderVoltagePeriodPhaseC::Id: { + using T = MN::RmsExtremeUnderVoltagePeriodPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsExtremeUnderVoltagePeriodPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::RmsExtremeUnderVoltagePeriodPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsExtremeUnderVoltagePeriodPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageSagPeriodPhaseC::Id: { + using T = MN::RmsVoltageSagPeriodPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageSagPeriodPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageSagPeriodPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageSagPeriodPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RmsVoltageSwellPeriodPhaseC::Id: { + using T = MN::RmsVoltageSwellPeriodPhaseC::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RmsVoltageSwellPeriodPhaseC attribute value is %s",unify_value.dump().c_str() ); + UN::RmsVoltageSwellPeriodPhaseC::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::RmsVoltageSwellPeriodPhaseC::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::ElectricalMeasurement::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +TestClusterAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::TestCluster::Attributes; + namespace UN = unify::matter_bridge::TestCluster::Attributes; + if (aPath.mClusterId != Clusters::TestCluster::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + case MN::Boolean::Id: { // type is boolean + MN::Boolean::TypeInfo::Type value; + UN::Boolean::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Bitmap8::Id: { // type is Bitmap8MaskMap + MN::Bitmap8::TypeInfo::Type value; + UN::Bitmap8::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Bitmap16::Id: { // type is Bitmap16MaskMap + MN::Bitmap16::TypeInfo::Type value; + UN::Bitmap16::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Bitmap32::Id: { // type is Bitmap32MaskMap + MN::Bitmap32::TypeInfo::Type value; + UN::Bitmap32::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Bitmap64::Id: { // type is Bitmap64MaskMap + MN::Bitmap64::TypeInfo::Type value; + UN::Bitmap64::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int8u::Id: { // type is int8u + MN::Int8u::TypeInfo::Type value; + UN::Int8u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int16u::Id: { // type is int16u + MN::Int16u::TypeInfo::Type value; + UN::Int16u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int24u::Id: { // type is int24u + MN::Int24u::TypeInfo::Type value; + UN::Int24u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int32u::Id: { // type is int32u + MN::Int32u::TypeInfo::Type value; + UN::Int32u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int40u::Id: { // type is int40u + MN::Int40u::TypeInfo::Type value; + UN::Int40u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int48u::Id: { // type is int48u + MN::Int48u::TypeInfo::Type value; + UN::Int48u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int56u::Id: { // type is int56u + MN::Int56u::TypeInfo::Type value; + UN::Int56u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int64u::Id: { // type is int64u + MN::Int64u::TypeInfo::Type value; + UN::Int64u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int8s::Id: { // type is int8s + MN::Int8s::TypeInfo::Type value; + UN::Int8s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int16s::Id: { // type is int16s + MN::Int16s::TypeInfo::Type value; + UN::Int16s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int24s::Id: { // type is int24s + MN::Int24s::TypeInfo::Type value; + UN::Int24s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int32s::Id: { // type is int32s + MN::Int32s::TypeInfo::Type value; + UN::Int32s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int40s::Id: { // type is int40s + MN::Int40s::TypeInfo::Type value; + UN::Int40s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int48s::Id: { // type is int48s + MN::Int48s::TypeInfo::Type value; + UN::Int48s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int56s::Id: { // type is int56s + MN::Int56s::TypeInfo::Type value; + UN::Int56s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Int64s::Id: { // type is int64s + MN::Int64s::TypeInfo::Type value; + UN::Int64s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Enum8::Id: { // type is enum8 + MN::Enum8::TypeInfo::Type value; + UN::Enum8::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Enum16::Id: { // type is enum16 + MN::Enum16::TypeInfo::Type value; + UN::Enum16::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::FloatSingle::Id: { // type is single + MN::FloatSingle::TypeInfo::Type value; + UN::FloatSingle::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::FloatDouble::Id: { // type is double + MN::FloatDouble::TypeInfo::Type value; + UN::FloatDouble::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::OctetString::Id: { // type is octet_string + MN::OctetString::TypeInfo::Type value; + UN::OctetString::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::LongOctetString::Id: { // type is long_octet_string + MN::LongOctetString::TypeInfo::Type value; + UN::LongOctetString::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::CharString::Id: { // type is char_string + MN::CharString::TypeInfo::Type value; + UN::CharString::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::LongCharString::Id: { // type is long_char_string + MN::LongCharString::TypeInfo::Type value; + UN::LongCharString::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EpochUs::Id: { // type is epoch_us + MN::EpochUs::TypeInfo::Type value; + UN::EpochUs::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::EpochS::Id: { // type is epoch_s + MN::EpochS::TypeInfo::Type value; + UN::EpochS::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::VendorId::Id: { // type is vendor_id + MN::VendorId::TypeInfo::Type value; + UN::VendorId::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::EnumAttr::Id: { // type is SimpleEnum + MN::EnumAttr::TypeInfo::Type value; + UN::EnumAttr::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::RangeRestrictedInt8u::Id: { // type is int8u + MN::RangeRestrictedInt8u::TypeInfo::Type value; + UN::RangeRestrictedInt8u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RangeRestrictedInt8s::Id: { // type is int8s + MN::RangeRestrictedInt8s::TypeInfo::Type value; + UN::RangeRestrictedInt8s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RangeRestrictedInt16u::Id: { // type is int16u + MN::RangeRestrictedInt16u::TypeInfo::Type value; + UN::RangeRestrictedInt16u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::RangeRestrictedInt16s::Id: { // type is int16s + MN::RangeRestrictedInt16s::TypeInfo::Type value; + UN::RangeRestrictedInt16s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + case MN::TimedWriteBoolean::Id: { // type is boolean + MN::TimedWriteBoolean::TypeInfo::Type value; + UN::TimedWriteBoolean::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::GeneralErrorBoolean::Id: { // type is boolean + MN::GeneralErrorBoolean::TypeInfo::Type value; + UN::GeneralErrorBoolean::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterErrorBoolean::Id: { // type is boolean + MN::ClusterErrorBoolean::TypeInfo::Type value; + UN::ClusterErrorBoolean::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::Unsupported::Id: { // type is boolean + MN::Unsupported::TypeInfo::Type value; + UN::Unsupported::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableBoolean::Id: { // type is boolean + MN::NullableBoolean::TypeInfo::Type value; + UN::NullableBoolean::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableBitmap8::Id: { // type is Bitmap8MaskMap + MN::NullableBitmap8::TypeInfo::Type value; + UN::NullableBitmap8::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableBitmap16::Id: { // type is Bitmap16MaskMap + MN::NullableBitmap16::TypeInfo::Type value; + UN::NullableBitmap16::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableBitmap32::Id: { // type is Bitmap32MaskMap + MN::NullableBitmap32::TypeInfo::Type value; + UN::NullableBitmap32::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableBitmap64::Id: { // type is Bitmap64MaskMap + MN::NullableBitmap64::TypeInfo::Type value; + UN::NullableBitmap64::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt8u::Id: { // type is int8u + MN::NullableInt8u::TypeInfo::Type value; + UN::NullableInt8u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt16u::Id: { // type is int16u + MN::NullableInt16u::TypeInfo::Type value; + UN::NullableInt16u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt24u::Id: { // type is int24u + MN::NullableInt24u::TypeInfo::Type value; + UN::NullableInt24u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt32u::Id: { // type is int32u + MN::NullableInt32u::TypeInfo::Type value; + UN::NullableInt32u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt40u::Id: { // type is int40u + MN::NullableInt40u::TypeInfo::Type value; + UN::NullableInt40u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt48u::Id: { // type is int48u + MN::NullableInt48u::TypeInfo::Type value; + UN::NullableInt48u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt56u::Id: { // type is int56u + MN::NullableInt56u::TypeInfo::Type value; + UN::NullableInt56u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt64u::Id: { // type is int64u + MN::NullableInt64u::TypeInfo::Type value; + UN::NullableInt64u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt8s::Id: { // type is int8s + MN::NullableInt8s::TypeInfo::Type value; + UN::NullableInt8s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt16s::Id: { // type is int16s + MN::NullableInt16s::TypeInfo::Type value; + UN::NullableInt16s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt24s::Id: { // type is int24s + MN::NullableInt24s::TypeInfo::Type value; + UN::NullableInt24s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt32s::Id: { // type is int32s + MN::NullableInt32s::TypeInfo::Type value; + UN::NullableInt32s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt40s::Id: { // type is int40s + MN::NullableInt40s::TypeInfo::Type value; + UN::NullableInt40s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt48s::Id: { // type is int48s + MN::NullableInt48s::TypeInfo::Type value; + UN::NullableInt48s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt56s::Id: { // type is int56s + MN::NullableInt56s::TypeInfo::Type value; + UN::NullableInt56s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableInt64s::Id: { // type is int64s + MN::NullableInt64s::TypeInfo::Type value; + UN::NullableInt64s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableEnum8::Id: { // type is enum8 + MN::NullableEnum8::TypeInfo::Type value; + UN::NullableEnum8::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableEnum16::Id: { // type is enum16 + MN::NullableEnum16::TypeInfo::Type value; + UN::NullableEnum16::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableFloatSingle::Id: { // type is single + MN::NullableFloatSingle::TypeInfo::Type value; + UN::NullableFloatSingle::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableFloatDouble::Id: { // type is double + MN::NullableFloatDouble::TypeInfo::Type value; + UN::NullableFloatDouble::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableOctetString::Id: { // type is octet_string + MN::NullableOctetString::TypeInfo::Type value; + UN::NullableOctetString::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableCharString::Id: { // type is char_string + MN::NullableCharString::TypeInfo::Type value; + UN::NullableCharString::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableEnumAttr::Id: { // type is SimpleEnum + MN::NullableEnumAttr::TypeInfo::Type value; + UN::NullableEnumAttr::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + case MN::NullableRangeRestrictedInt8u::Id: { // type is int8u + MN::NullableRangeRestrictedInt8u::TypeInfo::Type value; + UN::NullableRangeRestrictedInt8u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableRangeRestrictedInt8s::Id: { // type is int8s + MN::NullableRangeRestrictedInt8s::TypeInfo::Type value; + UN::NullableRangeRestrictedInt8s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableRangeRestrictedInt16u::Id: { // type is int16u + MN::NullableRangeRestrictedInt16u::TypeInfo::Type value; + UN::NullableRangeRestrictedInt16u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::NullableRangeRestrictedInt16s::Id: { // type is int16s + MN::NullableRangeRestrictedInt16s::TypeInfo::Type value; + UN::NullableRangeRestrictedInt16s::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::WriteOnlyInt8u::Id: { // type is int8u + MN::WriteOnlyInt8u::TypeInfo::Type value; + UN::WriteOnlyInt8u::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR TestClusterAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::TestCluster; + + if (aPath.mClusterId != Clusters::TestCluster::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/TestCluster/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void TestClusterAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::TestCluster::Attributes; + namespace UN = unify::matter_bridge::TestCluster::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::TestCluster::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::TestCluster::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is boolean + case MN::Boolean::Id: { + using T = MN::Boolean::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Boolean attribute value is %s",unify_value.dump().c_str() ); + UN::Boolean::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Boolean::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Bitmap8MaskMap + case MN::Bitmap8::Id: { + using T = MN::Bitmap8::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Bitmap8 attribute value is %s",unify_value.dump().c_str() ); + UN::Bitmap8::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Bitmap8::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Bitmap16MaskMap + case MN::Bitmap16::Id: { + using T = MN::Bitmap16::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Bitmap16 attribute value is %s",unify_value.dump().c_str() ); + UN::Bitmap16::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Bitmap16::Id, + ZCL_BITMAP16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Bitmap32MaskMap + case MN::Bitmap32::Id: { + using T = MN::Bitmap32::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Bitmap32 attribute value is %s",unify_value.dump().c_str() ); + UN::Bitmap32::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Bitmap32::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Bitmap64MaskMap + case MN::Bitmap64::Id: { + using T = MN::Bitmap64::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Bitmap64 attribute value is %s",unify_value.dump().c_str() ); + UN::Bitmap64::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Bitmap64::Id, + ZCL_BITMAP64_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::Int8u::Id: { + using T = MN::Int8u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int8u attribute value is %s",unify_value.dump().c_str() ); + UN::Int8u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int8u::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::Int16u::Id: { + using T = MN::Int16u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int16u attribute value is %s",unify_value.dump().c_str() ); + UN::Int16u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int16u::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int24u + case MN::Int24u::Id: { + using T = MN::Int24u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int24u attribute value is %s",unify_value.dump().c_str() ); + UN::Int24u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int24u::Id, + ZCL_INT24U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::Int32u::Id: { + using T = MN::Int32u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int32u attribute value is %s",unify_value.dump().c_str() ); + UN::Int32u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int32u::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int40u + case MN::Int40u::Id: { + using T = MN::Int40u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int40u attribute value is %s",unify_value.dump().c_str() ); + UN::Int40u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int40u::Id, + ZCL_INT40U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int48u + case MN::Int48u::Id: { + using T = MN::Int48u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int48u attribute value is %s",unify_value.dump().c_str() ); + UN::Int48u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int48u::Id, + ZCL_INT48U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int56u + case MN::Int56u::Id: { + using T = MN::Int56u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int56u attribute value is %s",unify_value.dump().c_str() ); + UN::Int56u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int56u::Id, + ZCL_INT56U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::Int64u::Id: { + using T = MN::Int64u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int64u attribute value is %s",unify_value.dump().c_str() ); + UN::Int64u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int64u::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::Int8s::Id: { + using T = MN::Int8s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int8s attribute value is %s",unify_value.dump().c_str() ); + UN::Int8s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int8s::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::Int16s::Id: { + using T = MN::Int16s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int16s attribute value is %s",unify_value.dump().c_str() ); + UN::Int16s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int16s::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int24s + case MN::Int24s::Id: { + using T = MN::Int24s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int24s attribute value is %s",unify_value.dump().c_str() ); + UN::Int24s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int24s::Id, + ZCL_INT24S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32s + case MN::Int32s::Id: { + using T = MN::Int32s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int32s attribute value is %s",unify_value.dump().c_str() ); + UN::Int32s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int32s::Id, + ZCL_INT32S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int40s + case MN::Int40s::Id: { + using T = MN::Int40s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int40s attribute value is %s",unify_value.dump().c_str() ); + UN::Int40s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int40s::Id, + ZCL_INT40S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int48s + case MN::Int48s::Id: { + using T = MN::Int48s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int48s attribute value is %s",unify_value.dump().c_str() ); + UN::Int48s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int48s::Id, + ZCL_INT48S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int56s + case MN::Int56s::Id: { + using T = MN::Int56s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int56s attribute value is %s",unify_value.dump().c_str() ); + UN::Int56s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int56s::Id, + ZCL_INT56S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64s + case MN::Int64s::Id: { + using T = MN::Int64s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Int64s attribute value is %s",unify_value.dump().c_str() ); + UN::Int64s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Int64s::Id, + ZCL_INT64S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::Enum8::Id: { + using T = MN::Enum8::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Enum8 attribute value is %s",unify_value.dump().c_str() ); + UN::Enum8::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Enum8::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum16 + case MN::Enum16::Id: { + using T = MN::Enum16::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Enum16 attribute value is %s",unify_value.dump().c_str() ); + UN::Enum16::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Enum16::Id, + ZCL_ENUM16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is single + case MN::FloatSingle::Id: { + using T = MN::FloatSingle::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FloatSingle attribute value is %s",unify_value.dump().c_str() ); + UN::FloatSingle::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::FloatSingle::Id, + ZCL_SINGLE_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is double + case MN::FloatDouble::Id: { + using T = MN::FloatDouble::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FloatDouble attribute value is %s",unify_value.dump().c_str() ); + UN::FloatDouble::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::FloatDouble::Id, + ZCL_DOUBLE_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is octet_string + case MN::OctetString::Id: { + using T = MN::OctetString::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"OctetString attribute value is %s",unify_value.dump().c_str() ); + UN::OctetString::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::OctetString::Id, + ZCL_OCTET_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is long_octet_string + case MN::LongOctetString::Id: { + using T = MN::LongOctetString::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LongOctetString attribute value is %s",unify_value.dump().c_str() ); + UN::LongOctetString::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::LongOctetString::Id, + ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::CharString::Id: { + using T = MN::CharString::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"CharString attribute value is %s",unify_value.dump().c_str() ); + UN::CharString::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::CharString::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is long_char_string + case MN::LongCharString::Id: { + using T = MN::LongCharString::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"LongCharString attribute value is %s",unify_value.dump().c_str() ); + UN::LongCharString::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::LongCharString::Id, + ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is epoch_us + case MN::EpochUs::Id: { + using T = MN::EpochUs::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EpochUs attribute value is %s",unify_value.dump().c_str() ); + UN::EpochUs::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::EpochUs::Id, + ZCL_EPOCH_US_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is epoch_s + case MN::EpochS::Id: { + using T = MN::EpochS::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EpochS attribute value is %s",unify_value.dump().c_str() ); + UN::EpochS::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::EpochS::Id, + ZCL_EPOCH_S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is vendor_id + case MN::VendorId::Id: { + using T = MN::VendorId::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"VendorId attribute value is %s",unify_value.dump().c_str() ); + UN::VendorId::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::VendorId::Id, + ZCL_VENDOR_ID_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is SimpleEnum + case MN::EnumAttr::Id: { + using T = MN::EnumAttr::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"EnumAttr attribute value is %s",unify_value.dump().c_str() ); + UN::EnumAttr::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::EnumAttr::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::RangeRestrictedInt8u::Id: { + using T = MN::RangeRestrictedInt8u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RangeRestrictedInt8u attribute value is %s",unify_value.dump().c_str() ); + UN::RangeRestrictedInt8u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::RangeRestrictedInt8u::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::RangeRestrictedInt8s::Id: { + using T = MN::RangeRestrictedInt8s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RangeRestrictedInt8s attribute value is %s",unify_value.dump().c_str() ); + UN::RangeRestrictedInt8s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::RangeRestrictedInt8s::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::RangeRestrictedInt16u::Id: { + using T = MN::RangeRestrictedInt16u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RangeRestrictedInt16u attribute value is %s",unify_value.dump().c_str() ); + UN::RangeRestrictedInt16u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::RangeRestrictedInt16u::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::RangeRestrictedInt16s::Id: { + using T = MN::RangeRestrictedInt16s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"RangeRestrictedInt16s attribute value is %s",unify_value.dump().c_str() ); + UN::RangeRestrictedInt16s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::RangeRestrictedInt16s::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::TimedWriteBoolean::Id: { + using T = MN::TimedWriteBoolean::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"TimedWriteBoolean attribute value is %s",unify_value.dump().c_str() ); + UN::TimedWriteBoolean::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::TimedWriteBoolean::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::GeneralErrorBoolean::Id: { + using T = MN::GeneralErrorBoolean::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"GeneralErrorBoolean attribute value is %s",unify_value.dump().c_str() ); + UN::GeneralErrorBoolean::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::GeneralErrorBoolean::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::ClusterErrorBoolean::Id: { + using T = MN::ClusterErrorBoolean::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterErrorBoolean attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterErrorBoolean::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::ClusterErrorBoolean::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::Unsupported::Id: { + using T = MN::Unsupported::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"Unsupported attribute value is %s",unify_value.dump().c_str() ); + UN::Unsupported::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::Unsupported::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is boolean + case MN::NullableBoolean::Id: { + using T = MN::NullableBoolean::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableBoolean attribute value is %s",unify_value.dump().c_str() ); + UN::NullableBoolean::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableBoolean::Id, + ZCL_BOOLEAN_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Bitmap8MaskMap + case MN::NullableBitmap8::Id: { + using T = MN::NullableBitmap8::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableBitmap8 attribute value is %s",unify_value.dump().c_str() ); + UN::NullableBitmap8::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableBitmap8::Id, + ZCL_BITMAP8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Bitmap16MaskMap + case MN::NullableBitmap16::Id: { + using T = MN::NullableBitmap16::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableBitmap16 attribute value is %s",unify_value.dump().c_str() ); + UN::NullableBitmap16::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableBitmap16::Id, + ZCL_BITMAP16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Bitmap32MaskMap + case MN::NullableBitmap32::Id: { + using T = MN::NullableBitmap32::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableBitmap32 attribute value is %s",unify_value.dump().c_str() ); + UN::NullableBitmap32::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableBitmap32::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is Bitmap64MaskMap + case MN::NullableBitmap64::Id: { + using T = MN::NullableBitmap64::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableBitmap64 attribute value is %s",unify_value.dump().c_str() ); + UN::NullableBitmap64::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableBitmap64::Id, + ZCL_BITMAP64_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::NullableInt8u::Id: { + using T = MN::NullableInt8u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt8u attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt8u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt8u::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::NullableInt16u::Id: { + using T = MN::NullableInt16u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt16u attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt16u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt16u::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int24u + case MN::NullableInt24u::Id: { + using T = MN::NullableInt24u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt24u attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt24u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt24u::Id, + ZCL_INT24U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32u + case MN::NullableInt32u::Id: { + using T = MN::NullableInt32u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt32u attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt32u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt32u::Id, + ZCL_INT32U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int40u + case MN::NullableInt40u::Id: { + using T = MN::NullableInt40u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt40u attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt40u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt40u::Id, + ZCL_INT40U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int48u + case MN::NullableInt48u::Id: { + using T = MN::NullableInt48u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt48u attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt48u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt48u::Id, + ZCL_INT48U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int56u + case MN::NullableInt56u::Id: { + using T = MN::NullableInt56u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt56u attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt56u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt56u::Id, + ZCL_INT56U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64u + case MN::NullableInt64u::Id: { + using T = MN::NullableInt64u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt64u attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt64u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt64u::Id, + ZCL_INT64U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::NullableInt8s::Id: { + using T = MN::NullableInt8s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt8s attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt8s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt8s::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::NullableInt16s::Id: { + using T = MN::NullableInt16s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt16s attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt16s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt16s::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int24s + case MN::NullableInt24s::Id: { + using T = MN::NullableInt24s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt24s attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt24s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt24s::Id, + ZCL_INT24S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int32s + case MN::NullableInt32s::Id: { + using T = MN::NullableInt32s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt32s attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt32s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt32s::Id, + ZCL_INT32S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int40s + case MN::NullableInt40s::Id: { + using T = MN::NullableInt40s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt40s attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt40s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt40s::Id, + ZCL_INT40S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int48s + case MN::NullableInt48s::Id: { + using T = MN::NullableInt48s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt48s attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt48s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt48s::Id, + ZCL_INT48S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int56s + case MN::NullableInt56s::Id: { + using T = MN::NullableInt56s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt56s attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt56s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt56s::Id, + ZCL_INT56S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int64s + case MN::NullableInt64s::Id: { + using T = MN::NullableInt64s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableInt64s attribute value is %s",unify_value.dump().c_str() ); + UN::NullableInt64s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableInt64s::Id, + ZCL_INT64S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum8 + case MN::NullableEnum8::Id: { + using T = MN::NullableEnum8::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableEnum8 attribute value is %s",unify_value.dump().c_str() ); + UN::NullableEnum8::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableEnum8::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is enum16 + case MN::NullableEnum16::Id: { + using T = MN::NullableEnum16::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableEnum16 attribute value is %s",unify_value.dump().c_str() ); + UN::NullableEnum16::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableEnum16::Id, + ZCL_ENUM16_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is single + case MN::NullableFloatSingle::Id: { + using T = MN::NullableFloatSingle::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableFloatSingle attribute value is %s",unify_value.dump().c_str() ); + UN::NullableFloatSingle::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableFloatSingle::Id, + ZCL_SINGLE_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is double + case MN::NullableFloatDouble::Id: { + using T = MN::NullableFloatDouble::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableFloatDouble attribute value is %s",unify_value.dump().c_str() ); + UN::NullableFloatDouble::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableFloatDouble::Id, + ZCL_DOUBLE_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is octet_string + case MN::NullableOctetString::Id: { + using T = MN::NullableOctetString::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableOctetString attribute value is %s",unify_value.dump().c_str() ); + UN::NullableOctetString::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableOctetString::Id, + ZCL_OCTET_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is char_string + case MN::NullableCharString::Id: { + using T = MN::NullableCharString::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableCharString attribute value is %s",unify_value.dump().c_str() ); + UN::NullableCharString::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableCharString::Id, + ZCL_CHAR_STRING_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is SimpleEnum + case MN::NullableEnumAttr::Id: { + using T = MN::NullableEnumAttr::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableEnumAttr attribute value is %s",unify_value.dump().c_str() ); + UN::NullableEnumAttr::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableEnumAttr::Id, + ZCL_ENUM8_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::NullableRangeRestrictedInt8u::Id: { + using T = MN::NullableRangeRestrictedInt8u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableRangeRestrictedInt8u attribute value is %s",unify_value.dump().c_str() ); + UN::NullableRangeRestrictedInt8u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableRangeRestrictedInt8u::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8s + case MN::NullableRangeRestrictedInt8s::Id: { + using T = MN::NullableRangeRestrictedInt8s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableRangeRestrictedInt8s attribute value is %s",unify_value.dump().c_str() ); + UN::NullableRangeRestrictedInt8s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableRangeRestrictedInt8s::Id, + ZCL_INT8S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::NullableRangeRestrictedInt16u::Id: { + using T = MN::NullableRangeRestrictedInt16u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableRangeRestrictedInt16u attribute value is %s",unify_value.dump().c_str() ); + UN::NullableRangeRestrictedInt16u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableRangeRestrictedInt16u::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16s + case MN::NullableRangeRestrictedInt16s::Id: { + using T = MN::NullableRangeRestrictedInt16s::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"NullableRangeRestrictedInt16s attribute value is %s",unify_value.dump().c_str() ); + UN::NullableRangeRestrictedInt16s::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::NullableRangeRestrictedInt16s::Id, + ZCL_INT16S_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int8u + case MN::WriteOnlyInt8u::Id: { + using T = MN::WriteOnlyInt8u::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"WriteOnlyInt8u attribute value is %s",unify_value.dump().c_str() ); + UN::WriteOnlyInt8u::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::WriteOnlyInt8u::Id, + ZCL_INT8U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::TestCluster::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + +CHIP_ERROR +FaultInjectionAttributeAccess::Read(const ConcreteReadAttributePath &aPath, + AttributeValueEncoder &aEncoder) +{ + namespace MN = chip::app::Clusters::FaultInjection::Attributes; + namespace UN = unify::matter_bridge::FaultInjection::Attributes; + if (aPath.mClusterId != Clusters::FaultInjection::Id) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + ConcreteAttributePath atrpath = ConcreteAttributePath(aPath.mEndpointId, + aPath.mClusterId, + aPath.mAttributeId); + + try { + switch (aPath.mAttributeId) { + + + + + case MN::FeatureMap::Id: { // type is bitmap32 + MN::FeatureMap::TypeInfo::Type value; + UN::FeatureMap::Get(atrpath, value ); + return aEncoder.Encode(value); + } + + case MN::ClusterRevision::Id: { // type is int16u + MN::ClusterRevision::TypeInfo::Type value; + UN::ClusterRevision::Get(atrpath, value ); + return aEncoder.Encode(value); + } + } + } 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; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR FaultInjectionAttributeAccess::Write(const ConcreteDataAttributePath &aPath, + AttributeValueDecoder &aDecoder) +{ + using namespace chip::app::Clusters::FaultInjection; + + if (aPath.mClusterId != Clusters::FaultInjection::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) { + } + + + if (!attribute_name.empty()) { + std::string payload_str; + std::string topic = "ucl/by-unid/" + unify_node->unify_unid + "/ep" + + std::to_string(unify_node->unify_endpoint) + + "/FaultInjection/Attributes/" + attribute_name + "/Desired"; + payload_str = jsn.dump(); + uic_mqtt_publish(topic.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + return CHIP_ERROR_NO_MESSAGE_HANDLER; + } + + return CHIP_NO_ERROR; +} + + + +void FaultInjectionAttributeAccess::reported_updated(const bridged_endpoint *ep, + const std::string &cluster, + const std::string &attribute, + const nlohmann::json &unify_value) +{ + namespace MN = chip::app::Clusters::FaultInjection::Attributes; + namespace UN = unify::matter_bridge::FaultInjection::Attributes; + + auto cluster_id = device_translator::instance().get_cluster_id(cluster); + + if (!cluster_id.has_value() || (cluster_id.value() != Clusters::FaultInjection::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::FaultInjection::Id, + attribute_id.value()); + + switch (attribute_id.value()) { + // type is bitmap32 + case MN::FeatureMap::Id: { + using T = MN::FeatureMap::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"FeatureMap attribute value is %s",unify_value.dump().c_str() ); + UN::FeatureMap::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FaultInjection::Id, + MN::FeatureMap::Id, + ZCL_BITMAP32_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + // type is int16u + case MN::ClusterRevision::Id: { + using T = MN::ClusterRevision::TypeInfo::Type; + std::optional value = from_json(unify_value); + + if( value.has_value()) { + sl_log_debug(LOG_TAG,"ClusterRevision attribute value is %s",unify_value.dump().c_str() ); + UN::ClusterRevision::Set( attrpath, value.value() ); + MatterReportingAttributeChangeCallback( + node_matter_endpoint, + Clusters::FaultInjection::Id, + MN::ClusterRevision::Id, + ZCL_INT16U_ATTRIBUTE_TYPE, + reinterpret_cast(&value.value())); + } + break; + } + } +} + diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/attribute_translator.hpp b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/attribute_translator.hpp new file mode 100644 index 00000000000000..8dc0c75f5c208b --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/attribute_translator.hpp @@ -0,0 +1,1660 @@ +/****************************************************************************** + * # 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 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" });} +}; + + +class GroupsAttributeAccess : public attribute_translator_interface +{ + public: + GroupsAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::Groups::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({ "Groups" });} +}; + + +class ScenesAttributeAccess : public attribute_translator_interface +{ + public: + ScenesAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::Scenes::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({ "Scenes" });} +}; + + +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: + 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" });} +}; + + +class OnOffSwitchConfigurationAttributeAccess : public attribute_translator_interface +{ + public: + OnOffSwitchConfigurationAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::OnOffSwitchConfiguration::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({ "OnOffSwitchConfiguration" });} +}; + + +class LevelControlAttributeAccess : public attribute_translator_interface +{ + public: + LevelControlAttributeAccess(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; + + 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({ "LevelControl" });} +}; + + +class BinaryInputBasicAttributeAccess : public attribute_translator_interface +{ + public: + BinaryInputBasicAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::BinaryInputBasic::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({ "BinaryInputBasic" });} +}; + + +class PulseWidthModulationAttributeAccess : public attribute_translator_interface +{ + public: + PulseWidthModulationAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::PulseWidthModulation::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({ "PulseWidthModulation" });} +}; + + +class DescriptorAttributeAccess : public attribute_translator_interface +{ + public: + DescriptorAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::Descriptor::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({ "Descriptor" });} +}; + + +class BindingAttributeAccess : public attribute_translator_interface +{ + public: + BindingAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::Binding::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({ "Binding" });} +}; + + +class AccessControlAttributeAccess : public attribute_translator_interface +{ + public: + AccessControlAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::AccessControl::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({ "AccessControl" });} +}; + + +class ActionsAttributeAccess : public attribute_translator_interface +{ + public: + ActionsAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::Actions::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({ "Actions" });} +}; + + +class BasicAttributeAccess : public attribute_translator_interface +{ + public: + BasicAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::Basic::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({ "Basic" });} +}; + + +class OtaSoftwareUpdateProviderAttributeAccess : public attribute_translator_interface +{ + public: + OtaSoftwareUpdateProviderAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::OtaSoftwareUpdateProvider::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({ "OtaSoftwareUpdateProvider" });} +}; + + +class OtaSoftwareUpdateRequestorAttributeAccess : public attribute_translator_interface +{ + public: + OtaSoftwareUpdateRequestorAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::OtaSoftwareUpdateRequestor::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({ "OtaSoftwareUpdateRequestor" });} +}; + + +class LocalizationConfigurationAttributeAccess : public attribute_translator_interface +{ + public: + LocalizationConfigurationAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::LocalizationConfiguration::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({ "LocalizationConfiguration" });} +}; + + +class TimeFormatLocalizationAttributeAccess : public attribute_translator_interface +{ + public: + TimeFormatLocalizationAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::TimeFormatLocalization::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({ "TimeFormatLocalization" });} +}; + + +class UnitLocalizationAttributeAccess : public attribute_translator_interface +{ + public: + UnitLocalizationAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::UnitLocalization::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({ "UnitLocalization" });} +}; + + +class PowerSourceConfigurationAttributeAccess : public attribute_translator_interface +{ + public: + PowerSourceConfigurationAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::PowerSourceConfiguration::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({ "PowerSourceConfiguration" });} +}; + + +class PowerSourceAttributeAccess : public attribute_translator_interface +{ + public: + PowerSourceAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::PowerSource::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({ "PowerSource" });} +}; + + +class GeneralCommissioningAttributeAccess : public attribute_translator_interface +{ + public: + GeneralCommissioningAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::GeneralCommissioning::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({ "GeneralCommissioning" });} +}; + + +class NetworkCommissioningAttributeAccess : public attribute_translator_interface +{ + public: + NetworkCommissioningAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::NetworkCommissioning::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({ "NetworkCommissioning" });} +}; + + +class DiagnosticLogsAttributeAccess : public attribute_translator_interface +{ + public: + DiagnosticLogsAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::DiagnosticLogs::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({ "DiagnosticLogs" });} +}; + + +class GeneralDiagnosticsAttributeAccess : public attribute_translator_interface +{ + public: + GeneralDiagnosticsAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::GeneralDiagnostics::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({ "GeneralDiagnostics" });} +}; + + +class SoftwareDiagnosticsAttributeAccess : public attribute_translator_interface +{ + public: + SoftwareDiagnosticsAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::SoftwareDiagnostics::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({ "SoftwareDiagnostics" });} +}; + + +class ThreadNetworkDiagnosticsAttributeAccess : public attribute_translator_interface +{ + public: + ThreadNetworkDiagnosticsAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::ThreadNetworkDiagnostics::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({ "ThreadNetworkDiagnostics" });} +}; + + +class WiFiNetworkDiagnosticsAttributeAccess : public attribute_translator_interface +{ + public: + WiFiNetworkDiagnosticsAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::WiFiNetworkDiagnostics::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({ "WiFiNetworkDiagnostics" });} +}; + + +class EthernetNetworkDiagnosticsAttributeAccess : public attribute_translator_interface +{ + public: + EthernetNetworkDiagnosticsAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::EthernetNetworkDiagnostics::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({ "EthernetNetworkDiagnostics" });} +}; + + +class TimeSynchronizationAttributeAccess : public attribute_translator_interface +{ + public: + TimeSynchronizationAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::TimeSynchronization::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({ "TimeSynchronization" });} +}; + + +class BridgedDeviceBasicAttributeAccess : public attribute_translator_interface +{ + public: + BridgedDeviceBasicAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::BridgedDeviceBasic::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({ "BridgedDeviceBasic" });} +}; + + +class SwitchAttributeAccess : public attribute_translator_interface +{ + public: + SwitchAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::Switch::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({ "Switch" });} +}; + + +class AdministratorCommissioningAttributeAccess : public attribute_translator_interface +{ + public: + AdministratorCommissioningAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::AdministratorCommissioning::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({ "AdministratorCommissioning" });} +}; + + +class OperationalCredentialsAttributeAccess : public attribute_translator_interface +{ + public: + OperationalCredentialsAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::OperationalCredentials::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({ "OperationalCredentials" });} +}; + + +class GroupKeyManagementAttributeAccess : public attribute_translator_interface +{ + public: + GroupKeyManagementAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::GroupKeyManagement::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({ "GroupKeyManagement" });} +}; + + +class FixedLabelAttributeAccess : public attribute_translator_interface +{ + public: + FixedLabelAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::FixedLabel::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({ "FixedLabel" });} +}; + + +class UserLabelAttributeAccess : public attribute_translator_interface +{ + public: + UserLabelAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::UserLabel::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({ "UserLabel" });} +}; + + +class ProxyConfigurationAttributeAccess : public attribute_translator_interface +{ + public: + ProxyConfigurationAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::ProxyConfiguration::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({ "ProxyConfiguration" });} +}; + + +class ProxyDiscoveryAttributeAccess : public attribute_translator_interface +{ + public: + ProxyDiscoveryAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::ProxyDiscovery::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({ "ProxyDiscovery" });} +}; + + +class ProxyValidAttributeAccess : public attribute_translator_interface +{ + public: + ProxyValidAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::ProxyValid::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({ "ProxyValid" });} +}; + + +class BooleanStateAttributeAccess : public attribute_translator_interface +{ + public: + BooleanStateAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::BooleanState::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({ "BooleanState" });} +}; + + +class ModeSelectAttributeAccess : public attribute_translator_interface +{ + public: + ModeSelectAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::ModeSelect::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({ "ModeSelect" });} +}; + + +class DoorLockAttributeAccess : public attribute_translator_interface +{ + public: + DoorLockAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::DoorLock::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({ "DoorLock" });} +}; + + +class WindowCoveringAttributeAccess : public attribute_translator_interface +{ + public: + WindowCoveringAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::WindowCovering::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({ "WindowCovering" });} +}; + + +class BarrierControlAttributeAccess : public attribute_translator_interface +{ + public: + BarrierControlAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::BarrierControl::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({ "BarrierControl" });} +}; + + +class PumpConfigurationAndControlAttributeAccess : public attribute_translator_interface +{ + public: + PumpConfigurationAndControlAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::PumpConfigurationAndControl::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({ "PumpConfigurationAndControl" });} +}; + + +class ThermostatAttributeAccess : public attribute_translator_interface +{ + public: + ThermostatAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::Thermostat::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({ "Thermostat" });} +}; + + +class FanControlAttributeAccess : public attribute_translator_interface +{ + public: + FanControlAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::FanControl::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({ "FanControl" });} +}; + + +class ThermostatUserInterfaceConfigurationAttributeAccess : public attribute_translator_interface +{ + public: + ThermostatUserInterfaceConfigurationAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::ThermostatUserInterfaceConfiguration::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({ "ThermostatUserInterfaceConfiguration" });} +}; + + +class ColorControlAttributeAccess : public attribute_translator_interface +{ + public: + ColorControlAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::ColorControl::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({ "ColorControl" });} +}; + + +class BallastConfigurationAttributeAccess : public attribute_translator_interface +{ + public: + BallastConfigurationAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::BallastConfiguration::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({ "BallastConfiguration" });} +}; + + +class IlluminanceMeasurementAttributeAccess : public attribute_translator_interface +{ + public: + IlluminanceMeasurementAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::IlluminanceMeasurement::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({ "IlluminanceMeasurement" });} +}; + + +class TemperatureMeasurementAttributeAccess : public attribute_translator_interface +{ + public: + TemperatureMeasurementAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::TemperatureMeasurement::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({ "TemperatureMeasurement" });} +}; + + +class PressureMeasurementAttributeAccess : public attribute_translator_interface +{ + public: + PressureMeasurementAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::PressureMeasurement::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({ "PressureMeasurement" });} +}; + + +class FlowMeasurementAttributeAccess : public attribute_translator_interface +{ + public: + FlowMeasurementAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::FlowMeasurement::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({ "FlowMeasurement" });} +}; + + +class RelativeHumidityMeasurementAttributeAccess : public attribute_translator_interface +{ + public: + RelativeHumidityMeasurementAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::RelativeHumidityMeasurement::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({ "RelativeHumidityMeasurement" });} +}; + + +class OccupancySensingAttributeAccess : public attribute_translator_interface +{ + public: + OccupancySensingAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::OccupancySensing::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({ "OccupancySensing" });} +}; + + +class WakeOnLanAttributeAccess : public attribute_translator_interface +{ + public: + WakeOnLanAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::WakeOnLan::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({ "WakeOnLan" });} +}; + + +class ChannelAttributeAccess : public attribute_translator_interface +{ + public: + ChannelAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::Channel::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({ "Channel" });} +}; + + +class TargetNavigatorAttributeAccess : public attribute_translator_interface +{ + public: + TargetNavigatorAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::TargetNavigator::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({ "TargetNavigator" });} +}; + + +class MediaPlaybackAttributeAccess : public attribute_translator_interface +{ + public: + MediaPlaybackAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::MediaPlayback::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({ "MediaPlayback" });} +}; + + +class MediaInputAttributeAccess : public attribute_translator_interface +{ + public: + MediaInputAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::MediaInput::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({ "MediaInput" });} +}; + + +class LowPowerAttributeAccess : public attribute_translator_interface +{ + public: + LowPowerAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::LowPower::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({ "LowPower" });} +}; + + +class KeypadInputAttributeAccess : public attribute_translator_interface +{ + public: + KeypadInputAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::KeypadInput::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({ "KeypadInput" });} +}; + + +class ContentLauncherAttributeAccess : public attribute_translator_interface +{ + public: + ContentLauncherAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::ContentLauncher::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({ "ContentLauncher" });} +}; + + +class AudioOutputAttributeAccess : public attribute_translator_interface +{ + public: + AudioOutputAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::AudioOutput::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({ "AudioOutput" });} +}; + + +class ApplicationLauncherAttributeAccess : public attribute_translator_interface +{ + public: + ApplicationLauncherAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::ApplicationLauncher::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({ "ApplicationLauncher" });} +}; + + +class ApplicationBasicAttributeAccess : public attribute_translator_interface +{ + public: + ApplicationBasicAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::ApplicationBasic::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({ "ApplicationBasic" });} +}; + + +class AccountLoginAttributeAccess : public attribute_translator_interface +{ + public: + AccountLoginAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::AccountLogin::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({ "AccountLogin" });} +}; + + +class ElectricalMeasurementAttributeAccess : public attribute_translator_interface +{ + public: + ElectricalMeasurementAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::ElectricalMeasurement::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({ "ElectricalMeasurement" });} +}; + + +class TestClusterAttributeAccess : public attribute_translator_interface +{ + public: + TestClusterAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::TestCluster::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({ "TestCluster" });} +}; + + +class FaultInjectionAttributeAccess : public attribute_translator_interface +{ + public: + FaultInjectionAttributeAccess(matter_node_state_monitor &node_state_monitor) : + attribute_translator_interface(node_state_monitor, + chip::app::Clusters::FaultInjection::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({ "FaultInjection" });} +}; + +} // namespace unify::matter_bridge \ No newline at end of file diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/chip_types_from_json.hpp b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/chip_types_from_json.hpp new file mode 100644 index 00000000000000..2d939cc1e73205 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/chip_types_from_json.hpp @@ -0,0 +1,3333 @@ +/******************************************************************************* + * # 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. + * + ******************************************************************************/ + + +// Default translation +template +std::optional from_json(const nlohmann::json & value) +{ + return std::nullopt; +} + +/***************************** Simple types Convertes **************/ + +template<> inline +std::optional from_json(const nlohmann::json & value) +{ + return value; +} + +template<> inline +std::optional from_json(const nlohmann::json & value) +{ + return value; +} + +template<> inline +std::optional from_json(const nlohmann::json & value) +{ + return value; +} + + +/***************************** Bitmap Convertes **************/ +// +// +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Identify::IdentifyEffectIdentifier> + table = { + { "Blink" , Identify::IdentifyEffectIdentifier::kBlink }, + { "Breathe" , Identify::IdentifyEffectIdentifier::kBreathe }, + { "Okay" , Identify::IdentifyEffectIdentifier::kOkay }, + { "ChannelChange" , Identify::IdentifyEffectIdentifier::kChannelChange }, + { "FinishEffect" , Identify::IdentifyEffectIdentifier::kFinishEffect }, + { "StopEffect" , Identify::IdentifyEffectIdentifier::kStopEffect }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Identify::IdentifyEffectVariant> + table = { + { "Default" , Identify::IdentifyEffectVariant::kDefault }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Identify::IdentifyIdentifyType> + table = { + { "None" , Identify::IdentifyIdentifyType::kNone }, + { "VisibleLight" , Identify::IdentifyIdentifyType::kVisibleLight }, + { "VisibleLED" , Identify::IdentifyIdentifyType::kVisibleLED }, + { "AudibleBeep" , Identify::IdentifyIdentifyType::kAudibleBeep }, + { "Display" , Identify::IdentifyIdentifyType::kDisplay }, + { "Actuator" , Identify::IdentifyIdentifyType::kActuator }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const Scenes::Structs::AttributeValuePair::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const Scenes::Structs::ExtensionFieldSet::Type& value) { +// return "no struct support"; +//} +// +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, OnOff::OnOffDelayedAllOffEffectVariant> + table = { + { "FadeToOffIn0p8Seconds" , OnOff::OnOffDelayedAllOffEffectVariant::kFadeToOffIn0p8Seconds }, + { "NoFade" , OnOff::OnOffDelayedAllOffEffectVariant::kNoFade }, + { "50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds" , OnOff::OnOffDelayedAllOffEffectVariant::k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, OnOff::OnOffDyingLightEffectVariant> + table = { + { "20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second" , OnOff::OnOffDyingLightEffectVariant::k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, OnOff::OnOffEffectIdentifier> + table = { + { "DelayedAllOff" , OnOff::OnOffEffectIdentifier::kDelayedAllOff }, + { "DyingLight" , OnOff::OnOffEffectIdentifier::kDyingLight }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, OnOff::OnOffStartUpOnOff> + table = { + { "Off" , OnOff::OnOffStartUpOnOff::kOff }, + { "On" , OnOff::OnOffStartUpOnOff::kOn }, + { "TogglePreviousOnOff" , OnOff::OnOffStartUpOnOff::kTogglePreviousOnOff }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, LevelControl::MoveMode> + table = { + { "Up" , LevelControl::MoveMode::kUp }, + { "Down" , LevelControl::MoveMode::kDown }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, LevelControl::StepMode> + table = { + { "Up" , LevelControl::StepMode::kUp }, + { "Down" , LevelControl::StepMode::kDown }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const Descriptor::Structs::DeviceTypeStruct::Type& value) { +// return "no struct support"; +//} +// +// + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const Binding::Structs::TargetStruct::Type& value) { +// return "no struct support"; +//} +// +// + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const AccessControl::Structs::Target::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const AccessControl::Structs::AccessControlEntry::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const AccessControl::Structs::ExtensionEntry::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, AccessControl::AuthMode> + table = { + { "Pase" , AccessControl::AuthMode::kPase }, + { "Case" , AccessControl::AuthMode::kCase }, + { "Group" , AccessControl::AuthMode::kGroup }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, AccessControl::ChangeTypeEnum> + table = { + { "Changed" , AccessControl::ChangeTypeEnum::kChanged }, + { "Added" , AccessControl::ChangeTypeEnum::kAdded }, + { "Removed" , AccessControl::ChangeTypeEnum::kRemoved }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, AccessControl::Privilege> + table = { + { "View" , AccessControl::Privilege::kView }, + { "ProxyView" , AccessControl::Privilege::kProxyView }, + { "Operate" , AccessControl::Privilege::kOperate }, + { "Manage" , AccessControl::Privilege::kManage }, + { "Administer" , AccessControl::Privilege::kAdminister }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const Actions::Structs::ActionStruct::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const Actions::Structs::EndpointListStruct::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Actions::ActionErrorEnum> + table = { + { "Unknown" , Actions::ActionErrorEnum::kUnknown }, + { "Interrupted" , Actions::ActionErrorEnum::kInterrupted }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Actions::ActionStateEnum> + table = { + { "Inactive" , Actions::ActionStateEnum::kInactive }, + { "Active" , Actions::ActionStateEnum::kActive }, + { "Paused" , Actions::ActionStateEnum::kPaused }, + { "Disabled" , Actions::ActionStateEnum::kDisabled }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Actions::ActionTypeEnum> + table = { + { "Other" , Actions::ActionTypeEnum::kOther }, + { "Scene" , Actions::ActionTypeEnum::kScene }, + { "Sequence" , Actions::ActionTypeEnum::kSequence }, + { "Automation" , Actions::ActionTypeEnum::kAutomation }, + { "Exception" , Actions::ActionTypeEnum::kException }, + { "Notification" , Actions::ActionTypeEnum::kNotification }, + { "Alarm" , Actions::ActionTypeEnum::kAlarm }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Actions::EndpointListTypeEnum> + table = { + { "Other" , Actions::EndpointListTypeEnum::kOther }, + { "Room" , Actions::EndpointListTypeEnum::kRoom }, + { "Zone" , Actions::EndpointListTypeEnum::kZone }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const Basic::Structs::CapabilityMinimaStruct::Type& value) { +// return "no struct support"; +//} +// +// + + + +// +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, OtaSoftwareUpdateProvider::OTAApplyUpdateAction> + table = { + { "Proceed" , OtaSoftwareUpdateProvider::OTAApplyUpdateAction::kProceed }, + { "AwaitNextAction" , OtaSoftwareUpdateProvider::OTAApplyUpdateAction::kAwaitNextAction }, + { "Discontinue" , OtaSoftwareUpdateProvider::OTAApplyUpdateAction::kDiscontinue }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, OtaSoftwareUpdateProvider::OTADownloadProtocol> + table = { + { "BDXSynchronous" , OtaSoftwareUpdateProvider::OTADownloadProtocol::kBDXSynchronous }, + { "BDXAsynchronous" , OtaSoftwareUpdateProvider::OTADownloadProtocol::kBDXAsynchronous }, + { "Https" , OtaSoftwareUpdateProvider::OTADownloadProtocol::kHttps }, + { "VendorSpecific" , OtaSoftwareUpdateProvider::OTADownloadProtocol::kVendorSpecific }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, OtaSoftwareUpdateProvider::OTAQueryStatus> + table = { + { "UpdateAvailable" , OtaSoftwareUpdateProvider::OTAQueryStatus::kUpdateAvailable }, + { "Busy" , OtaSoftwareUpdateProvider::OTAQueryStatus::kBusy }, + { "NotAvailable" , OtaSoftwareUpdateProvider::OTAQueryStatus::kNotAvailable }, + { "DownloadProtocolNotSupported" , OtaSoftwareUpdateProvider::OTAQueryStatus::kDownloadProtocolNotSupported }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const OtaSoftwareUpdateRequestor::Structs::ProviderLocation::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, OtaSoftwareUpdateRequestor::OTAAnnouncementReason> + table = { + { "SimpleAnnouncement" , OtaSoftwareUpdateRequestor::OTAAnnouncementReason::kSimpleAnnouncement }, + { "UpdateAvailable" , OtaSoftwareUpdateRequestor::OTAAnnouncementReason::kUpdateAvailable }, + { "UrgentUpdateAvailable" , OtaSoftwareUpdateRequestor::OTAAnnouncementReason::kUrgentUpdateAvailable }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, OtaSoftwareUpdateRequestor::OTAChangeReasonEnum> + table = { + { "Unknown" , OtaSoftwareUpdateRequestor::OTAChangeReasonEnum::kUnknown }, + { "Success" , OtaSoftwareUpdateRequestor::OTAChangeReasonEnum::kSuccess }, + { "Failure" , OtaSoftwareUpdateRequestor::OTAChangeReasonEnum::kFailure }, + { "TimeOut" , OtaSoftwareUpdateRequestor::OTAChangeReasonEnum::kTimeOut }, + { "DelayByProvider" , OtaSoftwareUpdateRequestor::OTAChangeReasonEnum::kDelayByProvider }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, OtaSoftwareUpdateRequestor::OTAUpdateStateEnum> + table = { + { "Unknown" , OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kUnknown }, + { "Idle" , OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kIdle }, + { "Querying" , OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kQuerying }, + { "DelayedOnQuery" , OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kDelayedOnQuery }, + { "Downloading" , OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kDownloading }, + { "Applying" , OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kApplying }, + { "DelayedOnApply" , OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kDelayedOnApply }, + { "RollingBack" , OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kRollingBack }, + { "DelayedOnUserConsent" , OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kDelayedOnUserConsent }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, TimeFormatLocalization::CalendarType> + table = { + { "Buddhist" , TimeFormatLocalization::CalendarType::kBuddhist }, + { "Chinese" , TimeFormatLocalization::CalendarType::kChinese }, + { "Coptic" , TimeFormatLocalization::CalendarType::kCoptic }, + { "Ethiopian" , TimeFormatLocalization::CalendarType::kEthiopian }, + { "Gregorian" , TimeFormatLocalization::CalendarType::kGregorian }, + { "Hebrew" , TimeFormatLocalization::CalendarType::kHebrew }, + { "Indian" , TimeFormatLocalization::CalendarType::kIndian }, + { "Islamic" , TimeFormatLocalization::CalendarType::kIslamic }, + { "Japanese" , TimeFormatLocalization::CalendarType::kJapanese }, + { "Korean" , TimeFormatLocalization::CalendarType::kKorean }, + { "Persian" , TimeFormatLocalization::CalendarType::kPersian }, + { "Taiwanese" , TimeFormatLocalization::CalendarType::kTaiwanese }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, TimeFormatLocalization::HourFormat> + table = { + { "12hr" , TimeFormatLocalization::HourFormat::k12hr }, + { "24hr" , TimeFormatLocalization::HourFormat::k24hr }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, UnitLocalization::TempUnit> + table = { + { "Fahrenheit" , UnitLocalization::TempUnit::kFahrenheit }, + { "Celsius" , UnitLocalization::TempUnit::kCelsius }, + { "Kelvin" , UnitLocalization::TempUnit::kKelvin }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const PowerSource::Structs::BatChargeFaultChangeType::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const PowerSource::Structs::BatFaultChangeType::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const PowerSource::Structs::WiredFaultChangeType::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, PowerSource::BatChargeFault> + table = { + { "Unspecfied" , PowerSource::BatChargeFault::kUnspecfied }, + { "AmbientTooHot" , PowerSource::BatChargeFault::kAmbientTooHot }, + { "AmbientTooCold" , PowerSource::BatChargeFault::kAmbientTooCold }, + { "BatteryTooHot" , PowerSource::BatChargeFault::kBatteryTooHot }, + { "BatteryTooCold" , PowerSource::BatChargeFault::kBatteryTooCold }, + { "BatteryAbsent" , PowerSource::BatChargeFault::kBatteryAbsent }, + { "BatteryOverVoltage" , PowerSource::BatChargeFault::kBatteryOverVoltage }, + { "BatteryUnderVoltage" , PowerSource::BatChargeFault::kBatteryUnderVoltage }, + { "ChargerOverVoltage" , PowerSource::BatChargeFault::kChargerOverVoltage }, + { "ChargerUnderVoltage" , PowerSource::BatChargeFault::kChargerUnderVoltage }, + { "SafetyTimeout" , PowerSource::BatChargeFault::kSafetyTimeout }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, PowerSource::BatChargeLevel> + table = { + { "Ok" , PowerSource::BatChargeLevel::kOk }, + { "Warning" , PowerSource::BatChargeLevel::kWarning }, + { "Critical" , PowerSource::BatChargeLevel::kCritical }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, PowerSource::BatChargeState> + table = { + { "Unknown" , PowerSource::BatChargeState::kUnknown }, + { "IsCharging" , PowerSource::BatChargeState::kIsCharging }, + { "IsAtFullCharge" , PowerSource::BatChargeState::kIsAtFullCharge }, + { "IsNotCharging" , PowerSource::BatChargeState::kIsNotCharging }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, PowerSource::BatFault> + table = { + { "Unspecfied" , PowerSource::BatFault::kUnspecfied }, + { "OverTemp" , PowerSource::BatFault::kOverTemp }, + { "UnderTemp" , PowerSource::BatFault::kUnderTemp }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, PowerSource::BatReplaceability> + table = { + { "Unspecified" , PowerSource::BatReplaceability::kUnspecified }, + { "NotReplaceable" , PowerSource::BatReplaceability::kNotReplaceable }, + { "UserReplaceable" , PowerSource::BatReplaceability::kUserReplaceable }, + { "FactoryReplaceable" , PowerSource::BatReplaceability::kFactoryReplaceable }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, PowerSource::PowerSourceStatus> + table = { + { "Unspecfied" , PowerSource::PowerSourceStatus::kUnspecfied }, + { "Active" , PowerSource::PowerSourceStatus::kActive }, + { "Standby" , PowerSource::PowerSourceStatus::kStandby }, + { "Unavailable" , PowerSource::PowerSourceStatus::kUnavailable }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, PowerSource::WiredCurrentType> + table = { + { "Ac" , PowerSource::WiredCurrentType::kAc }, + { "Dc" , PowerSource::WiredCurrentType::kDc }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, PowerSource::WiredFault> + table = { + { "Unspecfied" , PowerSource::WiredFault::kUnspecfied }, + { "OverVoltage" , PowerSource::WiredFault::kOverVoltage }, + { "UnderVoltage" , PowerSource::WiredFault::kUnderVoltage }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const GeneralCommissioning::Structs::BasicCommissioningInfo::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, GeneralCommissioning::CommissioningError> + table = { + { "Ok" , GeneralCommissioning::CommissioningError::kOk }, + { "ValueOutsideRange" , GeneralCommissioning::CommissioningError::kValueOutsideRange }, + { "InvalidAuthentication" , GeneralCommissioning::CommissioningError::kInvalidAuthentication }, + { "NoFailSafe" , GeneralCommissioning::CommissioningError::kNoFailSafe }, + { "BusyWithOtherAdmin" , GeneralCommissioning::CommissioningError::kBusyWithOtherAdmin }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, GeneralCommissioning::RegulatoryLocationType> + table = { + { "Indoor" , GeneralCommissioning::RegulatoryLocationType::kIndoor }, + { "Outdoor" , GeneralCommissioning::RegulatoryLocationType::kOutdoor }, + { "IndoorOutdoor" , GeneralCommissioning::RegulatoryLocationType::kIndoorOutdoor }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const NetworkCommissioning::Structs::NetworkInfo::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const NetworkCommissioning::Structs::ThreadInterfaceScanResult::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const NetworkCommissioning::Structs::WiFiInterfaceScanResult::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, NetworkCommissioning::NetworkCommissioningStatus> + table = { + { "Success" , NetworkCommissioning::NetworkCommissioningStatus::kSuccess }, + { "OutOfRange" , NetworkCommissioning::NetworkCommissioningStatus::kOutOfRange }, + { "BoundsExceeded" , NetworkCommissioning::NetworkCommissioningStatus::kBoundsExceeded }, + { "NetworkIDNotFound" , NetworkCommissioning::NetworkCommissioningStatus::kNetworkIDNotFound }, + { "DuplicateNetworkID" , NetworkCommissioning::NetworkCommissioningStatus::kDuplicateNetworkID }, + { "NetworkNotFound" , NetworkCommissioning::NetworkCommissioningStatus::kNetworkNotFound }, + { "RegulatoryError" , NetworkCommissioning::NetworkCommissioningStatus::kRegulatoryError }, + { "AuthFailure" , NetworkCommissioning::NetworkCommissioningStatus::kAuthFailure }, + { "UnsupportedSecurity" , NetworkCommissioning::NetworkCommissioningStatus::kUnsupportedSecurity }, + { "OtherConnectionFailure" , NetworkCommissioning::NetworkCommissioningStatus::kOtherConnectionFailure }, + { "IPV6Failed" , NetworkCommissioning::NetworkCommissioningStatus::kIPV6Failed }, + { "IPBindFailed" , NetworkCommissioning::NetworkCommissioningStatus::kIPBindFailed }, + { "UnknownError" , NetworkCommissioning::NetworkCommissioningStatus::kUnknownError }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, NetworkCommissioning::WiFiBand> + table = { + { "2g4" , NetworkCommissioning::WiFiBand::k2g4 }, + { "3g65" , NetworkCommissioning::WiFiBand::k3g65 }, + { "5g" , NetworkCommissioning::WiFiBand::k5g }, + { "6g" , NetworkCommissioning::WiFiBand::k6g }, + { "60g" , NetworkCommissioning::WiFiBand::k60g }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DiagnosticLogs::LogsIntent> + table = { + { "EndUserSupport" , DiagnosticLogs::LogsIntent::kEndUserSupport }, + { "NetworkDiag" , DiagnosticLogs::LogsIntent::kNetworkDiag }, + { "CrashLogs" , DiagnosticLogs::LogsIntent::kCrashLogs }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DiagnosticLogs::LogsStatus> + table = { + { "Success" , DiagnosticLogs::LogsStatus::kSuccess }, + { "Exhausted" , DiagnosticLogs::LogsStatus::kExhausted }, + { "NoLogs" , DiagnosticLogs::LogsStatus::kNoLogs }, + { "Busy" , DiagnosticLogs::LogsStatus::kBusy }, + { "Denied" , DiagnosticLogs::LogsStatus::kDenied }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DiagnosticLogs::LogsTransferProtocol> + table = { + { "ResponsePayload" , DiagnosticLogs::LogsTransferProtocol::kResponsePayload }, + { "Bdx" , DiagnosticLogs::LogsTransferProtocol::kBdx }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const GeneralDiagnostics::Structs::NetworkInterfaceType::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, GeneralDiagnostics::BootReasonType> + table = { + { "Unspecified" , GeneralDiagnostics::BootReasonType::kUnspecified }, + { "PowerOnReboot" , GeneralDiagnostics::BootReasonType::kPowerOnReboot }, + { "BrownOutReset" , GeneralDiagnostics::BootReasonType::kBrownOutReset }, + { "SoftwareWatchdogReset" , GeneralDiagnostics::BootReasonType::kSoftwareWatchdogReset }, + { "HardwareWatchdogReset" , GeneralDiagnostics::BootReasonType::kHardwareWatchdogReset }, + { "SoftwareUpdateCompleted" , GeneralDiagnostics::BootReasonType::kSoftwareUpdateCompleted }, + { "SoftwareReset" , GeneralDiagnostics::BootReasonType::kSoftwareReset }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, GeneralDiagnostics::HardwareFaultType> + table = { + { "Unspecified" , GeneralDiagnostics::HardwareFaultType::kUnspecified }, + { "Radio" , GeneralDiagnostics::HardwareFaultType::kRadio }, + { "Sensor" , GeneralDiagnostics::HardwareFaultType::kSensor }, + { "ResettableOverTemp" , GeneralDiagnostics::HardwareFaultType::kResettableOverTemp }, + { "NonResettableOverTemp" , GeneralDiagnostics::HardwareFaultType::kNonResettableOverTemp }, + { "PowerSource" , GeneralDiagnostics::HardwareFaultType::kPowerSource }, + { "VisualDisplayFault" , GeneralDiagnostics::HardwareFaultType::kVisualDisplayFault }, + { "AudioOutputFault" , GeneralDiagnostics::HardwareFaultType::kAudioOutputFault }, + { "UserInterfaceFault" , GeneralDiagnostics::HardwareFaultType::kUserInterfaceFault }, + { "NonVolatileMemoryError" , GeneralDiagnostics::HardwareFaultType::kNonVolatileMemoryError }, + { "TamperDetected" , GeneralDiagnostics::HardwareFaultType::kTamperDetected }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, GeneralDiagnostics::InterfaceType> + table = { + { "Unspecified" , GeneralDiagnostics::InterfaceType::kUnspecified }, + { "WiFi" , GeneralDiagnostics::InterfaceType::kWiFi }, + { "Ethernet" , GeneralDiagnostics::InterfaceType::kEthernet }, + { "Cellular" , GeneralDiagnostics::InterfaceType::kCellular }, + { "Thread" , GeneralDiagnostics::InterfaceType::kThread }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, GeneralDiagnostics::NetworkFaultType> + table = { + { "Unspecified" , GeneralDiagnostics::NetworkFaultType::kUnspecified }, + { "HardwareFailure" , GeneralDiagnostics::NetworkFaultType::kHardwareFailure }, + { "NetworkJammed" , GeneralDiagnostics::NetworkFaultType::kNetworkJammed }, + { "ConnectionFailed" , GeneralDiagnostics::NetworkFaultType::kConnectionFailed }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, GeneralDiagnostics::RadioFaultType> + table = { + { "Unspecified" , GeneralDiagnostics::RadioFaultType::kUnspecified }, + { "WiFiFault" , GeneralDiagnostics::RadioFaultType::kWiFiFault }, + { "CellularFault" , GeneralDiagnostics::RadioFaultType::kCellularFault }, + { "ThreadFault" , GeneralDiagnostics::RadioFaultType::kThreadFault }, + { "NFCFault" , GeneralDiagnostics::RadioFaultType::kNFCFault }, + { "BLEFault" , GeneralDiagnostics::RadioFaultType::kBLEFault }, + { "EthernetFault" , GeneralDiagnostics::RadioFaultType::kEthernetFault }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const SoftwareDiagnostics::Structs::ThreadMetrics::Type& value) { +// return "no struct support"; +//} +// +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const ThreadNetworkDiagnostics::Structs::NeighborTable::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const ThreadNetworkDiagnostics::Structs::OperationalDatasetComponents::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const ThreadNetworkDiagnostics::Structs::RouteTable::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const ThreadNetworkDiagnostics::Structs::SecurityPolicy::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ThreadNetworkDiagnostics::NetworkFault> + table = { + { "Unspecified" , ThreadNetworkDiagnostics::NetworkFault::kUnspecified }, + { "LinkDown" , ThreadNetworkDiagnostics::NetworkFault::kLinkDown }, + { "HardwareFailure" , ThreadNetworkDiagnostics::NetworkFault::kHardwareFailure }, + { "NetworkJammed" , ThreadNetworkDiagnostics::NetworkFault::kNetworkJammed }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ThreadNetworkDiagnostics::RoutingRole> + table = { + { "Unspecified" , ThreadNetworkDiagnostics::RoutingRole::kUnspecified }, + { "Unassigned" , ThreadNetworkDiagnostics::RoutingRole::kUnassigned }, + { "SleepyEndDevice" , ThreadNetworkDiagnostics::RoutingRole::kSleepyEndDevice }, + { "EndDevice" , ThreadNetworkDiagnostics::RoutingRole::kEndDevice }, + { "Reed" , ThreadNetworkDiagnostics::RoutingRole::kReed }, + { "Router" , ThreadNetworkDiagnostics::RoutingRole::kRouter }, + { "Leader" , ThreadNetworkDiagnostics::RoutingRole::kLeader }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ThreadNetworkDiagnostics::ThreadConnectionStatus> + table = { + { "Connected" , ThreadNetworkDiagnostics::ThreadConnectionStatus::kConnected }, + { "NotConnected" , ThreadNetworkDiagnostics::ThreadConnectionStatus::kNotConnected }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, WiFiNetworkDiagnostics::AssociationFailureCause> + table = { + { "Unknown" , WiFiNetworkDiagnostics::AssociationFailureCause::kUnknown }, + { "AssociationFailed" , WiFiNetworkDiagnostics::AssociationFailureCause::kAssociationFailed }, + { "AuthenticationFailed" , WiFiNetworkDiagnostics::AssociationFailureCause::kAuthenticationFailed }, + { "SsidNotFound" , WiFiNetworkDiagnostics::AssociationFailureCause::kSsidNotFound }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, WiFiNetworkDiagnostics::SecurityType> + table = { + { "Unspecified" , WiFiNetworkDiagnostics::SecurityType::kUnspecified }, + { "None" , WiFiNetworkDiagnostics::SecurityType::kNone }, + { "Wep" , WiFiNetworkDiagnostics::SecurityType::kWep }, + { "Wpa" , WiFiNetworkDiagnostics::SecurityType::kWpa }, + { "Wpa2" , WiFiNetworkDiagnostics::SecurityType::kWpa2 }, + { "Wpa3" , WiFiNetworkDiagnostics::SecurityType::kWpa3 }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, WiFiNetworkDiagnostics::WiFiConnectionStatus> + table = { + { "Connected" , WiFiNetworkDiagnostics::WiFiConnectionStatus::kConnected }, + { "NotConnected" , WiFiNetworkDiagnostics::WiFiConnectionStatus::kNotConnected }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, WiFiNetworkDiagnostics::WiFiVersionType> + table = { + { "80211a" , WiFiNetworkDiagnostics::WiFiVersionType::k80211a }, + { "80211b" , WiFiNetworkDiagnostics::WiFiVersionType::k80211b }, + { "80211g" , WiFiNetworkDiagnostics::WiFiVersionType::k80211g }, + { "80211n" , WiFiNetworkDiagnostics::WiFiVersionType::k80211n }, + { "80211ac" , WiFiNetworkDiagnostics::WiFiVersionType::k80211ac }, + { "80211ax" , WiFiNetworkDiagnostics::WiFiVersionType::k80211ax }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, EthernetNetworkDiagnostics::PHYRateType> + table = { + { "10m" , EthernetNetworkDiagnostics::PHYRateType::k10m }, + { "100m" , EthernetNetworkDiagnostics::PHYRateType::k100m }, + { "1000m" , EthernetNetworkDiagnostics::PHYRateType::k1000m }, + { "25g" , EthernetNetworkDiagnostics::PHYRateType::k25g }, + { "5g" , EthernetNetworkDiagnostics::PHYRateType::k5g }, + { "10g" , EthernetNetworkDiagnostics::PHYRateType::k10g }, + { "40g" , EthernetNetworkDiagnostics::PHYRateType::k40g }, + { "100g" , EthernetNetworkDiagnostics::PHYRateType::k100g }, + { "200g" , EthernetNetworkDiagnostics::PHYRateType::k200g }, + { "400g" , EthernetNetworkDiagnostics::PHYRateType::k400g }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const TimeSynchronization::Structs::DstOffsetType::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const TimeSynchronization::Structs::TimeZoneType::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, TimeSynchronization::GranularityEnum> + table = { + { "NoTimeGranularity" , TimeSynchronization::GranularityEnum::kNoTimeGranularity }, + { "MinutesGranularity" , TimeSynchronization::GranularityEnum::kMinutesGranularity }, + { "SecondsGranularity" , TimeSynchronization::GranularityEnum::kSecondsGranularity }, + { "MillisecondsGranularity" , TimeSynchronization::GranularityEnum::kMillisecondsGranularity }, + { "MicrosecondsGranularity" , TimeSynchronization::GranularityEnum::kMicrosecondsGranularity }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, TimeSynchronization::TimeSourceEnum> + table = { + { "None" , TimeSynchronization::TimeSourceEnum::kNone }, + { "Unknown" , TimeSynchronization::TimeSourceEnum::kUnknown }, + { "Admin" , TimeSynchronization::TimeSourceEnum::kAdmin }, + { "NodeTimeCluster" , TimeSynchronization::TimeSourceEnum::kNodeTimeCluster }, + { "NonFabricSntp" , TimeSynchronization::TimeSourceEnum::kNonFabricSntp }, + { "NonFabricNtp" , TimeSynchronization::TimeSourceEnum::kNonFabricNtp }, + { "FabricSntp" , TimeSynchronization::TimeSourceEnum::kFabricSntp }, + { "FabricNtp" , TimeSynchronization::TimeSourceEnum::kFabricNtp }, + { "MixedNtp" , TimeSynchronization::TimeSourceEnum::kMixedNtp }, + { "NonFabricSntpNts" , TimeSynchronization::TimeSourceEnum::kNonFabricSntpNts }, + { "NonFabricNtpNts" , TimeSynchronization::TimeSourceEnum::kNonFabricNtpNts }, + { "FabricSntpNts" , TimeSynchronization::TimeSourceEnum::kFabricSntpNts }, + { "FabricNtpNts" , TimeSynchronization::TimeSourceEnum::kFabricNtpNts }, + { "MixedNtpNts" , TimeSynchronization::TimeSourceEnum::kMixedNtpNts }, + { "CloudSource" , TimeSynchronization::TimeSourceEnum::kCloudSource }, + { "Ptp" , TimeSynchronization::TimeSourceEnum::kPtp }, + { "Gnss" , TimeSynchronization::TimeSourceEnum::kGnss }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, AdministratorCommissioning::CommissioningWindowStatus> + table = { + { "WindowNotOpen" , AdministratorCommissioning::CommissioningWindowStatus::kWindowNotOpen }, + { "EnhancedWindowOpen" , AdministratorCommissioning::CommissioningWindowStatus::kEnhancedWindowOpen }, + { "BasicWindowOpen" , AdministratorCommissioning::CommissioningWindowStatus::kBasicWindowOpen }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, AdministratorCommissioning::StatusCode> + table = { + { "Busy" , AdministratorCommissioning::StatusCode::kBusy }, + { "PAKEParameterError" , AdministratorCommissioning::StatusCode::kPAKEParameterError }, + { "WindowNotOpen" , AdministratorCommissioning::StatusCode::kWindowNotOpen }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const OperationalCredentials::Structs::FabricDescriptor::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const OperationalCredentials::Structs::NOCStruct::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, OperationalCredentials::OperationalCertStatus> + table = { + { "Success" , OperationalCredentials::OperationalCertStatus::kSuccess }, + { "InvalidPublicKey" , OperationalCredentials::OperationalCertStatus::kInvalidPublicKey }, + { "InvalidNodeOpId" , OperationalCredentials::OperationalCertStatus::kInvalidNodeOpId }, + { "InvalidNOC" , OperationalCredentials::OperationalCertStatus::kInvalidNOC }, + { "MissingCsr" , OperationalCredentials::OperationalCertStatus::kMissingCsr }, + { "TableFull" , OperationalCredentials::OperationalCertStatus::kTableFull }, + { "InvalidAdminSubject" , OperationalCredentials::OperationalCertStatus::kInvalidAdminSubject }, + { "FabricConflict" , OperationalCredentials::OperationalCertStatus::kFabricConflict }, + { "LabelConflict" , OperationalCredentials::OperationalCertStatus::kLabelConflict }, + { "InvalidFabricIndex" , OperationalCredentials::OperationalCertStatus::kInvalidFabricIndex }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const GroupKeyManagement::Structs::GroupInfoMapStruct::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const GroupKeyManagement::Structs::GroupKeyMapStruct::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const GroupKeyManagement::Structs::GroupKeySetStruct::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, GroupKeyManagement::GroupKeySecurityPolicy> + table = { + { "TrustFirst" , GroupKeyManagement::GroupKeySecurityPolicy::kTrustFirst }, + { "CacheAndSync" , GroupKeyManagement::GroupKeySecurityPolicy::kCacheAndSync }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const FixedLabel::Structs::LabelStruct::Type& value) { +// return "no struct support"; +//} +// +// + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const UserLabel::Structs::LabelStruct::Type& value) { +// return "no struct support"; +//} +// +// + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const ModeSelect::Structs::SemanticTag::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const ModeSelect::Structs::ModeOptionStruct::Type& value) { +// return "no struct support"; +//} +// +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const DoorLock::Structs::DlCredential::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlAlarmCode> + table = { + { "LockJammed" , DoorLock::DlAlarmCode::kLockJammed }, + { "LockFactoryReset" , DoorLock::DlAlarmCode::kLockFactoryReset }, + { "LockRadioPowerCycled" , DoorLock::DlAlarmCode::kLockRadioPowerCycled }, + { "WrongCodeEntryLimit" , DoorLock::DlAlarmCode::kWrongCodeEntryLimit }, + { "FrontEsceutcheonRemoved" , DoorLock::DlAlarmCode::kFrontEsceutcheonRemoved }, + { "DoorForcedOpen" , DoorLock::DlAlarmCode::kDoorForcedOpen }, + { "DoorAjar" , DoorLock::DlAlarmCode::kDoorAjar }, + { "ForcedUser" , DoorLock::DlAlarmCode::kForcedUser }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlCredentialRule> + table = { + { "Single" , DoorLock::DlCredentialRule::kSingle }, + { "Double" , DoorLock::DlCredentialRule::kDouble }, + { "Tri" , DoorLock::DlCredentialRule::kTri }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlCredentialType> + table = { + { "ProgrammingPIN" , DoorLock::DlCredentialType::kProgrammingPIN }, + { "Pin" , DoorLock::DlCredentialType::kPin }, + { "Rfid" , DoorLock::DlCredentialType::kRfid }, + { "Fingerprint" , DoorLock::DlCredentialType::kFingerprint }, + { "FingerVein" , DoorLock::DlCredentialType::kFingerVein }, + { "Face" , DoorLock::DlCredentialType::kFace }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlDataOperationType> + table = { + { "Add" , DoorLock::DlDataOperationType::kAdd }, + { "Clear" , DoorLock::DlDataOperationType::kClear }, + { "Modify" , DoorLock::DlDataOperationType::kModify }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlDoorState> + table = { + { "DoorOpen" , DoorLock::DlDoorState::kDoorOpen }, + { "DoorClosed" , DoorLock::DlDoorState::kDoorClosed }, + { "DoorJammed" , DoorLock::DlDoorState::kDoorJammed }, + { "DoorForcedOpen" , DoorLock::DlDoorState::kDoorForcedOpen }, + { "DoorUnspecifiedError" , DoorLock::DlDoorState::kDoorUnspecifiedError }, + { "DoorAjar" , DoorLock::DlDoorState::kDoorAjar }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlLockDataType> + table = { + { "Unspecified" , DoorLock::DlLockDataType::kUnspecified }, + { "ProgrammingCode" , DoorLock::DlLockDataType::kProgrammingCode }, + { "UserIndex" , DoorLock::DlLockDataType::kUserIndex }, + { "WeekDaySchedule" , DoorLock::DlLockDataType::kWeekDaySchedule }, + { "YearDaySchedule" , DoorLock::DlLockDataType::kYearDaySchedule }, + { "HolidaySchedule" , DoorLock::DlLockDataType::kHolidaySchedule }, + { "Pin" , DoorLock::DlLockDataType::kPin }, + { "Rfid" , DoorLock::DlLockDataType::kRfid }, + { "Fingerprint" , DoorLock::DlLockDataType::kFingerprint }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlLockOperationType> + table = { + { "Lock" , DoorLock::DlLockOperationType::kLock }, + { "Unlock" , DoorLock::DlLockOperationType::kUnlock }, + { "NonAccessUserEvent" , DoorLock::DlLockOperationType::kNonAccessUserEvent }, + { "ForcedUserEvent" , DoorLock::DlLockOperationType::kForcedUserEvent }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlLockState> + table = { + { "NotFullyLocked" , DoorLock::DlLockState::kNotFullyLocked }, + { "Locked" , DoorLock::DlLockState::kLocked }, + { "Unlocked" , DoorLock::DlLockState::kUnlocked }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlLockType> + table = { + { "DeadBolt" , DoorLock::DlLockType::kDeadBolt }, + { "Magnetic" , DoorLock::DlLockType::kMagnetic }, + { "Other" , DoorLock::DlLockType::kOther }, + { "Mortise" , DoorLock::DlLockType::kMortise }, + { "Rim" , DoorLock::DlLockType::kRim }, + { "LatchBolt" , DoorLock::DlLockType::kLatchBolt }, + { "CylindricalLock" , DoorLock::DlLockType::kCylindricalLock }, + { "TubularLock" , DoorLock::DlLockType::kTubularLock }, + { "InterconnectedLock" , DoorLock::DlLockType::kInterconnectedLock }, + { "DeadLatch" , DoorLock::DlLockType::kDeadLatch }, + { "DoorFurniture" , DoorLock::DlLockType::kDoorFurniture }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlOperatingMode> + table = { + { "Normal" , DoorLock::DlOperatingMode::kNormal }, + { "Vacation" , DoorLock::DlOperatingMode::kVacation }, + { "Privacy" , DoorLock::DlOperatingMode::kPrivacy }, + { "NoRemoteLockUnlock" , DoorLock::DlOperatingMode::kNoRemoteLockUnlock }, + { "Passage" , DoorLock::DlOperatingMode::kPassage }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlOperationError> + table = { + { "Unspecified" , DoorLock::DlOperationError::kUnspecified }, + { "InvalidCredential" , DoorLock::DlOperationError::kInvalidCredential }, + { "DisabledUserDenied" , DoorLock::DlOperationError::kDisabledUserDenied }, + { "Restricted" , DoorLock::DlOperationError::kRestricted }, + { "InsufficientBattery" , DoorLock::DlOperationError::kInsufficientBattery }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlOperationSource> + table = { + { "Unspecified" , DoorLock::DlOperationSource::kUnspecified }, + { "Manual" , DoorLock::DlOperationSource::kManual }, + { "ProprietaryRemote" , DoorLock::DlOperationSource::kProprietaryRemote }, + { "Keypad" , DoorLock::DlOperationSource::kKeypad }, + { "Auto" , DoorLock::DlOperationSource::kAuto }, + { "Button" , DoorLock::DlOperationSource::kButton }, + { "Schedule" , DoorLock::DlOperationSource::kSchedule }, + { "Remote" , DoorLock::DlOperationSource::kRemote }, + { "Rfid" , DoorLock::DlOperationSource::kRfid }, + { "Biometric" , DoorLock::DlOperationSource::kBiometric }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlStatus> + table = { + { "Success" , DoorLock::DlStatus::kSuccess }, + { "Failure" , DoorLock::DlStatus::kFailure }, + { "Duplicate" , DoorLock::DlStatus::kDuplicate }, + { "Occupied" , DoorLock::DlStatus::kOccupied }, + { "InvalidField" , DoorLock::DlStatus::kInvalidField }, + { "ResourceExhausted" , DoorLock::DlStatus::kResourceExhausted }, + { "NotFound" , DoorLock::DlStatus::kNotFound }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlUserStatus> + table = { + { "Available" , DoorLock::DlUserStatus::kAvailable }, + { "OccupiedEnabled" , DoorLock::DlUserStatus::kOccupiedEnabled }, + { "OccupiedDisabled" , DoorLock::DlUserStatus::kOccupiedDisabled }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DlUserType> + table = { + { "UnrestrictedUser" , DoorLock::DlUserType::kUnrestrictedUser }, + { "YearDayScheduleUser" , DoorLock::DlUserType::kYearDayScheduleUser }, + { "WeekDayScheduleUser" , DoorLock::DlUserType::kWeekDayScheduleUser }, + { "ProgrammingUser" , DoorLock::DlUserType::kProgrammingUser }, + { "NonAccessUser" , DoorLock::DlUserType::kNonAccessUser }, + { "ForcedUser" , DoorLock::DlUserType::kForcedUser }, + { "DisposableUser" , DoorLock::DlUserType::kDisposableUser }, + { "ExpiringUser" , DoorLock::DlUserType::kExpiringUser }, + { "ScheduleRestrictedUser" , DoorLock::DlUserType::kScheduleRestrictedUser }, + { "RemoteOnlyUser" , DoorLock::DlUserType::kRemoteOnlyUser }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DoorLockOperationEventCode> + table = { + { "UnknownOrMfgSpecific" , DoorLock::DoorLockOperationEventCode::kUnknownOrMfgSpecific }, + { "Lock" , DoorLock::DoorLockOperationEventCode::kLock }, + { "Unlock" , DoorLock::DoorLockOperationEventCode::kUnlock }, + { "LockInvalidPinOrId" , DoorLock::DoorLockOperationEventCode::kLockInvalidPinOrId }, + { "LockInvalidSchedule" , DoorLock::DoorLockOperationEventCode::kLockInvalidSchedule }, + { "UnlockInvalidPinOrId" , DoorLock::DoorLockOperationEventCode::kUnlockInvalidPinOrId }, + { "UnlockInvalidSchedule" , DoorLock::DoorLockOperationEventCode::kUnlockInvalidSchedule }, + { "OneTouchLock" , DoorLock::DoorLockOperationEventCode::kOneTouchLock }, + { "KeyLock" , DoorLock::DoorLockOperationEventCode::kKeyLock }, + { "KeyUnlock" , DoorLock::DoorLockOperationEventCode::kKeyUnlock }, + { "AutoLock" , DoorLock::DoorLockOperationEventCode::kAutoLock }, + { "ScheduleLock" , DoorLock::DoorLockOperationEventCode::kScheduleLock }, + { "ScheduleUnlock" , DoorLock::DoorLockOperationEventCode::kScheduleUnlock }, + { "ManualLock" , DoorLock::DoorLockOperationEventCode::kManualLock }, + { "ManualUnlock" , DoorLock::DoorLockOperationEventCode::kManualUnlock }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DoorLockProgrammingEventCode> + table = { + { "UnknownOrMfgSpecific" , DoorLock::DoorLockProgrammingEventCode::kUnknownOrMfgSpecific }, + { "MasterCodeChanged" , DoorLock::DoorLockProgrammingEventCode::kMasterCodeChanged }, + { "PinAdded" , DoorLock::DoorLockProgrammingEventCode::kPinAdded }, + { "PinDeleted" , DoorLock::DoorLockProgrammingEventCode::kPinDeleted }, + { "PinChanged" , DoorLock::DoorLockProgrammingEventCode::kPinChanged }, + { "IdAdded" , DoorLock::DoorLockProgrammingEventCode::kIdAdded }, + { "IdDeleted" , DoorLock::DoorLockProgrammingEventCode::kIdDeleted }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DoorLockSetPinOrIdStatus> + table = { + { "Success" , DoorLock::DoorLockSetPinOrIdStatus::kSuccess }, + { "GeneralFailure" , DoorLock::DoorLockSetPinOrIdStatus::kGeneralFailure }, + { "MemoryFull" , DoorLock::DoorLockSetPinOrIdStatus::kMemoryFull }, + { "DuplicateCodeError" , DoorLock::DoorLockSetPinOrIdStatus::kDuplicateCodeError }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DoorLockUserStatus> + table = { + { "Available" , DoorLock::DoorLockUserStatus::kAvailable }, + { "OccupiedEnabled" , DoorLock::DoorLockUserStatus::kOccupiedEnabled }, + { "OccupiedDisabled" , DoorLock::DoorLockUserStatus::kOccupiedDisabled }, + { "NotSupported" , DoorLock::DoorLockUserStatus::kNotSupported }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, DoorLock::DoorLockUserType> + table = { + { "Unrestricted" , DoorLock::DoorLockUserType::kUnrestricted }, + { "YearDayScheduleUser" , DoorLock::DoorLockUserType::kYearDayScheduleUser }, + { "WeekDayScheduleUser" , DoorLock::DoorLockUserType::kWeekDayScheduleUser }, + { "MasterUser" , DoorLock::DoorLockUserType::kMasterUser }, + { "NonAccessUser" , DoorLock::DoorLockUserType::kNonAccessUser }, + { "NotSupported" , DoorLock::DoorLockUserType::kNotSupported }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, WindowCovering::EndProductType> + table = { + { "RollerShade" , WindowCovering::EndProductType::kRollerShade }, + { "RomanShade" , WindowCovering::EndProductType::kRomanShade }, + { "BalloonShade" , WindowCovering::EndProductType::kBalloonShade }, + { "WovenWood" , WindowCovering::EndProductType::kWovenWood }, + { "PleatedShade" , WindowCovering::EndProductType::kPleatedShade }, + { "CellularShade" , WindowCovering::EndProductType::kCellularShade }, + { "LayeredShade" , WindowCovering::EndProductType::kLayeredShade }, + { "LayeredShade2D" , WindowCovering::EndProductType::kLayeredShade2D }, + { "SheerShade" , WindowCovering::EndProductType::kSheerShade }, + { "TiltOnlyInteriorBlind" , WindowCovering::EndProductType::kTiltOnlyInteriorBlind }, + { "InteriorBlind" , WindowCovering::EndProductType::kInteriorBlind }, + { "VerticalBlindStripCurtain" , WindowCovering::EndProductType::kVerticalBlindStripCurtain }, + { "InteriorVenetianBlind" , WindowCovering::EndProductType::kInteriorVenetianBlind }, + { "ExteriorVenetianBlind" , WindowCovering::EndProductType::kExteriorVenetianBlind }, + { "LateralLeftCurtain" , WindowCovering::EndProductType::kLateralLeftCurtain }, + { "LateralRightCurtain" , WindowCovering::EndProductType::kLateralRightCurtain }, + { "CentralCurtain" , WindowCovering::EndProductType::kCentralCurtain }, + { "RollerShutter" , WindowCovering::EndProductType::kRollerShutter }, + { "ExteriorVerticalScreen" , WindowCovering::EndProductType::kExteriorVerticalScreen }, + { "AwningTerracePatio" , WindowCovering::EndProductType::kAwningTerracePatio }, + { "AwningVerticalScreen" , WindowCovering::EndProductType::kAwningVerticalScreen }, + { "TiltOnlyPergola" , WindowCovering::EndProductType::kTiltOnlyPergola }, + { "SwingingShutter" , WindowCovering::EndProductType::kSwingingShutter }, + { "SlidingShutter" , WindowCovering::EndProductType::kSlidingShutter }, + { "Unknown" , WindowCovering::EndProductType::kUnknown }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, WindowCovering::Type> + table = { + { "RollerShade" , WindowCovering::Type::kRollerShade }, + { "RollerShade2Motor" , WindowCovering::Type::kRollerShade2Motor }, + { "RollerShadeExterior" , WindowCovering::Type::kRollerShadeExterior }, + { "RollerShadeExterior2Motor" , WindowCovering::Type::kRollerShadeExterior2Motor }, + { "Drapery" , WindowCovering::Type::kDrapery }, + { "Awning" , WindowCovering::Type::kAwning }, + { "Shutter" , WindowCovering::Type::kShutter }, + { "TiltBlindTiltOnly" , WindowCovering::Type::kTiltBlindTiltOnly }, + { "TiltBlindLiftAndTilt" , WindowCovering::Type::kTiltBlindLiftAndTilt }, + { "ProjectorScreen" , WindowCovering::Type::kProjectorScreen }, + { "Unknown" , WindowCovering::Type::kUnknown }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, PumpConfigurationAndControl::PumpControlMode> + table = { + { "ConstantSpeed" , PumpConfigurationAndControl::PumpControlMode::kConstantSpeed }, + { "ConstantPressure" , PumpConfigurationAndControl::PumpControlMode::kConstantPressure }, + { "ProportionalPressure" , PumpConfigurationAndControl::PumpControlMode::kProportionalPressure }, + { "ConstantFlow" , PumpConfigurationAndControl::PumpControlMode::kConstantFlow }, + { "ConstantTemperature" , PumpConfigurationAndControl::PumpControlMode::kConstantTemperature }, + { "Automatic" , PumpConfigurationAndControl::PumpControlMode::kAutomatic }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, PumpConfigurationAndControl::PumpOperationMode> + table = { + { "Normal" , PumpConfigurationAndControl::PumpOperationMode::kNormal }, + { "Minimum" , PumpConfigurationAndControl::PumpOperationMode::kMinimum }, + { "Maximum" , PumpConfigurationAndControl::PumpOperationMode::kMaximum }, + { "Local" , PumpConfigurationAndControl::PumpOperationMode::kLocal }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const Thermostat::Structs::ThermostatScheduleTransition::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Thermostat::SetpointAdjustMode> + table = { + { "HeatSetpoint" , Thermostat::SetpointAdjustMode::kHeatSetpoint }, + { "CoolSetpoint" , Thermostat::SetpointAdjustMode::kCoolSetpoint }, + { "HeatAndCoolSetpoints" , Thermostat::SetpointAdjustMode::kHeatAndCoolSetpoints }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Thermostat::ThermostatControlSequence> + table = { + { "CoolingOnly" , Thermostat::ThermostatControlSequence::kCoolingOnly }, + { "CoolingWithReheat" , Thermostat::ThermostatControlSequence::kCoolingWithReheat }, + { "HeatingOnly" , Thermostat::ThermostatControlSequence::kHeatingOnly }, + { "HeatingWithReheat" , Thermostat::ThermostatControlSequence::kHeatingWithReheat }, + { "CoolingAndHeating" , Thermostat::ThermostatControlSequence::kCoolingAndHeating }, + { "CoolingAndHeatingWithReheat" , Thermostat::ThermostatControlSequence::kCoolingAndHeatingWithReheat }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Thermostat::ThermostatRunningMode> + table = { + { "Off" , Thermostat::ThermostatRunningMode::kOff }, + { "Cool" , Thermostat::ThermostatRunningMode::kCool }, + { "Heat" , Thermostat::ThermostatRunningMode::kHeat }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Thermostat::ThermostatSystemMode> + table = { + { "Off" , Thermostat::ThermostatSystemMode::kOff }, + { "Auto" , Thermostat::ThermostatSystemMode::kAuto }, + { "Cool" , Thermostat::ThermostatSystemMode::kCool }, + { "Heat" , Thermostat::ThermostatSystemMode::kHeat }, + { "EmergencyHeating" , Thermostat::ThermostatSystemMode::kEmergencyHeating }, + { "Precooling" , Thermostat::ThermostatSystemMode::kPrecooling }, + { "FanOnly" , Thermostat::ThermostatSystemMode::kFanOnly }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, FanControl::FanModeSequenceType> + table = { + { "OffLowMedHigh" , FanControl::FanModeSequenceType::kOffLowMedHigh }, + { "OffLowHigh" , FanControl::FanModeSequenceType::kOffLowHigh }, + { "OffLowMedHighAuto" , FanControl::FanModeSequenceType::kOffLowMedHighAuto }, + { "OffLowHighAuto" , FanControl::FanModeSequenceType::kOffLowHighAuto }, + { "OffOnAuto" , FanControl::FanModeSequenceType::kOffOnAuto }, + { "OffOn" , FanControl::FanModeSequenceType::kOffOn }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, FanControl::FanModeType> + table = { + { "Off" , FanControl::FanModeType::kOff }, + { "Low" , FanControl::FanModeType::kLow }, + { "Medium" , FanControl::FanModeType::kMedium }, + { "High" , FanControl::FanModeType::kHigh }, + { "On" , FanControl::FanModeType::kOn }, + { "Auto" , FanControl::FanModeType::kAuto }, + { "Smart" , FanControl::FanModeType::kSmart }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ColorControl::ColorLoopAction> + table = { + { "Deactivate" , ColorControl::ColorLoopAction::kDeactivate }, + { "ActivateFromColorLoopStartEnhancedHue" , ColorControl::ColorLoopAction::kActivateFromColorLoopStartEnhancedHue }, + { "ActivateFromEnhancedCurrentHue" , ColorControl::ColorLoopAction::kActivateFromEnhancedCurrentHue }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ColorControl::ColorLoopDirection> + table = { + { "DecrementHue" , ColorControl::ColorLoopDirection::kDecrementHue }, + { "IncrementHue" , ColorControl::ColorLoopDirection::kIncrementHue }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ColorControl::ColorMode> + table = { + { "CurrentHueAndCurrentSaturation" , ColorControl::ColorMode::kCurrentHueAndCurrentSaturation }, + { "CurrentXAndCurrentY" , ColorControl::ColorMode::kCurrentXAndCurrentY }, + { "ColorTemperature" , ColorControl::ColorMode::kColorTemperature }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ColorControl::HueDirection> + table = { + { "ShortestDistance" , ColorControl::HueDirection::kShortestDistance }, + { "LongestDistance" , ColorControl::HueDirection::kLongestDistance }, + { "Up" , ColorControl::HueDirection::kUp }, + { "Down" , ColorControl::HueDirection::kDown }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ColorControl::HueMoveMode> + table = { + { "Stop" , ColorControl::HueMoveMode::kStop }, + { "Up" , ColorControl::HueMoveMode::kUp }, + { "Down" , ColorControl::HueMoveMode::kDown }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ColorControl::HueStepMode> + table = { + { "Up" , ColorControl::HueStepMode::kUp }, + { "Down" , ColorControl::HueStepMode::kDown }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ColorControl::SaturationMoveMode> + table = { + { "Stop" , ColorControl::SaturationMoveMode::kStop }, + { "Up" , ColorControl::SaturationMoveMode::kUp }, + { "Down" , ColorControl::SaturationMoveMode::kDown }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ColorControl::SaturationStepMode> + table = { + { "Up" , ColorControl::SaturationStepMode::kUp }, + { "Down" , ColorControl::SaturationStepMode::kDown }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, IlluminanceMeasurement::LightSensorType> + table = { + { "Photodiode" , IlluminanceMeasurement::LightSensorType::kPhotodiode }, + { "Cmos" , IlluminanceMeasurement::LightSensorType::kCmos }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const Channel::Structs::ChannelInfo::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const Channel::Structs::LineupInfo::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Channel::ChannelStatusEnum> + table = { + { "Success" , Channel::ChannelStatusEnum::kSuccess }, + { "MultipleMatches" , Channel::ChannelStatusEnum::kMultipleMatches }, + { "NoMatches" , Channel::ChannelStatusEnum::kNoMatches }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, Channel::LineupInfoTypeEnum> + table = { + { "Mso" , Channel::LineupInfoTypeEnum::kMso }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const TargetNavigator::Structs::TargetInfo::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, TargetNavigator::TargetNavigatorStatusEnum> + table = { + { "Success" , TargetNavigator::TargetNavigatorStatusEnum::kSuccess }, + { "TargetNotFound" , TargetNavigator::TargetNavigatorStatusEnum::kTargetNotFound }, + { "NotAllowed" , TargetNavigator::TargetNavigatorStatusEnum::kNotAllowed }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const MediaPlayback::Structs::PlaybackPosition::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, MediaPlayback::MediaPlaybackStatusEnum> + table = { + { "Success" , MediaPlayback::MediaPlaybackStatusEnum::kSuccess }, + { "InvalidStateForCommand" , MediaPlayback::MediaPlaybackStatusEnum::kInvalidStateForCommand }, + { "NotAllowed" , MediaPlayback::MediaPlaybackStatusEnum::kNotAllowed }, + { "NotActive" , MediaPlayback::MediaPlaybackStatusEnum::kNotActive }, + { "SpeedOutOfRange" , MediaPlayback::MediaPlaybackStatusEnum::kSpeedOutOfRange }, + { "SeekOutOfRange" , MediaPlayback::MediaPlaybackStatusEnum::kSeekOutOfRange }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, MediaPlayback::PlaybackStateEnum> + table = { + { "Playing" , MediaPlayback::PlaybackStateEnum::kPlaying }, + { "Paused" , MediaPlayback::PlaybackStateEnum::kPaused }, + { "NotPlaying" , MediaPlayback::PlaybackStateEnum::kNotPlaying }, + { "Buffering" , MediaPlayback::PlaybackStateEnum::kBuffering }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const MediaInput::Structs::InputInfo::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, MediaInput::InputTypeEnum> + table = { + { "Internal" , MediaInput::InputTypeEnum::kInternal }, + { "Aux" , MediaInput::InputTypeEnum::kAux }, + { "Coax" , MediaInput::InputTypeEnum::kCoax }, + { "Composite" , MediaInput::InputTypeEnum::kComposite }, + { "Hdmi" , MediaInput::InputTypeEnum::kHdmi }, + { "Input" , MediaInput::InputTypeEnum::kInput }, + { "Line" , MediaInput::InputTypeEnum::kLine }, + { "Optical" , MediaInput::InputTypeEnum::kOptical }, + { "Video" , MediaInput::InputTypeEnum::kVideo }, + { "Scart" , MediaInput::InputTypeEnum::kScart }, + { "Usb" , MediaInput::InputTypeEnum::kUsb }, + { "Other" , MediaInput::InputTypeEnum::kOther }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, KeypadInput::CecKeyCode> + table = { + { "Select" , KeypadInput::CecKeyCode::kSelect }, + { "Up" , KeypadInput::CecKeyCode::kUp }, + { "Down" , KeypadInput::CecKeyCode::kDown }, + { "Left" , KeypadInput::CecKeyCode::kLeft }, + { "Right" , KeypadInput::CecKeyCode::kRight }, + { "RightUp" , KeypadInput::CecKeyCode::kRightUp }, + { "RightDown" , KeypadInput::CecKeyCode::kRightDown }, + { "LeftUp" , KeypadInput::CecKeyCode::kLeftUp }, + { "LeftDown" , KeypadInput::CecKeyCode::kLeftDown }, + { "RootMenu" , KeypadInput::CecKeyCode::kRootMenu }, + { "SetupMenu" , KeypadInput::CecKeyCode::kSetupMenu }, + { "ContentsMenu" , KeypadInput::CecKeyCode::kContentsMenu }, + { "FavoriteMenu" , KeypadInput::CecKeyCode::kFavoriteMenu }, + { "Exit" , KeypadInput::CecKeyCode::kExit }, + { "MediaTopMenu" , KeypadInput::CecKeyCode::kMediaTopMenu }, + { "MediaContextSensitiveMenu" , KeypadInput::CecKeyCode::kMediaContextSensitiveMenu }, + { "NumberEntryMode" , KeypadInput::CecKeyCode::kNumberEntryMode }, + { "Number11" , KeypadInput::CecKeyCode::kNumber11 }, + { "Number12" , KeypadInput::CecKeyCode::kNumber12 }, + { "Number0OrNumber10" , KeypadInput::CecKeyCode::kNumber0OrNumber10 }, + { "Numbers1" , KeypadInput::CecKeyCode::kNumbers1 }, + { "Numbers2" , KeypadInput::CecKeyCode::kNumbers2 }, + { "Numbers3" , KeypadInput::CecKeyCode::kNumbers3 }, + { "Numbers4" , KeypadInput::CecKeyCode::kNumbers4 }, + { "Numbers5" , KeypadInput::CecKeyCode::kNumbers5 }, + { "Numbers6" , KeypadInput::CecKeyCode::kNumbers6 }, + { "Numbers7" , KeypadInput::CecKeyCode::kNumbers7 }, + { "Numbers8" , KeypadInput::CecKeyCode::kNumbers8 }, + { "Numbers9" , KeypadInput::CecKeyCode::kNumbers9 }, + { "Dot" , KeypadInput::CecKeyCode::kDot }, + { "Enter" , KeypadInput::CecKeyCode::kEnter }, + { "Clear" , KeypadInput::CecKeyCode::kClear }, + { "NextFavorite" , KeypadInput::CecKeyCode::kNextFavorite }, + { "ChannelUp" , KeypadInput::CecKeyCode::kChannelUp }, + { "ChannelDown" , KeypadInput::CecKeyCode::kChannelDown }, + { "PreviousChannel" , KeypadInput::CecKeyCode::kPreviousChannel }, + { "SoundSelect" , KeypadInput::CecKeyCode::kSoundSelect }, + { "InputSelect" , KeypadInput::CecKeyCode::kInputSelect }, + { "DisplayInformation" , KeypadInput::CecKeyCode::kDisplayInformation }, + { "Help" , KeypadInput::CecKeyCode::kHelp }, + { "PageUp" , KeypadInput::CecKeyCode::kPageUp }, + { "PageDown" , KeypadInput::CecKeyCode::kPageDown }, + { "Power" , KeypadInput::CecKeyCode::kPower }, + { "VolumeUp" , KeypadInput::CecKeyCode::kVolumeUp }, + { "VolumeDown" , KeypadInput::CecKeyCode::kVolumeDown }, + { "Mute" , KeypadInput::CecKeyCode::kMute }, + { "Play" , KeypadInput::CecKeyCode::kPlay }, + { "Stop" , KeypadInput::CecKeyCode::kStop }, + { "Pause" , KeypadInput::CecKeyCode::kPause }, + { "Record" , KeypadInput::CecKeyCode::kRecord }, + { "Rewind" , KeypadInput::CecKeyCode::kRewind }, + { "FastForward" , KeypadInput::CecKeyCode::kFastForward }, + { "Eject" , KeypadInput::CecKeyCode::kEject }, + { "Forward" , KeypadInput::CecKeyCode::kForward }, + { "Backward" , KeypadInput::CecKeyCode::kBackward }, + { "StopRecord" , KeypadInput::CecKeyCode::kStopRecord }, + { "PauseRecord" , KeypadInput::CecKeyCode::kPauseRecord }, + { "Reserved" , KeypadInput::CecKeyCode::kReserved }, + { "Angle" , KeypadInput::CecKeyCode::kAngle }, + { "SubPicture" , KeypadInput::CecKeyCode::kSubPicture }, + { "VideoOnDemand" , KeypadInput::CecKeyCode::kVideoOnDemand }, + { "ElectronicProgramGuide" , KeypadInput::CecKeyCode::kElectronicProgramGuide }, + { "TimerProgramming" , KeypadInput::CecKeyCode::kTimerProgramming }, + { "InitialConfiguration" , KeypadInput::CecKeyCode::kInitialConfiguration }, + { "SelectBroadcastType" , KeypadInput::CecKeyCode::kSelectBroadcastType }, + { "SelectSoundPresentation" , KeypadInput::CecKeyCode::kSelectSoundPresentation }, + { "PlayFunction" , KeypadInput::CecKeyCode::kPlayFunction }, + { "PausePlayFunction" , KeypadInput::CecKeyCode::kPausePlayFunction }, + { "RecordFunction" , KeypadInput::CecKeyCode::kRecordFunction }, + { "PauseRecordFunction" , KeypadInput::CecKeyCode::kPauseRecordFunction }, + { "StopFunction" , KeypadInput::CecKeyCode::kStopFunction }, + { "MuteFunction" , KeypadInput::CecKeyCode::kMuteFunction }, + { "RestoreVolumeFunction" , KeypadInput::CecKeyCode::kRestoreVolumeFunction }, + { "TuneFunction" , KeypadInput::CecKeyCode::kTuneFunction }, + { "SelectMediaFunction" , KeypadInput::CecKeyCode::kSelectMediaFunction }, + { "SelectAvInputFunction" , KeypadInput::CecKeyCode::kSelectAvInputFunction }, + { "SelectAudioInputFunction" , KeypadInput::CecKeyCode::kSelectAudioInputFunction }, + { "PowerToggleFunction" , KeypadInput::CecKeyCode::kPowerToggleFunction }, + { "PowerOffFunction" , KeypadInput::CecKeyCode::kPowerOffFunction }, + { "PowerOnFunction" , KeypadInput::CecKeyCode::kPowerOnFunction }, + { "F1Blue" , KeypadInput::CecKeyCode::kF1Blue }, + { "F2Red" , KeypadInput::CecKeyCode::kF2Red }, + { "F3Green" , KeypadInput::CecKeyCode::kF3Green }, + { "F4Yellow" , KeypadInput::CecKeyCode::kF4Yellow }, + { "F5" , KeypadInput::CecKeyCode::kF5 }, + { "Data" , KeypadInput::CecKeyCode::kData }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, KeypadInput::KeypadInputStatusEnum> + table = { + { "Success" , KeypadInput::KeypadInputStatusEnum::kSuccess }, + { "UnsupportedKey" , KeypadInput::KeypadInputStatusEnum::kUnsupportedKey }, + { "InvalidKeyInCurrentState" , KeypadInput::KeypadInputStatusEnum::kInvalidKeyInCurrentState }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const ContentLauncher::Structs::Dimension::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const ContentLauncher::Structs::AdditionalInfo::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const ContentLauncher::Structs::Parameter::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const ContentLauncher::Structs::ContentSearch::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const ContentLauncher::Structs::StyleInformation::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const ContentLauncher::Structs::BrandingInformation::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ContentLauncher::ContentLaunchStatusEnum> + table = { + { "Success" , ContentLauncher::ContentLaunchStatusEnum::kSuccess }, + { "UrlNotAvailable" , ContentLauncher::ContentLaunchStatusEnum::kUrlNotAvailable }, + { "AuthFailed" , ContentLauncher::ContentLaunchStatusEnum::kAuthFailed }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ContentLauncher::MetricTypeEnum> + table = { + { "Pixels" , ContentLauncher::MetricTypeEnum::kPixels }, + { "Percentage" , ContentLauncher::MetricTypeEnum::kPercentage }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ContentLauncher::ParameterEnum> + table = { + { "Actor" , ContentLauncher::ParameterEnum::kActor }, + { "Channel" , ContentLauncher::ParameterEnum::kChannel }, + { "Character" , ContentLauncher::ParameterEnum::kCharacter }, + { "Director" , ContentLauncher::ParameterEnum::kDirector }, + { "Event" , ContentLauncher::ParameterEnum::kEvent }, + { "Franchise" , ContentLauncher::ParameterEnum::kFranchise }, + { "Genre" , ContentLauncher::ParameterEnum::kGenre }, + { "League" , ContentLauncher::ParameterEnum::kLeague }, + { "Popularity" , ContentLauncher::ParameterEnum::kPopularity }, + { "Provider" , ContentLauncher::ParameterEnum::kProvider }, + { "Sport" , ContentLauncher::ParameterEnum::kSport }, + { "SportsTeam" , ContentLauncher::ParameterEnum::kSportsTeam }, + { "Type" , ContentLauncher::ParameterEnum::kType }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const AudioOutput::Structs::OutputInfo::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, AudioOutput::OutputTypeEnum> + table = { + { "Hdmi" , AudioOutput::OutputTypeEnum::kHdmi }, + { "Bt" , AudioOutput::OutputTypeEnum::kBt }, + { "Optical" , AudioOutput::OutputTypeEnum::kOptical }, + { "Headphone" , AudioOutput::OutputTypeEnum::kHeadphone }, + { "Internal" , AudioOutput::OutputTypeEnum::kInternal }, + { "Other" , AudioOutput::OutputTypeEnum::kOther }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const ApplicationLauncher::Structs::Application::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const ApplicationLauncher::Structs::ApplicationEP::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ApplicationLauncher::ApplicationLauncherStatusEnum> + table = { + { "Success" , ApplicationLauncher::ApplicationLauncherStatusEnum::kSuccess }, + { "AppNotAvailable" , ApplicationLauncher::ApplicationLauncherStatusEnum::kAppNotAvailable }, + { "SystemBusy" , ApplicationLauncher::ApplicationLauncherStatusEnum::kSystemBusy }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const ApplicationBasic::Structs::ApplicationBasicApplication::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, ApplicationBasic::ApplicationStatusEnum> + table = { + { "Stopped" , ApplicationBasic::ApplicationStatusEnum::kStopped }, + { "ActiveVisibleFocus" , ApplicationBasic::ApplicationStatusEnum::kActiveVisibleFocus }, + { "ActiveHidden" , ApplicationBasic::ApplicationStatusEnum::kActiveHidden }, + { "ActiveVisibleNotFocus" , ApplicationBasic::ApplicationStatusEnum::kActiveVisibleNotFocus }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +/***************************** Struct Convertes **************/ +// + + + +// +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +//template<> inline nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} + + +/***************************** Struct Convertes **************/ +// +//template<> inline nlohmann::json to_json(const TestCluster::Structs::SimpleStruct::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const TestCluster::Structs::TestFabricScoped::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const TestCluster::Structs::NullablesAndOptionalsStruct::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const TestCluster::Structs::NestedStruct::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const TestCluster::Structs::NestedStructList::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const TestCluster::Structs::DoubleNestedStructList::Type& value) { +// return "no struct support"; +//} +// +// +//template<> inline nlohmann::json to_json(const TestCluster::Structs::TestListStructOctet::Type& value) { +// return "no struct support"; +//} +// +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, TestCluster::SimpleEnum> + table = { + { "Unspecified" , TestCluster::SimpleEnum::kUnspecified }, + { "ValueA" , TestCluster::SimpleEnum::kValueA }, + { "ValueB" , TestCluster::SimpleEnum::kValueB }, + { "ValueC" , TestCluster::SimpleEnum::kValueC }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + + +// +/***************************** Struct Convertes **************/ +// + + +template<> inline std::optional from_json(const nlohmann::json& value) { + const std::map< std::string, FaultInjection::FaultType> + table = { + { "Unspecified" , FaultInjection::FaultType::kUnspecified }, + { "SystemFault" , FaultInjection::FaultType::kSystemFault }, + { "InetFault" , FaultInjection::FaultType::kInetFault }, + { "ChipFault" , FaultInjection::FaultType::kChipFault }, + { "CertFault" , FaultInjection::FaultType::kCertFault }, + }; + + auto i = table.find( value ); + if( i != table.end() ) { + return i->second; + } else { + return std::nullopt; + } +} + + diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/chip_types_to_json.hpp b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/chip_types_to_json.hpp new file mode 100644 index 00000000000000..0e2ba97d29ccff --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/chip_types_to_json.hpp @@ -0,0 +1,2332 @@ +/******************************************************************************* + * # 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. + * + ******************************************************************************/ + + +// Default translation +#include + +template +nlohmann::json inline to_json(const T & value) +{ + return __FUNCTION__; +} + +/***************************** Simple types Convertes **************/ + +template<> +nlohmann::json inline to_json(const bool & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const int & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const int16_t & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const std::string & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const uint8_t & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const uint16_t & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const uint32_t & value) +{ + return value; +} +template<> +nlohmann::json inline to_json(const uint64_t & value) +{ + return value; +} + +/***************************** Bitmap Convertes **************/ + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Identify::IdentifyEffectIdentifier& value) { + switch( value ) { + case chip::app::Clusters::Identify::IdentifyEffectIdentifier::kBlink: return "Blink"; + case chip::app::Clusters::Identify::IdentifyEffectIdentifier::kBreathe: return "Breathe"; + case chip::app::Clusters::Identify::IdentifyEffectIdentifier::kOkay: return "Okay"; + case chip::app::Clusters::Identify::IdentifyEffectIdentifier::kChannelChange: return "ChannelChange"; + case chip::app::Clusters::Identify::IdentifyEffectIdentifier::kFinishEffect: return "FinishEffect"; + case chip::app::Clusters::Identify::IdentifyEffectIdentifier::kStopEffect: return "StopEffect"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Identify::IdentifyEffectVariant& value) { + switch( value ) { + case chip::app::Clusters::Identify::IdentifyEffectVariant::kDefault: return "Default"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Identify::IdentifyIdentifyType& value) { + switch( value ) { + case chip::app::Clusters::Identify::IdentifyIdentifyType::kNone: return "None"; + case chip::app::Clusters::Identify::IdentifyIdentifyType::kVisibleLight: return "VisibleLight"; + case chip::app::Clusters::Identify::IdentifyIdentifyType::kVisibleLED: return "VisibleLED"; + case chip::app::Clusters::Identify::IdentifyIdentifyType::kAudibleBeep: return "AudibleBeep"; + case chip::app::Clusters::Identify::IdentifyIdentifyType::kDisplay: return "Display"; + case chip::app::Clusters::Identify::IdentifyIdentifyType::kActuator: return "Actuator"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const Scenes::Structs::AttributeValuePair::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const Scenes::Structs::ExtensionFieldSet::Type& value) { +// return "no struct support"; +//} +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::OnOff::OnOffDelayedAllOffEffectVariant& value) { + switch( value ) { + case chip::app::Clusters::OnOff::OnOffDelayedAllOffEffectVariant::kFadeToOffIn0p8Seconds: return "FadeToOffIn0p8Seconds"; + case chip::app::Clusters::OnOff::OnOffDelayedAllOffEffectVariant::kNoFade: return "NoFade"; + case chip::app::Clusters::OnOff::OnOffDelayedAllOffEffectVariant::k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds: return "50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::OnOff::OnOffDyingLightEffectVariant& value) { + switch( value ) { + case chip::app::Clusters::OnOff::OnOffDyingLightEffectVariant::k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second: return "20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::OnOff::OnOffEffectIdentifier& value) { + switch( value ) { + case chip::app::Clusters::OnOff::OnOffEffectIdentifier::kDelayedAllOff: return "DelayedAllOff"; + case chip::app::Clusters::OnOff::OnOffEffectIdentifier::kDyingLight: return "DyingLight"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::OnOff::OnOffStartUpOnOff& value) { + switch( value ) { + case chip::app::Clusters::OnOff::OnOffStartUpOnOff::kOff: return "Off"; + case chip::app::Clusters::OnOff::OnOffStartUpOnOff::kOn: return "On"; + case chip::app::Clusters::OnOff::OnOffStartUpOnOff::kTogglePreviousOnOff: return "TogglePreviousOnOff"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::LevelControl::MoveMode& value) { + switch( value ) { + case chip::app::Clusters::LevelControl::MoveMode::kUp: return "Up"; + case chip::app::Clusters::LevelControl::MoveMode::kDown: return "Down"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::LevelControl::StepMode& value) { + switch( value ) { + case chip::app::Clusters::LevelControl::StepMode::kUp: return "Up"; + case chip::app::Clusters::LevelControl::StepMode::kDown: return "Down"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const Descriptor::Structs::DeviceTypeStruct::Type& value) { +// return "no struct support"; +//} +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const Binding::Structs::TargetStruct::Type& value) { +// return "no struct support"; +//} +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const AccessControl::Structs::Target::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const AccessControl::Structs::AccessControlEntry::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const AccessControl::Structs::ExtensionEntry::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::AccessControl::AuthMode& value) { + switch( value ) { + case chip::app::Clusters::AccessControl::AuthMode::kPase: return "Pase"; + case chip::app::Clusters::AccessControl::AuthMode::kCase: return "Case"; + case chip::app::Clusters::AccessControl::AuthMode::kGroup: return "Group"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::AccessControl::ChangeTypeEnum& value) { + switch( value ) { + case chip::app::Clusters::AccessControl::ChangeTypeEnum::kChanged: return "Changed"; + case chip::app::Clusters::AccessControl::ChangeTypeEnum::kAdded: return "Added"; + case chip::app::Clusters::AccessControl::ChangeTypeEnum::kRemoved: return "Removed"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::AccessControl::Privilege& value) { + switch( value ) { + case chip::app::Clusters::AccessControl::Privilege::kView: return "View"; + case chip::app::Clusters::AccessControl::Privilege::kProxyView: return "ProxyView"; + case chip::app::Clusters::AccessControl::Privilege::kOperate: return "Operate"; + case chip::app::Clusters::AccessControl::Privilege::kManage: return "Manage"; + case chip::app::Clusters::AccessControl::Privilege::kAdminister: return "Administer"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const Actions::Structs::ActionStruct::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const Actions::Structs::EndpointListStruct::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Actions::ActionErrorEnum& value) { + switch( value ) { + case chip::app::Clusters::Actions::ActionErrorEnum::kUnknown: return "Unknown"; + case chip::app::Clusters::Actions::ActionErrorEnum::kInterrupted: return "Interrupted"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Actions::ActionStateEnum& value) { + switch( value ) { + case chip::app::Clusters::Actions::ActionStateEnum::kInactive: return "Inactive"; + case chip::app::Clusters::Actions::ActionStateEnum::kActive: return "Active"; + case chip::app::Clusters::Actions::ActionStateEnum::kPaused: return "Paused"; + case chip::app::Clusters::Actions::ActionStateEnum::kDisabled: return "Disabled"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Actions::ActionTypeEnum& value) { + switch( value ) { + case chip::app::Clusters::Actions::ActionTypeEnum::kOther: return "Other"; + case chip::app::Clusters::Actions::ActionTypeEnum::kScene: return "Scene"; + case chip::app::Clusters::Actions::ActionTypeEnum::kSequence: return "Sequence"; + case chip::app::Clusters::Actions::ActionTypeEnum::kAutomation: return "Automation"; + case chip::app::Clusters::Actions::ActionTypeEnum::kException: return "Exception"; + case chip::app::Clusters::Actions::ActionTypeEnum::kNotification: return "Notification"; + case chip::app::Clusters::Actions::ActionTypeEnum::kAlarm: return "Alarm"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Actions::EndpointListTypeEnum& value) { + switch( value ) { + case chip::app::Clusters::Actions::EndpointListTypeEnum::kOther: return "Other"; + case chip::app::Clusters::Actions::EndpointListTypeEnum::kRoom: return "Room"; + case chip::app::Clusters::Actions::EndpointListTypeEnum::kZone: return "Zone"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const Basic::Structs::CapabilityMinimaStruct::Type& value) { +// return "no struct support"; +//} +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::OtaSoftwareUpdateProvider::OTAApplyUpdateAction& value) { + switch( value ) { + case chip::app::Clusters::OtaSoftwareUpdateProvider::OTAApplyUpdateAction::kProceed: return "Proceed"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::OTAApplyUpdateAction::kAwaitNextAction: return "AwaitNextAction"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::OTAApplyUpdateAction::kDiscontinue: return "Discontinue"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::OtaSoftwareUpdateProvider::OTADownloadProtocol& value) { + switch( value ) { + case chip::app::Clusters::OtaSoftwareUpdateProvider::OTADownloadProtocol::kBDXSynchronous: return "BDXSynchronous"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::OTADownloadProtocol::kBDXAsynchronous: return "BDXAsynchronous"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::OTADownloadProtocol::kHttps: return "Https"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::OTADownloadProtocol::kVendorSpecific: return "VendorSpecific"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::OtaSoftwareUpdateProvider::OTAQueryStatus& value) { + switch( value ) { + case chip::app::Clusters::OtaSoftwareUpdateProvider::OTAQueryStatus::kUpdateAvailable: return "UpdateAvailable"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::OTAQueryStatus::kBusy: return "Busy"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::OTAQueryStatus::kNotAvailable: return "NotAvailable"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::OTAQueryStatus::kDownloadProtocolNotSupported: return "DownloadProtocolNotSupported"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const OtaSoftwareUpdateRequestor::Structs::ProviderLocation::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason& value) { + switch( value ) { + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason::kSimpleAnnouncement: return "SimpleAnnouncement"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason::kUpdateAvailable: return "UpdateAvailable"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason::kUrgentUpdateAvailable: return "UrgentUpdateAvailable"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAChangeReasonEnum& value) { + switch( value ) { + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAChangeReasonEnum::kUnknown: return "Unknown"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAChangeReasonEnum::kSuccess: return "Success"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAChangeReasonEnum::kFailure: return "Failure"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAChangeReasonEnum::kTimeOut: return "TimeOut"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAChangeReasonEnum::kDelayByProvider: return "DelayByProvider"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum& value) { + switch( value ) { + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kUnknown: return "Unknown"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kIdle: return "Idle"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kQuerying: return "Querying"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kDelayedOnQuery: return "DelayedOnQuery"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kDownloading: return "Downloading"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kApplying: return "Applying"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kDelayedOnApply: return "DelayedOnApply"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kRollingBack: return "RollingBack"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kDelayedOnUserConsent: return "DelayedOnUserConsent"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::TimeFormatLocalization::CalendarType& value) { + switch( value ) { + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kBuddhist: return "Buddhist"; + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kChinese: return "Chinese"; + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kCoptic: return "Coptic"; + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kEthiopian: return "Ethiopian"; + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kGregorian: return "Gregorian"; + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kHebrew: return "Hebrew"; + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kIndian: return "Indian"; + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kIslamic: return "Islamic"; + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kJapanese: return "Japanese"; + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kKorean: return "Korean"; + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kPersian: return "Persian"; + case chip::app::Clusters::TimeFormatLocalization::CalendarType::kTaiwanese: return "Taiwanese"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::TimeFormatLocalization::HourFormat& value) { + switch( value ) { + case chip::app::Clusters::TimeFormatLocalization::HourFormat::k12hr: return "12hr"; + case chip::app::Clusters::TimeFormatLocalization::HourFormat::k24hr: return "24hr"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::UnitLocalization::TempUnit& value) { + switch( value ) { + case chip::app::Clusters::UnitLocalization::TempUnit::kFahrenheit: return "Fahrenheit"; + case chip::app::Clusters::UnitLocalization::TempUnit::kCelsius: return "Celsius"; + case chip::app::Clusters::UnitLocalization::TempUnit::kKelvin: return "Kelvin"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const PowerSource::Structs::BatChargeFaultChangeType::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const PowerSource::Structs::BatFaultChangeType::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const PowerSource::Structs::WiredFaultChangeType::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::PowerSource::BatChargeFault& value) { + switch( value ) { + case chip::app::Clusters::PowerSource::BatChargeFault::kUnspecfied: return "Unspecfied"; + case chip::app::Clusters::PowerSource::BatChargeFault::kAmbientTooHot: return "AmbientTooHot"; + case chip::app::Clusters::PowerSource::BatChargeFault::kAmbientTooCold: return "AmbientTooCold"; + case chip::app::Clusters::PowerSource::BatChargeFault::kBatteryTooHot: return "BatteryTooHot"; + case chip::app::Clusters::PowerSource::BatChargeFault::kBatteryTooCold: return "BatteryTooCold"; + case chip::app::Clusters::PowerSource::BatChargeFault::kBatteryAbsent: return "BatteryAbsent"; + case chip::app::Clusters::PowerSource::BatChargeFault::kBatteryOverVoltage: return "BatteryOverVoltage"; + case chip::app::Clusters::PowerSource::BatChargeFault::kBatteryUnderVoltage: return "BatteryUnderVoltage"; + case chip::app::Clusters::PowerSource::BatChargeFault::kChargerOverVoltage: return "ChargerOverVoltage"; + case chip::app::Clusters::PowerSource::BatChargeFault::kChargerUnderVoltage: return "ChargerUnderVoltage"; + case chip::app::Clusters::PowerSource::BatChargeFault::kSafetyTimeout: return "SafetyTimeout"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::PowerSource::BatChargeLevel& value) { + switch( value ) { + case chip::app::Clusters::PowerSource::BatChargeLevel::kOk: return "Ok"; + case chip::app::Clusters::PowerSource::BatChargeLevel::kWarning: return "Warning"; + case chip::app::Clusters::PowerSource::BatChargeLevel::kCritical: return "Critical"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::PowerSource::BatChargeState& value) { + switch( value ) { + case chip::app::Clusters::PowerSource::BatChargeState::kUnknown: return "Unknown"; + case chip::app::Clusters::PowerSource::BatChargeState::kIsCharging: return "IsCharging"; + case chip::app::Clusters::PowerSource::BatChargeState::kIsAtFullCharge: return "IsAtFullCharge"; + case chip::app::Clusters::PowerSource::BatChargeState::kIsNotCharging: return "IsNotCharging"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::PowerSource::BatFault& value) { + switch( value ) { + case chip::app::Clusters::PowerSource::BatFault::kUnspecfied: return "Unspecfied"; + case chip::app::Clusters::PowerSource::BatFault::kOverTemp: return "OverTemp"; + case chip::app::Clusters::PowerSource::BatFault::kUnderTemp: return "UnderTemp"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::PowerSource::BatReplaceability& value) { + switch( value ) { + case chip::app::Clusters::PowerSource::BatReplaceability::kUnspecified: return "Unspecified"; + case chip::app::Clusters::PowerSource::BatReplaceability::kNotReplaceable: return "NotReplaceable"; + case chip::app::Clusters::PowerSource::BatReplaceability::kUserReplaceable: return "UserReplaceable"; + case chip::app::Clusters::PowerSource::BatReplaceability::kFactoryReplaceable: return "FactoryReplaceable"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::PowerSource::PowerSourceStatus& value) { + switch( value ) { + case chip::app::Clusters::PowerSource::PowerSourceStatus::kUnspecfied: return "Unspecfied"; + case chip::app::Clusters::PowerSource::PowerSourceStatus::kActive: return "Active"; + case chip::app::Clusters::PowerSource::PowerSourceStatus::kStandby: return "Standby"; + case chip::app::Clusters::PowerSource::PowerSourceStatus::kUnavailable: return "Unavailable"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::PowerSource::WiredCurrentType& value) { + switch( value ) { + case chip::app::Clusters::PowerSource::WiredCurrentType::kAc: return "Ac"; + case chip::app::Clusters::PowerSource::WiredCurrentType::kDc: return "Dc"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::PowerSource::WiredFault& value) { + switch( value ) { + case chip::app::Clusters::PowerSource::WiredFault::kUnspecfied: return "Unspecfied"; + case chip::app::Clusters::PowerSource::WiredFault::kOverVoltage: return "OverVoltage"; + case chip::app::Clusters::PowerSource::WiredFault::kUnderVoltage: return "UnderVoltage"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const GeneralCommissioning::Structs::BasicCommissioningInfo::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::GeneralCommissioning::CommissioningError& value) { + switch( value ) { + case chip::app::Clusters::GeneralCommissioning::CommissioningError::kOk: return "Ok"; + case chip::app::Clusters::GeneralCommissioning::CommissioningError::kValueOutsideRange: return "ValueOutsideRange"; + case chip::app::Clusters::GeneralCommissioning::CommissioningError::kInvalidAuthentication: return "InvalidAuthentication"; + case chip::app::Clusters::GeneralCommissioning::CommissioningError::kNoFailSafe: return "NoFailSafe"; + case chip::app::Clusters::GeneralCommissioning::CommissioningError::kBusyWithOtherAdmin: return "BusyWithOtherAdmin"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType& value) { + switch( value ) { + case chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor: return "Indoor"; + case chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kOutdoor: return "Outdoor"; + case chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoorOutdoor: return "IndoorOutdoor"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DiagnosticLogs::LogsIntent& value) { + switch( value ) { + case chip::app::Clusters::DiagnosticLogs::LogsIntent::kEndUserSupport: return "EndUserSupport"; + case chip::app::Clusters::DiagnosticLogs::LogsIntent::kNetworkDiag: return "NetworkDiag"; + case chip::app::Clusters::DiagnosticLogs::LogsIntent::kCrashLogs: return "CrashLogs"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DiagnosticLogs::LogsStatus& value) { + switch( value ) { + case chip::app::Clusters::DiagnosticLogs::LogsStatus::kSuccess: return "Success"; + case chip::app::Clusters::DiagnosticLogs::LogsStatus::kExhausted: return "Exhausted"; + case chip::app::Clusters::DiagnosticLogs::LogsStatus::kNoLogs: return "NoLogs"; + case chip::app::Clusters::DiagnosticLogs::LogsStatus::kBusy: return "Busy"; + case chip::app::Clusters::DiagnosticLogs::LogsStatus::kDenied: return "Denied"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DiagnosticLogs::LogsTransferProtocol& value) { + switch( value ) { + case chip::app::Clusters::DiagnosticLogs::LogsTransferProtocol::kResponsePayload: return "ResponsePayload"; + case chip::app::Clusters::DiagnosticLogs::LogsTransferProtocol::kBdx: return "Bdx"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const GeneralDiagnostics::Structs::NetworkInterfaceType::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::GeneralDiagnostics::BootReasonType& value) { + switch( value ) { + case chip::app::Clusters::GeneralDiagnostics::BootReasonType::kUnspecified: return "Unspecified"; + case chip::app::Clusters::GeneralDiagnostics::BootReasonType::kPowerOnReboot: return "PowerOnReboot"; + case chip::app::Clusters::GeneralDiagnostics::BootReasonType::kBrownOutReset: return "BrownOutReset"; + case chip::app::Clusters::GeneralDiagnostics::BootReasonType::kSoftwareWatchdogReset: return "SoftwareWatchdogReset"; + case chip::app::Clusters::GeneralDiagnostics::BootReasonType::kHardwareWatchdogReset: return "HardwareWatchdogReset"; + case chip::app::Clusters::GeneralDiagnostics::BootReasonType::kSoftwareUpdateCompleted: return "SoftwareUpdateCompleted"; + case chip::app::Clusters::GeneralDiagnostics::BootReasonType::kSoftwareReset: return "SoftwareReset"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::GeneralDiagnostics::HardwareFaultType& value) { + switch( value ) { + case chip::app::Clusters::GeneralDiagnostics::HardwareFaultType::kUnspecified: return "Unspecified"; + case chip::app::Clusters::GeneralDiagnostics::HardwareFaultType::kRadio: return "Radio"; + case chip::app::Clusters::GeneralDiagnostics::HardwareFaultType::kSensor: return "Sensor"; + case chip::app::Clusters::GeneralDiagnostics::HardwareFaultType::kResettableOverTemp: return "ResettableOverTemp"; + case chip::app::Clusters::GeneralDiagnostics::HardwareFaultType::kNonResettableOverTemp: return "NonResettableOverTemp"; + case chip::app::Clusters::GeneralDiagnostics::HardwareFaultType::kPowerSource: return "PowerSource"; + case chip::app::Clusters::GeneralDiagnostics::HardwareFaultType::kVisualDisplayFault: return "VisualDisplayFault"; + case chip::app::Clusters::GeneralDiagnostics::HardwareFaultType::kAudioOutputFault: return "AudioOutputFault"; + case chip::app::Clusters::GeneralDiagnostics::HardwareFaultType::kUserInterfaceFault: return "UserInterfaceFault"; + case chip::app::Clusters::GeneralDiagnostics::HardwareFaultType::kNonVolatileMemoryError: return "NonVolatileMemoryError"; + case chip::app::Clusters::GeneralDiagnostics::HardwareFaultType::kTamperDetected: return "TamperDetected"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::GeneralDiagnostics::InterfaceType& value) { + switch( value ) { + case chip::app::Clusters::GeneralDiagnostics::InterfaceType::kUnspecified: return "Unspecified"; + case chip::app::Clusters::GeneralDiagnostics::InterfaceType::kWiFi: return "WiFi"; + case chip::app::Clusters::GeneralDiagnostics::InterfaceType::kEthernet: return "Ethernet"; + case chip::app::Clusters::GeneralDiagnostics::InterfaceType::kCellular: return "Cellular"; + case chip::app::Clusters::GeneralDiagnostics::InterfaceType::kThread: return "Thread"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::GeneralDiagnostics::NetworkFaultType& value) { + switch( value ) { + case chip::app::Clusters::GeneralDiagnostics::NetworkFaultType::kUnspecified: return "Unspecified"; + case chip::app::Clusters::GeneralDiagnostics::NetworkFaultType::kHardwareFailure: return "HardwareFailure"; + case chip::app::Clusters::GeneralDiagnostics::NetworkFaultType::kNetworkJammed: return "NetworkJammed"; + case chip::app::Clusters::GeneralDiagnostics::NetworkFaultType::kConnectionFailed: return "ConnectionFailed"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::GeneralDiagnostics::RadioFaultType& value) { + switch( value ) { + case chip::app::Clusters::GeneralDiagnostics::RadioFaultType::kUnspecified: return "Unspecified"; + case chip::app::Clusters::GeneralDiagnostics::RadioFaultType::kWiFiFault: return "WiFiFault"; + case chip::app::Clusters::GeneralDiagnostics::RadioFaultType::kCellularFault: return "CellularFault"; + case chip::app::Clusters::GeneralDiagnostics::RadioFaultType::kThreadFault: return "ThreadFault"; + case chip::app::Clusters::GeneralDiagnostics::RadioFaultType::kNFCFault: return "NFCFault"; + case chip::app::Clusters::GeneralDiagnostics::RadioFaultType::kBLEFault: return "BLEFault"; + case chip::app::Clusters::GeneralDiagnostics::RadioFaultType::kEthernetFault: return "EthernetFault"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const SoftwareDiagnostics::Structs::ThreadMetrics::Type& value) { +// return "no struct support"; +//} +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const ThreadNetworkDiagnostics::Structs::NeighborTable::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const ThreadNetworkDiagnostics::Structs::OperationalDatasetComponents::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const ThreadNetworkDiagnostics::Structs::RouteTable::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const ThreadNetworkDiagnostics::Structs::SecurityPolicy::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFault& value) { + switch( value ) { + case chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFault::kUnspecified: return "Unspecified"; + case chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFault::kLinkDown: return "LinkDown"; + case chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFault::kHardwareFailure: return "HardwareFailure"; + case chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFault::kNetworkJammed: return "NetworkJammed"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ThreadNetworkDiagnostics::RoutingRole& value) { + switch( value ) { + case chip::app::Clusters::ThreadNetworkDiagnostics::RoutingRole::kUnspecified: return "Unspecified"; + case chip::app::Clusters::ThreadNetworkDiagnostics::RoutingRole::kUnassigned: return "Unassigned"; + case chip::app::Clusters::ThreadNetworkDiagnostics::RoutingRole::kSleepyEndDevice: return "SleepyEndDevice"; + case chip::app::Clusters::ThreadNetworkDiagnostics::RoutingRole::kEndDevice: return "EndDevice"; + case chip::app::Clusters::ThreadNetworkDiagnostics::RoutingRole::kReed: return "Reed"; + case chip::app::Clusters::ThreadNetworkDiagnostics::RoutingRole::kRouter: return "Router"; + case chip::app::Clusters::ThreadNetworkDiagnostics::RoutingRole::kLeader: return "Leader"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ThreadNetworkDiagnostics::ThreadConnectionStatus& value) { + switch( value ) { + case chip::app::Clusters::ThreadNetworkDiagnostics::ThreadConnectionStatus::kConnected: return "Connected"; + case chip::app::Clusters::ThreadNetworkDiagnostics::ThreadConnectionStatus::kNotConnected: return "NotConnected"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause& value) { + switch( value ) { + case chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kUnknown: return "Unknown"; + case chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kAssociationFailed: return "AssociationFailed"; + case chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kAuthenticationFailed: return "AuthenticationFailed"; + case chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause::kSsidNotFound: return "SsidNotFound"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::WiFiNetworkDiagnostics::SecurityType& value) { + switch( value ) { + case chip::app::Clusters::WiFiNetworkDiagnostics::SecurityType::kUnspecified: return "Unspecified"; + case chip::app::Clusters::WiFiNetworkDiagnostics::SecurityType::kNone: return "None"; + case chip::app::Clusters::WiFiNetworkDiagnostics::SecurityType::kWep: return "Wep"; + case chip::app::Clusters::WiFiNetworkDiagnostics::SecurityType::kWpa: return "Wpa"; + case chip::app::Clusters::WiFiNetworkDiagnostics::SecurityType::kWpa2: return "Wpa2"; + case chip::app::Clusters::WiFiNetworkDiagnostics::SecurityType::kWpa3: return "Wpa3"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus& value) { + switch( value ) { + case chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus::kConnected: return "Connected"; + case chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus::kNotConnected: return "NotConnected"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType& value) { + switch( value ) { + case chip::app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::k80211a: return "80211a"; + case chip::app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::k80211b: return "80211b"; + case chip::app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::k80211g: return "80211g"; + case chip::app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::k80211n: return "80211n"; + case chip::app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::k80211ac: return "80211ac"; + case chip::app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::k80211ax: return "80211ax"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType& value) { + switch( value ) { + case chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType::k10m: return "10m"; + case chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType::k100m: return "100m"; + case chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType::k1000m: return "1000m"; + case chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType::k25g: return "25g"; + case chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType::k5g: return "5g"; + case chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType::k10g: return "10g"; + case chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType::k40g: return "40g"; + case chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType::k100g: return "100g"; + case chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType::k200g: return "200g"; + case chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType::k400g: return "400g"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const TimeSynchronization::Structs::DstOffsetType::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const TimeSynchronization::Structs::TimeZoneType::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::TimeSynchronization::GranularityEnum& value) { + switch( value ) { + case chip::app::Clusters::TimeSynchronization::GranularityEnum::kNoTimeGranularity: return "NoTimeGranularity"; + case chip::app::Clusters::TimeSynchronization::GranularityEnum::kMinutesGranularity: return "MinutesGranularity"; + case chip::app::Clusters::TimeSynchronization::GranularityEnum::kSecondsGranularity: return "SecondsGranularity"; + case chip::app::Clusters::TimeSynchronization::GranularityEnum::kMillisecondsGranularity: return "MillisecondsGranularity"; + case chip::app::Clusters::TimeSynchronization::GranularityEnum::kMicrosecondsGranularity: return "MicrosecondsGranularity"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::TimeSynchronization::TimeSourceEnum& value) { + switch( value ) { + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kNone: return "None"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kUnknown: return "Unknown"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kAdmin: return "Admin"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kNodeTimeCluster: return "NodeTimeCluster"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kNonFabricSntp: return "NonFabricSntp"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kNonFabricNtp: return "NonFabricNtp"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kFabricSntp: return "FabricSntp"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kFabricNtp: return "FabricNtp"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kMixedNtp: return "MixedNtp"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kNonFabricSntpNts: return "NonFabricSntpNts"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kNonFabricNtpNts: return "NonFabricNtpNts"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kFabricSntpNts: return "FabricSntpNts"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kFabricNtpNts: return "FabricNtpNts"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kMixedNtpNts: return "MixedNtpNts"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kCloudSource: return "CloudSource"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kPtp: return "Ptp"; + case chip::app::Clusters::TimeSynchronization::TimeSourceEnum::kGnss: return "Gnss"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus& value) { + switch( value ) { + case chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus::kWindowNotOpen: return "WindowNotOpen"; + case chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus::kEnhancedWindowOpen: return "EnhancedWindowOpen"; + case chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus::kBasicWindowOpen: return "BasicWindowOpen"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::AdministratorCommissioning::StatusCode& value) { + switch( value ) { + case chip::app::Clusters::AdministratorCommissioning::StatusCode::kBusy: return "Busy"; + case chip::app::Clusters::AdministratorCommissioning::StatusCode::kPAKEParameterError: return "PAKEParameterError"; + case chip::app::Clusters::AdministratorCommissioning::StatusCode::kWindowNotOpen: return "WindowNotOpen"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const OperationalCredentials::Structs::FabricDescriptor::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const OperationalCredentials::Structs::NOCStruct::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::OperationalCredentials::OperationalCertStatus& value) { + switch( value ) { + case chip::app::Clusters::OperationalCredentials::OperationalCertStatus::kSuccess: return "Success"; + case chip::app::Clusters::OperationalCredentials::OperationalCertStatus::kInvalidPublicKey: return "InvalidPublicKey"; + case chip::app::Clusters::OperationalCredentials::OperationalCertStatus::kInvalidNodeOpId: return "InvalidNodeOpId"; + case chip::app::Clusters::OperationalCredentials::OperationalCertStatus::kInvalidNOC: return "InvalidNOC"; + case chip::app::Clusters::OperationalCredentials::OperationalCertStatus::kMissingCsr: return "MissingCsr"; + case chip::app::Clusters::OperationalCredentials::OperationalCertStatus::kTableFull: return "TableFull"; + case chip::app::Clusters::OperationalCredentials::OperationalCertStatus::kInvalidAdminSubject: return "InvalidAdminSubject"; + case chip::app::Clusters::OperationalCredentials::OperationalCertStatus::kFabricConflict: return "FabricConflict"; + case chip::app::Clusters::OperationalCredentials::OperationalCertStatus::kLabelConflict: return "LabelConflict"; + case chip::app::Clusters::OperationalCredentials::OperationalCertStatus::kInvalidFabricIndex: return "InvalidFabricIndex"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const GroupKeyManagement::Structs::GroupInfoMapStruct::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const GroupKeyManagement::Structs::GroupKeyMapStruct::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const GroupKeyManagement::Structs::GroupKeySetStruct::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::GroupKeyManagement::GroupKeySecurityPolicy& value) { + switch( value ) { + case chip::app::Clusters::GroupKeyManagement::GroupKeySecurityPolicy::kTrustFirst: return "TrustFirst"; + case chip::app::Clusters::GroupKeyManagement::GroupKeySecurityPolicy::kCacheAndSync: return "CacheAndSync"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const FixedLabel::Structs::LabelStruct::Type& value) { +// return "no struct support"; +//} +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const UserLabel::Structs::LabelStruct::Type& value) { +// return "no struct support"; +//} +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const ModeSelect::Structs::SemanticTag::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const ModeSelect::Structs::ModeOptionStruct::Type& value) { +// return "no struct support"; +//} +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const DoorLock::Structs::DlCredential::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlAlarmCode& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlAlarmCode::kLockJammed: return "LockJammed"; + case chip::app::Clusters::DoorLock::DlAlarmCode::kLockFactoryReset: return "LockFactoryReset"; + case chip::app::Clusters::DoorLock::DlAlarmCode::kLockRadioPowerCycled: return "LockRadioPowerCycled"; + case chip::app::Clusters::DoorLock::DlAlarmCode::kWrongCodeEntryLimit: return "WrongCodeEntryLimit"; + case chip::app::Clusters::DoorLock::DlAlarmCode::kFrontEsceutcheonRemoved: return "FrontEsceutcheonRemoved"; + case chip::app::Clusters::DoorLock::DlAlarmCode::kDoorForcedOpen: return "DoorForcedOpen"; + case chip::app::Clusters::DoorLock::DlAlarmCode::kDoorAjar: return "DoorAjar"; + case chip::app::Clusters::DoorLock::DlAlarmCode::kForcedUser: return "ForcedUser"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlCredentialRule& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlCredentialRule::kSingle: return "Single"; + case chip::app::Clusters::DoorLock::DlCredentialRule::kDouble: return "Double"; + case chip::app::Clusters::DoorLock::DlCredentialRule::kTri: return "Tri"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlCredentialType& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlCredentialType::kProgrammingPIN: return "ProgrammingPIN"; + case chip::app::Clusters::DoorLock::DlCredentialType::kPin: return "Pin"; + case chip::app::Clusters::DoorLock::DlCredentialType::kRfid: return "Rfid"; + case chip::app::Clusters::DoorLock::DlCredentialType::kFingerprint: return "Fingerprint"; + case chip::app::Clusters::DoorLock::DlCredentialType::kFingerVein: return "FingerVein"; + case chip::app::Clusters::DoorLock::DlCredentialType::kFace: return "Face"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlDataOperationType& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlDataOperationType::kAdd: return "Add"; + case chip::app::Clusters::DoorLock::DlDataOperationType::kClear: return "Clear"; + case chip::app::Clusters::DoorLock::DlDataOperationType::kModify: return "Modify"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlDoorState& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlDoorState::kDoorOpen: return "DoorOpen"; + case chip::app::Clusters::DoorLock::DlDoorState::kDoorClosed: return "DoorClosed"; + case chip::app::Clusters::DoorLock::DlDoorState::kDoorJammed: return "DoorJammed"; + case chip::app::Clusters::DoorLock::DlDoorState::kDoorForcedOpen: return "DoorForcedOpen"; + case chip::app::Clusters::DoorLock::DlDoorState::kDoorUnspecifiedError: return "DoorUnspecifiedError"; + case chip::app::Clusters::DoorLock::DlDoorState::kDoorAjar: return "DoorAjar"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlLockDataType& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlLockDataType::kUnspecified: return "Unspecified"; + case chip::app::Clusters::DoorLock::DlLockDataType::kProgrammingCode: return "ProgrammingCode"; + case chip::app::Clusters::DoorLock::DlLockDataType::kUserIndex: return "UserIndex"; + case chip::app::Clusters::DoorLock::DlLockDataType::kWeekDaySchedule: return "WeekDaySchedule"; + case chip::app::Clusters::DoorLock::DlLockDataType::kYearDaySchedule: return "YearDaySchedule"; + case chip::app::Clusters::DoorLock::DlLockDataType::kHolidaySchedule: return "HolidaySchedule"; + case chip::app::Clusters::DoorLock::DlLockDataType::kPin: return "Pin"; + case chip::app::Clusters::DoorLock::DlLockDataType::kRfid: return "Rfid"; + case chip::app::Clusters::DoorLock::DlLockDataType::kFingerprint: return "Fingerprint"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlLockOperationType& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlLockOperationType::kLock: return "Lock"; + case chip::app::Clusters::DoorLock::DlLockOperationType::kUnlock: return "Unlock"; + case chip::app::Clusters::DoorLock::DlLockOperationType::kNonAccessUserEvent: return "NonAccessUserEvent"; + case chip::app::Clusters::DoorLock::DlLockOperationType::kForcedUserEvent: return "ForcedUserEvent"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlLockState& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlLockState::kNotFullyLocked: return "NotFullyLocked"; + case chip::app::Clusters::DoorLock::DlLockState::kLocked: return "Locked"; + case chip::app::Clusters::DoorLock::DlLockState::kUnlocked: return "Unlocked"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlLockType& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlLockType::kDeadBolt: return "DeadBolt"; + case chip::app::Clusters::DoorLock::DlLockType::kMagnetic: return "Magnetic"; + case chip::app::Clusters::DoorLock::DlLockType::kOther: return "Other"; + case chip::app::Clusters::DoorLock::DlLockType::kMortise: return "Mortise"; + case chip::app::Clusters::DoorLock::DlLockType::kRim: return "Rim"; + case chip::app::Clusters::DoorLock::DlLockType::kLatchBolt: return "LatchBolt"; + case chip::app::Clusters::DoorLock::DlLockType::kCylindricalLock: return "CylindricalLock"; + case chip::app::Clusters::DoorLock::DlLockType::kTubularLock: return "TubularLock"; + case chip::app::Clusters::DoorLock::DlLockType::kInterconnectedLock: return "InterconnectedLock"; + case chip::app::Clusters::DoorLock::DlLockType::kDeadLatch: return "DeadLatch"; + case chip::app::Clusters::DoorLock::DlLockType::kDoorFurniture: return "DoorFurniture"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlOperatingMode& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlOperatingMode::kNormal: return "Normal"; + case chip::app::Clusters::DoorLock::DlOperatingMode::kVacation: return "Vacation"; + case chip::app::Clusters::DoorLock::DlOperatingMode::kPrivacy: return "Privacy"; + case chip::app::Clusters::DoorLock::DlOperatingMode::kNoRemoteLockUnlock: return "NoRemoteLockUnlock"; + case chip::app::Clusters::DoorLock::DlOperatingMode::kPassage: return "Passage"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlOperationError& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlOperationError::kUnspecified: return "Unspecified"; + case chip::app::Clusters::DoorLock::DlOperationError::kInvalidCredential: return "InvalidCredential"; + case chip::app::Clusters::DoorLock::DlOperationError::kDisabledUserDenied: return "DisabledUserDenied"; + case chip::app::Clusters::DoorLock::DlOperationError::kRestricted: return "Restricted"; + case chip::app::Clusters::DoorLock::DlOperationError::kInsufficientBattery: return "InsufficientBattery"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlOperationSource& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlOperationSource::kUnspecified: return "Unspecified"; + case chip::app::Clusters::DoorLock::DlOperationSource::kManual: return "Manual"; + case chip::app::Clusters::DoorLock::DlOperationSource::kProprietaryRemote: return "ProprietaryRemote"; + case chip::app::Clusters::DoorLock::DlOperationSource::kKeypad: return "Keypad"; + case chip::app::Clusters::DoorLock::DlOperationSource::kAuto: return "Auto"; + case chip::app::Clusters::DoorLock::DlOperationSource::kButton: return "Button"; + case chip::app::Clusters::DoorLock::DlOperationSource::kSchedule: return "Schedule"; + case chip::app::Clusters::DoorLock::DlOperationSource::kRemote: return "Remote"; + case chip::app::Clusters::DoorLock::DlOperationSource::kRfid: return "Rfid"; + case chip::app::Clusters::DoorLock::DlOperationSource::kBiometric: return "Biometric"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlStatus& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlStatus::kSuccess: return "Success"; + case chip::app::Clusters::DoorLock::DlStatus::kFailure: return "Failure"; + case chip::app::Clusters::DoorLock::DlStatus::kDuplicate: return "Duplicate"; + case chip::app::Clusters::DoorLock::DlStatus::kOccupied: return "Occupied"; + case chip::app::Clusters::DoorLock::DlStatus::kInvalidField: return "InvalidField"; + case chip::app::Clusters::DoorLock::DlStatus::kResourceExhausted: return "ResourceExhausted"; + case chip::app::Clusters::DoorLock::DlStatus::kNotFound: return "NotFound"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlUserStatus& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlUserStatus::kAvailable: return "Available"; + case chip::app::Clusters::DoorLock::DlUserStatus::kOccupiedEnabled: return "OccupiedEnabled"; + case chip::app::Clusters::DoorLock::DlUserStatus::kOccupiedDisabled: return "OccupiedDisabled"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DlUserType& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DlUserType::kUnrestrictedUser: return "UnrestrictedUser"; + case chip::app::Clusters::DoorLock::DlUserType::kYearDayScheduleUser: return "YearDayScheduleUser"; + case chip::app::Clusters::DoorLock::DlUserType::kWeekDayScheduleUser: return "WeekDayScheduleUser"; + case chip::app::Clusters::DoorLock::DlUserType::kProgrammingUser: return "ProgrammingUser"; + case chip::app::Clusters::DoorLock::DlUserType::kNonAccessUser: return "NonAccessUser"; + case chip::app::Clusters::DoorLock::DlUserType::kForcedUser: return "ForcedUser"; + case chip::app::Clusters::DoorLock::DlUserType::kDisposableUser: return "DisposableUser"; + case chip::app::Clusters::DoorLock::DlUserType::kExpiringUser: return "ExpiringUser"; + case chip::app::Clusters::DoorLock::DlUserType::kScheduleRestrictedUser: return "ScheduleRestrictedUser"; + case chip::app::Clusters::DoorLock::DlUserType::kRemoteOnlyUser: return "RemoteOnlyUser"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DoorLockOperationEventCode& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kUnknownOrMfgSpecific: return "UnknownOrMfgSpecific"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kLock: return "Lock"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kUnlock: return "Unlock"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kLockInvalidPinOrId: return "LockInvalidPinOrId"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kLockInvalidSchedule: return "LockInvalidSchedule"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kUnlockInvalidPinOrId: return "UnlockInvalidPinOrId"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kUnlockInvalidSchedule: return "UnlockInvalidSchedule"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kOneTouchLock: return "OneTouchLock"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kKeyLock: return "KeyLock"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kKeyUnlock: return "KeyUnlock"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kAutoLock: return "AutoLock"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kScheduleLock: return "ScheduleLock"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kScheduleUnlock: return "ScheduleUnlock"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kManualLock: return "ManualLock"; + case chip::app::Clusters::DoorLock::DoorLockOperationEventCode::kManualUnlock: return "ManualUnlock"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DoorLockProgrammingEventCode& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DoorLockProgrammingEventCode::kUnknownOrMfgSpecific: return "UnknownOrMfgSpecific"; + case chip::app::Clusters::DoorLock::DoorLockProgrammingEventCode::kMasterCodeChanged: return "MasterCodeChanged"; + case chip::app::Clusters::DoorLock::DoorLockProgrammingEventCode::kPinAdded: return "PinAdded"; + case chip::app::Clusters::DoorLock::DoorLockProgrammingEventCode::kPinDeleted: return "PinDeleted"; + case chip::app::Clusters::DoorLock::DoorLockProgrammingEventCode::kPinChanged: return "PinChanged"; + case chip::app::Clusters::DoorLock::DoorLockProgrammingEventCode::kIdAdded: return "IdAdded"; + case chip::app::Clusters::DoorLock::DoorLockProgrammingEventCode::kIdDeleted: return "IdDeleted"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DoorLockSetPinOrIdStatus& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DoorLockSetPinOrIdStatus::kSuccess: return "Success"; + case chip::app::Clusters::DoorLock::DoorLockSetPinOrIdStatus::kGeneralFailure: return "GeneralFailure"; + case chip::app::Clusters::DoorLock::DoorLockSetPinOrIdStatus::kMemoryFull: return "MemoryFull"; + case chip::app::Clusters::DoorLock::DoorLockSetPinOrIdStatus::kDuplicateCodeError: return "DuplicateCodeError"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DoorLockUserStatus& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DoorLockUserStatus::kAvailable: return "Available"; + case chip::app::Clusters::DoorLock::DoorLockUserStatus::kOccupiedEnabled: return "OccupiedEnabled"; + case chip::app::Clusters::DoorLock::DoorLockUserStatus::kOccupiedDisabled: return "OccupiedDisabled"; + case chip::app::Clusters::DoorLock::DoorLockUserStatus::kNotSupported: return "NotSupported"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::DoorLock::DoorLockUserType& value) { + switch( value ) { + case chip::app::Clusters::DoorLock::DoorLockUserType::kUnrestricted: return "Unrestricted"; + case chip::app::Clusters::DoorLock::DoorLockUserType::kYearDayScheduleUser: return "YearDayScheduleUser"; + case chip::app::Clusters::DoorLock::DoorLockUserType::kWeekDayScheduleUser: return "WeekDayScheduleUser"; + case chip::app::Clusters::DoorLock::DoorLockUserType::kMasterUser: return "MasterUser"; + case chip::app::Clusters::DoorLock::DoorLockUserType::kNonAccessUser: return "NonAccessUser"; + case chip::app::Clusters::DoorLock::DoorLockUserType::kNotSupported: return "NotSupported"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::WindowCovering::EndProductType& value) { + switch( value ) { + case chip::app::Clusters::WindowCovering::EndProductType::kRollerShade: return "RollerShade"; + case chip::app::Clusters::WindowCovering::EndProductType::kRomanShade: return "RomanShade"; + case chip::app::Clusters::WindowCovering::EndProductType::kBalloonShade: return "BalloonShade"; + case chip::app::Clusters::WindowCovering::EndProductType::kWovenWood: return "WovenWood"; + case chip::app::Clusters::WindowCovering::EndProductType::kPleatedShade: return "PleatedShade"; + case chip::app::Clusters::WindowCovering::EndProductType::kCellularShade: return "CellularShade"; + case chip::app::Clusters::WindowCovering::EndProductType::kLayeredShade: return "LayeredShade"; + case chip::app::Clusters::WindowCovering::EndProductType::kLayeredShade2D: return "LayeredShade2D"; + case chip::app::Clusters::WindowCovering::EndProductType::kSheerShade: return "SheerShade"; + case chip::app::Clusters::WindowCovering::EndProductType::kTiltOnlyInteriorBlind: return "TiltOnlyInteriorBlind"; + case chip::app::Clusters::WindowCovering::EndProductType::kInteriorBlind: return "InteriorBlind"; + case chip::app::Clusters::WindowCovering::EndProductType::kVerticalBlindStripCurtain: return "VerticalBlindStripCurtain"; + case chip::app::Clusters::WindowCovering::EndProductType::kInteriorVenetianBlind: return "InteriorVenetianBlind"; + case chip::app::Clusters::WindowCovering::EndProductType::kExteriorVenetianBlind: return "ExteriorVenetianBlind"; + case chip::app::Clusters::WindowCovering::EndProductType::kLateralLeftCurtain: return "LateralLeftCurtain"; + case chip::app::Clusters::WindowCovering::EndProductType::kLateralRightCurtain: return "LateralRightCurtain"; + case chip::app::Clusters::WindowCovering::EndProductType::kCentralCurtain: return "CentralCurtain"; + case chip::app::Clusters::WindowCovering::EndProductType::kRollerShutter: return "RollerShutter"; + case chip::app::Clusters::WindowCovering::EndProductType::kExteriorVerticalScreen: return "ExteriorVerticalScreen"; + case chip::app::Clusters::WindowCovering::EndProductType::kAwningTerracePatio: return "AwningTerracePatio"; + case chip::app::Clusters::WindowCovering::EndProductType::kAwningVerticalScreen: return "AwningVerticalScreen"; + case chip::app::Clusters::WindowCovering::EndProductType::kTiltOnlyPergola: return "TiltOnlyPergola"; + case chip::app::Clusters::WindowCovering::EndProductType::kSwingingShutter: return "SwingingShutter"; + case chip::app::Clusters::WindowCovering::EndProductType::kSlidingShutter: return "SlidingShutter"; + case chip::app::Clusters::WindowCovering::EndProductType::kUnknown: return "Unknown"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::WindowCovering::Type& value) { + switch( value ) { + case chip::app::Clusters::WindowCovering::Type::kRollerShade: return "RollerShade"; + case chip::app::Clusters::WindowCovering::Type::kRollerShade2Motor: return "RollerShade2Motor"; + case chip::app::Clusters::WindowCovering::Type::kRollerShadeExterior: return "RollerShadeExterior"; + case chip::app::Clusters::WindowCovering::Type::kRollerShadeExterior2Motor: return "RollerShadeExterior2Motor"; + case chip::app::Clusters::WindowCovering::Type::kDrapery: return "Drapery"; + case chip::app::Clusters::WindowCovering::Type::kAwning: return "Awning"; + case chip::app::Clusters::WindowCovering::Type::kShutter: return "Shutter"; + case chip::app::Clusters::WindowCovering::Type::kTiltBlindTiltOnly: return "TiltBlindTiltOnly"; + case chip::app::Clusters::WindowCovering::Type::kTiltBlindLiftAndTilt: return "TiltBlindLiftAndTilt"; + case chip::app::Clusters::WindowCovering::Type::kProjectorScreen: return "ProjectorScreen"; + case chip::app::Clusters::WindowCovering::Type::kUnknown: return "Unknown"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode& value) { + switch( value ) { + case chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode::kConstantSpeed: return "ConstantSpeed"; + case chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode::kConstantPressure: return "ConstantPressure"; + case chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode::kProportionalPressure: return "ProportionalPressure"; + case chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode::kConstantFlow: return "ConstantFlow"; + case chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode::kConstantTemperature: return "ConstantTemperature"; + case chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode::kAutomatic: return "Automatic"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode& value) { + switch( value ) { + case chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode::kNormal: return "Normal"; + case chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode::kMinimum: return "Minimum"; + case chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode::kMaximum: return "Maximum"; + case chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode::kLocal: return "Local"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const Thermostat::Structs::ThermostatScheduleTransition::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Thermostat::SetpointAdjustMode& value) { + switch( value ) { + case chip::app::Clusters::Thermostat::SetpointAdjustMode::kHeatSetpoint: return "HeatSetpoint"; + case chip::app::Clusters::Thermostat::SetpointAdjustMode::kCoolSetpoint: return "CoolSetpoint"; + case chip::app::Clusters::Thermostat::SetpointAdjustMode::kHeatAndCoolSetpoints: return "HeatAndCoolSetpoints"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Thermostat::ThermostatControlSequence& value) { + switch( value ) { + case chip::app::Clusters::Thermostat::ThermostatControlSequence::kCoolingOnly: return "CoolingOnly"; + case chip::app::Clusters::Thermostat::ThermostatControlSequence::kCoolingWithReheat: return "CoolingWithReheat"; + case chip::app::Clusters::Thermostat::ThermostatControlSequence::kHeatingOnly: return "HeatingOnly"; + case chip::app::Clusters::Thermostat::ThermostatControlSequence::kHeatingWithReheat: return "HeatingWithReheat"; + case chip::app::Clusters::Thermostat::ThermostatControlSequence::kCoolingAndHeating: return "CoolingAndHeating"; + case chip::app::Clusters::Thermostat::ThermostatControlSequence::kCoolingAndHeatingWithReheat: return "CoolingAndHeatingWithReheat"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Thermostat::ThermostatRunningMode& value) { + switch( value ) { + case chip::app::Clusters::Thermostat::ThermostatRunningMode::kOff: return "Off"; + case chip::app::Clusters::Thermostat::ThermostatRunningMode::kCool: return "Cool"; + case chip::app::Clusters::Thermostat::ThermostatRunningMode::kHeat: return "Heat"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Thermostat::ThermostatSystemMode& value) { + switch( value ) { + case chip::app::Clusters::Thermostat::ThermostatSystemMode::kOff: return "Off"; + case chip::app::Clusters::Thermostat::ThermostatSystemMode::kAuto: return "Auto"; + case chip::app::Clusters::Thermostat::ThermostatSystemMode::kCool: return "Cool"; + case chip::app::Clusters::Thermostat::ThermostatSystemMode::kHeat: return "Heat"; + case chip::app::Clusters::Thermostat::ThermostatSystemMode::kEmergencyHeating: return "EmergencyHeating"; + case chip::app::Clusters::Thermostat::ThermostatSystemMode::kPrecooling: return "Precooling"; + case chip::app::Clusters::Thermostat::ThermostatSystemMode::kFanOnly: return "FanOnly"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::FanControl::FanModeSequenceType& value) { + switch( value ) { + case chip::app::Clusters::FanControl::FanModeSequenceType::kOffLowMedHigh: return "OffLowMedHigh"; + case chip::app::Clusters::FanControl::FanModeSequenceType::kOffLowHigh: return "OffLowHigh"; + case chip::app::Clusters::FanControl::FanModeSequenceType::kOffLowMedHighAuto: return "OffLowMedHighAuto"; + case chip::app::Clusters::FanControl::FanModeSequenceType::kOffLowHighAuto: return "OffLowHighAuto"; + case chip::app::Clusters::FanControl::FanModeSequenceType::kOffOnAuto: return "OffOnAuto"; + case chip::app::Clusters::FanControl::FanModeSequenceType::kOffOn: return "OffOn"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::FanControl::FanModeType& value) { + switch( value ) { + case chip::app::Clusters::FanControl::FanModeType::kOff: return "Off"; + case chip::app::Clusters::FanControl::FanModeType::kLow: return "Low"; + case chip::app::Clusters::FanControl::FanModeType::kMedium: return "Medium"; + case chip::app::Clusters::FanControl::FanModeType::kHigh: return "High"; + case chip::app::Clusters::FanControl::FanModeType::kOn: return "On"; + case chip::app::Clusters::FanControl::FanModeType::kAuto: return "Auto"; + case chip::app::Clusters::FanControl::FanModeType::kSmart: return "Smart"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ColorControl::ColorLoopAction& value) { + switch( value ) { + case chip::app::Clusters::ColorControl::ColorLoopAction::kDeactivate: return "Deactivate"; + case chip::app::Clusters::ColorControl::ColorLoopAction::kActivateFromColorLoopStartEnhancedHue: return "ActivateFromColorLoopStartEnhancedHue"; + case chip::app::Clusters::ColorControl::ColorLoopAction::kActivateFromEnhancedCurrentHue: return "ActivateFromEnhancedCurrentHue"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ColorControl::ColorLoopDirection& value) { + switch( value ) { + case chip::app::Clusters::ColorControl::ColorLoopDirection::kDecrementHue: return "DecrementHue"; + case chip::app::Clusters::ColorControl::ColorLoopDirection::kIncrementHue: return "IncrementHue"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ColorControl::ColorMode& value) { + switch( value ) { + case chip::app::Clusters::ColorControl::ColorMode::kCurrentHueAndCurrentSaturation: return "CurrentHueAndCurrentSaturation"; + case chip::app::Clusters::ColorControl::ColorMode::kCurrentXAndCurrentY: return "CurrentXAndCurrentY"; + case chip::app::Clusters::ColorControl::ColorMode::kColorTemperature: return "ColorTemperature"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ColorControl::HueDirection& value) { + switch( value ) { + case chip::app::Clusters::ColorControl::HueDirection::kShortestDistance: return "ShortestDistance"; + case chip::app::Clusters::ColorControl::HueDirection::kLongestDistance: return "LongestDistance"; + case chip::app::Clusters::ColorControl::HueDirection::kUp: return "Up"; + case chip::app::Clusters::ColorControl::HueDirection::kDown: return "Down"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ColorControl::HueMoveMode& value) { + switch( value ) { + case chip::app::Clusters::ColorControl::HueMoveMode::kStop: return "Stop"; + case chip::app::Clusters::ColorControl::HueMoveMode::kUp: return "Up"; + case chip::app::Clusters::ColorControl::HueMoveMode::kDown: return "Down"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ColorControl::HueStepMode& value) { + switch( value ) { + case chip::app::Clusters::ColorControl::HueStepMode::kUp: return "Up"; + case chip::app::Clusters::ColorControl::HueStepMode::kDown: return "Down"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ColorControl::SaturationMoveMode& value) { + switch( value ) { + case chip::app::Clusters::ColorControl::SaturationMoveMode::kStop: return "Stop"; + case chip::app::Clusters::ColorControl::SaturationMoveMode::kUp: return "Up"; + case chip::app::Clusters::ColorControl::SaturationMoveMode::kDown: return "Down"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ColorControl::SaturationStepMode& value) { + switch( value ) { + case chip::app::Clusters::ColorControl::SaturationStepMode::kUp: return "Up"; + case chip::app::Clusters::ColorControl::SaturationStepMode::kDown: return "Down"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::IlluminanceMeasurement::LightSensorType& value) { + switch( value ) { + case chip::app::Clusters::IlluminanceMeasurement::LightSensorType::kPhotodiode: return "Photodiode"; + case chip::app::Clusters::IlluminanceMeasurement::LightSensorType::kCmos: return "Cmos"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const Channel::Structs::ChannelInfo::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const Channel::Structs::LineupInfo::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Channel::ChannelStatusEnum& value) { + switch( value ) { + case chip::app::Clusters::Channel::ChannelStatusEnum::kSuccess: return "Success"; + case chip::app::Clusters::Channel::ChannelStatusEnum::kMultipleMatches: return "MultipleMatches"; + case chip::app::Clusters::Channel::ChannelStatusEnum::kNoMatches: return "NoMatches"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::Channel::LineupInfoTypeEnum& value) { + switch( value ) { + case chip::app::Clusters::Channel::LineupInfoTypeEnum::kMso: return "Mso"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const TargetNavigator::Structs::TargetInfo::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::TargetNavigator::TargetNavigatorStatusEnum& value) { + switch( value ) { + case chip::app::Clusters::TargetNavigator::TargetNavigatorStatusEnum::kSuccess: return "Success"; + case chip::app::Clusters::TargetNavigator::TargetNavigatorStatusEnum::kTargetNotFound: return "TargetNotFound"; + case chip::app::Clusters::TargetNavigator::TargetNavigatorStatusEnum::kNotAllowed: return "NotAllowed"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const MediaPlayback::Structs::PlaybackPosition::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::MediaPlayback::MediaPlaybackStatusEnum& value) { + switch( value ) { + case chip::app::Clusters::MediaPlayback::MediaPlaybackStatusEnum::kSuccess: return "Success"; + case chip::app::Clusters::MediaPlayback::MediaPlaybackStatusEnum::kInvalidStateForCommand: return "InvalidStateForCommand"; + case chip::app::Clusters::MediaPlayback::MediaPlaybackStatusEnum::kNotAllowed: return "NotAllowed"; + case chip::app::Clusters::MediaPlayback::MediaPlaybackStatusEnum::kNotActive: return "NotActive"; + case chip::app::Clusters::MediaPlayback::MediaPlaybackStatusEnum::kSpeedOutOfRange: return "SpeedOutOfRange"; + case chip::app::Clusters::MediaPlayback::MediaPlaybackStatusEnum::kSeekOutOfRange: return "SeekOutOfRange"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::MediaPlayback::PlaybackStateEnum& value) { + switch( value ) { + case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kPlaying: return "Playing"; + case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kPaused: return "Paused"; + case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kNotPlaying: return "NotPlaying"; + case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kBuffering: return "Buffering"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const MediaInput::Structs::InputInfo::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::MediaInput::InputTypeEnum& value) { + switch( value ) { + case chip::app::Clusters::MediaInput::InputTypeEnum::kInternal: return "Internal"; + case chip::app::Clusters::MediaInput::InputTypeEnum::kAux: return "Aux"; + case chip::app::Clusters::MediaInput::InputTypeEnum::kCoax: return "Coax"; + case chip::app::Clusters::MediaInput::InputTypeEnum::kComposite: return "Composite"; + case chip::app::Clusters::MediaInput::InputTypeEnum::kHdmi: return "Hdmi"; + case chip::app::Clusters::MediaInput::InputTypeEnum::kInput: return "Input"; + case chip::app::Clusters::MediaInput::InputTypeEnum::kLine: return "Line"; + case chip::app::Clusters::MediaInput::InputTypeEnum::kOptical: return "Optical"; + case chip::app::Clusters::MediaInput::InputTypeEnum::kVideo: return "Video"; + case chip::app::Clusters::MediaInput::InputTypeEnum::kScart: return "Scart"; + case chip::app::Clusters::MediaInput::InputTypeEnum::kUsb: return "Usb"; + case chip::app::Clusters::MediaInput::InputTypeEnum::kOther: return "Other"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::KeypadInput::CecKeyCode& value) { + switch( value ) { + case chip::app::Clusters::KeypadInput::CecKeyCode::kSelect: return "Select"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kUp: return "Up"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kDown: return "Down"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kLeft: return "Left"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kRight: return "Right"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kRightUp: return "RightUp"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kRightDown: return "RightDown"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kLeftUp: return "LeftUp"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kLeftDown: return "LeftDown"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kRootMenu: return "RootMenu"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kSetupMenu: return "SetupMenu"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kContentsMenu: return "ContentsMenu"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kFavoriteMenu: return "FavoriteMenu"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kExit: return "Exit"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kMediaTopMenu: return "MediaTopMenu"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kMediaContextSensitiveMenu: return "MediaContextSensitiveMenu"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumberEntryMode: return "NumberEntryMode"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumber11: return "Number11"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumber12: return "Number12"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumber0OrNumber10: return "Number0OrNumber10"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumbers1: return "Numbers1"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumbers2: return "Numbers2"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumbers3: return "Numbers3"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumbers4: return "Numbers4"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumbers5: return "Numbers5"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumbers6: return "Numbers6"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumbers7: return "Numbers7"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumbers8: return "Numbers8"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNumbers9: return "Numbers9"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kDot: return "Dot"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kEnter: return "Enter"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kClear: return "Clear"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kNextFavorite: return "NextFavorite"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kChannelUp: return "ChannelUp"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kChannelDown: return "ChannelDown"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPreviousChannel: return "PreviousChannel"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kSoundSelect: return "SoundSelect"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kInputSelect: return "InputSelect"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kDisplayInformation: return "DisplayInformation"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kHelp: return "Help"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPageUp: return "PageUp"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPageDown: return "PageDown"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPower: return "Power"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kVolumeUp: return "VolumeUp"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kVolumeDown: return "VolumeDown"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kMute: return "Mute"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPlay: return "Play"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kStop: return "Stop"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPause: return "Pause"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kRecord: return "Record"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kRewind: return "Rewind"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kFastForward: return "FastForward"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kEject: return "Eject"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kForward: return "Forward"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kBackward: return "Backward"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kStopRecord: return "StopRecord"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPauseRecord: return "PauseRecord"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kReserved: return "Reserved"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kAngle: return "Angle"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kSubPicture: return "SubPicture"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kVideoOnDemand: return "VideoOnDemand"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kElectronicProgramGuide: return "ElectronicProgramGuide"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kTimerProgramming: return "TimerProgramming"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kInitialConfiguration: return "InitialConfiguration"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kSelectBroadcastType: return "SelectBroadcastType"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kSelectSoundPresentation: return "SelectSoundPresentation"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPlayFunction: return "PlayFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPausePlayFunction: return "PausePlayFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kRecordFunction: return "RecordFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPauseRecordFunction: return "PauseRecordFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kStopFunction: return "StopFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kMuteFunction: return "MuteFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kRestoreVolumeFunction: return "RestoreVolumeFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kTuneFunction: return "TuneFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kSelectMediaFunction: return "SelectMediaFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kSelectAvInputFunction: return "SelectAvInputFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kSelectAudioInputFunction: return "SelectAudioInputFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPowerToggleFunction: return "PowerToggleFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPowerOffFunction: return "PowerOffFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kPowerOnFunction: return "PowerOnFunction"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kF1Blue: return "F1Blue"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kF2Red: return "F2Red"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kF3Green: return "F3Green"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kF4Yellow: return "F4Yellow"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kF5: return "F5"; + case chip::app::Clusters::KeypadInput::CecKeyCode::kData: return "Data"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::KeypadInput::KeypadInputStatusEnum& value) { + switch( value ) { + case chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess: return "Success"; + case chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kUnsupportedKey: return "UnsupportedKey"; + case chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kInvalidKeyInCurrentState: return "InvalidKeyInCurrentState"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const ContentLauncher::Structs::Dimension::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const ContentLauncher::Structs::AdditionalInfo::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const ContentLauncher::Structs::Parameter::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const ContentLauncher::Structs::ContentSearch::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const ContentLauncher::Structs::StyleInformation::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const ContentLauncher::Structs::BrandingInformation::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ContentLauncher::ContentLaunchStatusEnum& value) { + switch( value ) { + case chip::app::Clusters::ContentLauncher::ContentLaunchStatusEnum::kSuccess: return "Success"; + case chip::app::Clusters::ContentLauncher::ContentLaunchStatusEnum::kUrlNotAvailable: return "UrlNotAvailable"; + case chip::app::Clusters::ContentLauncher::ContentLaunchStatusEnum::kAuthFailed: return "AuthFailed"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ContentLauncher::MetricTypeEnum& value) { + switch( value ) { + case chip::app::Clusters::ContentLauncher::MetricTypeEnum::kPixels: return "Pixels"; + case chip::app::Clusters::ContentLauncher::MetricTypeEnum::kPercentage: return "Percentage"; + default: return "{}"; + } +} + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ContentLauncher::ParameterEnum& value) { + switch( value ) { + case chip::app::Clusters::ContentLauncher::ParameterEnum::kActor: return "Actor"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kChannel: return "Channel"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kCharacter: return "Character"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kDirector: return "Director"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kEvent: return "Event"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kFranchise: return "Franchise"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kGenre: return "Genre"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kLeague: return "League"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kPopularity: return "Popularity"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kProvider: return "Provider"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kSport: return "Sport"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kSportsTeam: return "SportsTeam"; + case chip::app::Clusters::ContentLauncher::ParameterEnum::kType: return "Type"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const AudioOutput::Structs::OutputInfo::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::AudioOutput::OutputTypeEnum& value) { + switch( value ) { + case chip::app::Clusters::AudioOutput::OutputTypeEnum::kHdmi: return "Hdmi"; + case chip::app::Clusters::AudioOutput::OutputTypeEnum::kBt: return "Bt"; + case chip::app::Clusters::AudioOutput::OutputTypeEnum::kOptical: return "Optical"; + case chip::app::Clusters::AudioOutput::OutputTypeEnum::kHeadphone: return "Headphone"; + case chip::app::Clusters::AudioOutput::OutputTypeEnum::kInternal: return "Internal"; + case chip::app::Clusters::AudioOutput::OutputTypeEnum::kOther: return "Other"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// +//template<> nlohmann::json to_json(const chip::BitFlags& value) { +// return "{\"no bitmap support\"}"; +//} +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const ApplicationLauncher::Structs::Application::Type& value) { +// return "no struct support"; +//} +// +//template<> nlohmann::json inline to_json(const ApplicationLauncher::Structs::ApplicationEP::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ApplicationLauncher::ApplicationLauncherStatusEnum& value) { + switch( value ) { + case chip::app::Clusters::ApplicationLauncher::ApplicationLauncherStatusEnum::kSuccess: return "Success"; + case chip::app::Clusters::ApplicationLauncher::ApplicationLauncherStatusEnum::kAppNotAvailable: return "AppNotAvailable"; + case chip::app::Clusters::ApplicationLauncher::ApplicationLauncherStatusEnum::kSystemBusy: return "SystemBusy"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// +//template<> nlohmann::json inline to_json(const ApplicationBasic::Structs::ApplicationBasicApplication::Type& value) { +// return "no struct support"; +//} +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum& value) { + switch( value ) { + case chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum::kStopped: return "Stopped"; + case chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum::kActiveVisibleFocus: return "ActiveVisibleFocus"; + case chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum::kActiveHidden: return "ActiveHidden"; + case chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum::kActiveVisibleNotFocus: return "ActiveVisibleNotFocus"; + default: return "{}"; + } +} + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + + + +/***************************** Bitmap Converter FIXME**************/ +// + +/***************************** Struct Converted FIXME**************/ +// + +template<> nlohmann::json inline to_json(const chip::app::Clusters::FaultInjection::FaultType& value) { + switch( value ) { + case chip::app::Clusters::FaultInjection::FaultType::kUnspecified: return "Unspecified"; + case chip::app::Clusters::FaultInjection::FaultType::kSystemFault: return "SystemFault"; + case chip::app::Clusters::FaultInjection::FaultType::kInetFault: return "InetFault"; + case chip::app::Clusters::FaultInjection::FaultType::kChipFault: return "ChipFault"; + case chip::app::Clusters::FaultInjection::FaultType::kCertFault: return "CertFault"; + default: return "{}"; + } +} + + diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/command_translator.cpp b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/command_translator.cpp new file mode 100644 index 00000000000000..5b2661a5aaeac4 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/command_translator.cpp @@ -0,0 +1,6110 @@ +/******************************************************************************* + * # 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. + * + ******************************************************************************/ + #define CHIP_USE_ENUM_CLASS_FOR_IM_ENUM + +#include "command_translator.hpp" +#include +#include +#include +#include "sl_log.h" +#include "chip_types_to_json.hpp" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace unify::matter_bridge; + +#define LOG_TAG "matter_cluster_command_server" + + +void IdentifyClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::Identify; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::Identify::Id: + { + cmd = "Identify"; + { + Commands::Identify::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["IdentifyTime"] = to_json(data.identifyTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::TriggerEffect::Id: + { + cmd = "TriggerEffect"; + { + Commands::TriggerEffect::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["EffectIdentifier"] = to_json(data.effectIdentifier); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::TriggerEffect::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["EffectVariant"] = to_json(data.effectVariant); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ScenesClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::Scenes; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::AddScene::Id: + { + cmd = "AddScene"; + { + Commands::AddScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupId"] = to_json(data.groupId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::AddScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SceneId"] = to_json(data.sceneId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::AddScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::AddScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SceneName"] = to_json(data.sceneName); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::AddScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ExtensionFieldSets"] = to_json(data.extensionFieldSets); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::ViewScene::Id: + { + cmd = "ViewScene"; + { + Commands::ViewScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupId"] = to_json(data.groupId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ViewScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SceneId"] = to_json(data.sceneId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::RemoveScene::Id: + { + cmd = "RemoveScene"; + { + Commands::RemoveScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupId"] = to_json(data.groupId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::RemoveScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SceneId"] = to_json(data.sceneId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::RemoveAllScenes::Id: + { + cmd = "RemoveAllScenes"; + { + Commands::RemoveAllScenes::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupId"] = to_json(data.groupId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::StoreScene::Id: + { + cmd = "StoreScene"; + { + Commands::StoreScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupId"] = to_json(data.groupId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StoreScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SceneId"] = to_json(data.sceneId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::RecallScene::Id: + { + cmd = "RecallScene"; + { + Commands::RecallScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupId"] = to_json(data.groupId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::RecallScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SceneId"] = to_json(data.sceneId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::RecallScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.transitionTime.HasValue() ) { + try { + payload["TransitionTime"] = to_json(data.transitionTime.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::GetSceneMembership::Id: + { + cmd = "GetSceneMembership"; + { + Commands::GetSceneMembership::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupId"] = to_json(data.groupId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::EnhancedAddScene::Id: + { + cmd = "EnhancedAddScene"; + { + Commands::EnhancedAddScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupId"] = to_json(data.groupId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedAddScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SceneId"] = to_json(data.sceneId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedAddScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedAddScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SceneName"] = to_json(data.sceneName); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedAddScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ExtensionFieldSets"] = to_json(data.extensionFieldSets); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::EnhancedViewScene::Id: + { + cmd = "EnhancedViewScene"; + { + Commands::EnhancedViewScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupId"] = to_json(data.groupId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedViewScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SceneId"] = to_json(data.sceneId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::CopyScene::Id: + { + cmd = "CopyScene"; + { + Commands::CopyScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Mode"] = to_json(data.mode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::CopyScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupIdFrom"] = to_json(data.groupIdFrom); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::CopyScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SceneIdFrom"] = to_json(data.sceneIdFrom); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::CopyScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupIdTo"] = to_json(data.groupIdTo); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::CopyScene::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SceneIdTo"] = to_json(data.sceneIdTo); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void OnOffClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::OnOff; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::Off::Id: + { + cmd = "Off"; + } + break; + case Commands::On::Id: + { + cmd = "On"; + } + break; + case Commands::Toggle::Id: + { + cmd = "Toggle"; + } + break; + case Commands::OffWithEffect::Id: + { + cmd = "OffWithEffect"; + { + Commands::OffWithEffect::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["EffectId"] = to_json(data.effectId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::OffWithEffect::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["EffectVariant"] = to_json(data.effectVariant); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::OnWithRecallGlobalScene::Id: + { + cmd = "OnWithRecallGlobalScene"; + } + break; + case Commands::OnWithTimedOff::Id: + { + cmd = "OnWithTimedOff"; + { + Commands::OnWithTimedOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OnOffControl"] = to_json(data.onOffControl); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::OnWithTimedOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OnTime"] = to_json(data.onTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::OnWithTimedOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OffWaitTime"] = to_json(data.offWaitTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void OnOffSwitchConfigurationClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::OnOffSwitchConfiguration; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void LevelControlClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::LevelControl; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::MoveToLevel::Id: + { + cmd = "MoveToLevel"; + { + Commands::MoveToLevel::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Level"] = to_json(data.level); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToLevel::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToLevel::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToLevel::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::Move::Id: + { + cmd = "Move"; + { + Commands::Move::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["MoveMode"] = to_json(data.moveMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::Move::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Rate"] = to_json(data.rate); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::Move::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::Move::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::Step::Id: + { + cmd = "Step"; + { + Commands::Step::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepMode"] = to_json(data.stepMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::Step::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepSize"] = to_json(data.stepSize); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::Step::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::Step::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::Step::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::Stop::Id: + { + cmd = "Stop"; + { + Commands::Stop::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::Stop::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::MoveToLevelWithOnOff::Id: + { + cmd = "MoveToLevelWithOnOff"; + { + Commands::MoveToLevelWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Level"] = to_json(data.level); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToLevelWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToLevelWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToLevelWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::MoveWithOnOff::Id: + { + cmd = "MoveWithOnOff"; + { + Commands::MoveWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["MoveMode"] = to_json(data.moveMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Rate"] = to_json(data.rate); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::StepWithOnOff::Id: + { + cmd = "StepWithOnOff"; + { + Commands::StepWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepMode"] = to_json(data.stepMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepSize"] = to_json(data.stepSize); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::StopWithOnOff::Id: + { + cmd = "StopWithOnOff"; + { + Commands::StopWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StopWithOnOff::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::MoveToClosestFrequency::Id: + { + cmd = "MoveToClosestFrequency"; + { + Commands::MoveToClosestFrequency::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Frequency"] = to_json(data.frequency); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void BinaryInputBasicClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::BinaryInputBasic; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void PulseWidthModulationClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::PulseWidthModulation; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void DescriptorClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::Descriptor; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void BindingClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::Binding; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void AccessControlClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::AccessControl; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ActionsClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::Actions; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::InstantAction::Id: + { + cmd = "InstantAction"; + { + Commands::InstantAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::InstantAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::InstantActionWithTransition::Id: + { + cmd = "InstantActionWithTransition"; + { + Commands::InstantActionWithTransition::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::InstantActionWithTransition::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + { + Commands::InstantActionWithTransition::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::StartAction::Id: + { + cmd = "StartAction"; + { + Commands::StartAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StartAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::StartActionWithDuration::Id: + { + cmd = "StartActionWithDuration"; + { + Commands::StartActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StartActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + { + Commands::StartActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Duration"] = to_json(data.duration); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::StopAction::Id: + { + cmd = "StopAction"; + { + Commands::StopAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StopAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::PauseAction::Id: + { + cmd = "PauseAction"; + { + Commands::PauseAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::PauseAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::PauseActionWithDuration::Id: + { + cmd = "PauseActionWithDuration"; + { + Commands::PauseActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::PauseActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + { + Commands::PauseActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Duration"] = to_json(data.duration); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::ResumeAction::Id: + { + cmd = "ResumeAction"; + { + Commands::ResumeAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ResumeAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::EnableAction::Id: + { + cmd = "EnableAction"; + { + Commands::EnableAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnableAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::EnableActionWithDuration::Id: + { + cmd = "EnableActionWithDuration"; + { + Commands::EnableActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnableActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + { + Commands::EnableActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Duration"] = to_json(data.duration); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::DisableAction::Id: + { + cmd = "DisableAction"; + { + Commands::DisableAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::DisableAction::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::DisableActionWithDuration::Id: + { + cmd = "DisableActionWithDuration"; + { + Commands::DisableActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ActionID"] = to_json(data.actionID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::DisableActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.invokeID.HasValue() ) { + try { + payload["InvokeID"] = to_json(data.invokeID.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + { + Commands::DisableActionWithDuration::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Duration"] = to_json(data.duration); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void BasicClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::Basic; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::MfgSpecificPing::Id: + { + cmd = "MfgSpecificPing"; + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void OtaSoftwareUpdateProviderClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::OtaSoftwareUpdateProvider; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::QueryImage::Id: + { + cmd = "QueryImage"; + { + Commands::QueryImage::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["VendorId"] = to_json(data.vendorId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::QueryImage::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ProductId"] = to_json(data.productId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::QueryImage::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SoftwareVersion"] = to_json(data.softwareVersion); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::QueryImage::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ProtocolsSupported"] = to_json(data.protocolsSupported); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::QueryImage::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.hardwareVersion.HasValue() ) { + try { + payload["HardwareVersion"] = to_json(data.hardwareVersion.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + { + Commands::QueryImage::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.location.HasValue() ) { + try { + payload["Location"] = to_json(data.location.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + { + Commands::QueryImage::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.requestorCanConsent.HasValue() ) { + try { + payload["RequestorCanConsent"] = to_json(data.requestorCanConsent.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + { + Commands::QueryImage::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.metadataForProvider.HasValue() ) { + try { + payload["MetadataForProvider"] = to_json(data.metadataForProvider.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::ApplyUpdateRequest::Id: + { + cmd = "ApplyUpdateRequest"; + { + Commands::ApplyUpdateRequest::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UpdateToken"] = to_json(data.updateToken); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ApplyUpdateRequest::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["NewVersion"] = to_json(data.newVersion); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::NotifyUpdateApplied::Id: + { + cmd = "NotifyUpdateApplied"; + { + Commands::NotifyUpdateApplied::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UpdateToken"] = to_json(data.updateToken); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::NotifyUpdateApplied::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SoftwareVersion"] = to_json(data.softwareVersion); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void OtaSoftwareUpdateRequestorClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::OtaSoftwareUpdateRequestor; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::AnnounceOtaProvider::Id: + { + cmd = "AnnounceOtaProvider"; + { + Commands::AnnounceOtaProvider::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ProviderNodeId"] = to_json(data.providerNodeId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::AnnounceOtaProvider::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["VendorId"] = to_json(data.vendorId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::AnnounceOtaProvider::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["AnnouncementReason"] = to_json(data.announcementReason); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::AnnounceOtaProvider::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.metadataForNode.HasValue() ) { + try { + payload["MetadataForNode"] = to_json(data.metadataForNode.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + { + Commands::AnnounceOtaProvider::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Endpoint"] = to_json(data.endpoint); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void LocalizationConfigurationClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::LocalizationConfiguration; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void TimeFormatLocalizationClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::TimeFormatLocalization; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void UnitLocalizationClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::UnitLocalization; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void PowerSourceConfigurationClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::PowerSourceConfiguration; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void PowerSourceClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::PowerSource; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void GeneralCommissioningClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::GeneralCommissioning; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::ArmFailSafe::Id: + { + cmd = "ArmFailSafe"; + { + Commands::ArmFailSafe::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ExpiryLengthSeconds"] = to_json(data.expiryLengthSeconds); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ArmFailSafe::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Breadcrumb"] = to_json(data.breadcrumb); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::SetRegulatoryConfig::Id: + { + cmd = "SetRegulatoryConfig"; + { + Commands::SetRegulatoryConfig::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["NewRegulatoryConfig"] = to_json(data.newRegulatoryConfig); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetRegulatoryConfig::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["CountryCode"] = to_json(data.countryCode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetRegulatoryConfig::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Breadcrumb"] = to_json(data.breadcrumb); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::CommissioningComplete::Id: + { + cmd = "CommissioningComplete"; + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void DiagnosticLogsClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::DiagnosticLogs; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::RetrieveLogsRequest::Id: + { + cmd = "RetrieveLogsRequest"; + { + Commands::RetrieveLogsRequest::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Intent"] = to_json(data.intent); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::RetrieveLogsRequest::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["RequestedProtocol"] = to_json(data.requestedProtocol); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::RetrieveLogsRequest::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransferFileDesignator"] = to_json(data.transferFileDesignator); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void GeneralDiagnosticsClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::GeneralDiagnostics; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::TestEventTrigger::Id: + { + cmd = "TestEventTrigger"; + { + Commands::TestEventTrigger::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["EnableKey"] = to_json(data.enableKey); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::TestEventTrigger::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["EventTrigger"] = to_json(data.eventTrigger); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void SoftwareDiagnosticsClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::SoftwareDiagnostics; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::ResetWatermarks::Id: + { + cmd = "ResetWatermarks"; + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ThreadNetworkDiagnosticsClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::ThreadNetworkDiagnostics; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::ResetCounts::Id: + { + cmd = "ResetCounts"; + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void WiFiNetworkDiagnosticsClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::WiFiNetworkDiagnostics; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::ResetCounts::Id: + { + cmd = "ResetCounts"; + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void EthernetNetworkDiagnosticsClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::EthernetNetworkDiagnostics; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::ResetCounts::Id: + { + cmd = "ResetCounts"; + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void TimeSynchronizationClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::TimeSynchronization; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::SetUtcTime::Id: + { + cmd = "SetUtcTime"; + { + Commands::SetUtcTime::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UtcTime"] = to_json(data.utcTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetUtcTime::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Granularity"] = to_json(data.granularity); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetUtcTime::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.timeSource.HasValue() ) { + try { + payload["TimeSource"] = to_json(data.timeSource.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void BridgedDeviceBasicClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::BridgedDeviceBasic; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void SwitchClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::Switch; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void AdministratorCommissioningClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::AdministratorCommissioning; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::OpenCommissioningWindow::Id: + { + cmd = "OpenCommissioningWindow"; + { + Commands::OpenCommissioningWindow::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["CommissioningTimeout"] = to_json(data.commissioningTimeout); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::OpenCommissioningWindow::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["PAKEVerifier"] = to_json(data.PAKEVerifier); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::OpenCommissioningWindow::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Discriminator"] = to_json(data.discriminator); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::OpenCommissioningWindow::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Iterations"] = to_json(data.iterations); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::OpenCommissioningWindow::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Salt"] = to_json(data.salt); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::OpenBasicCommissioningWindow::Id: + { + cmd = "OpenBasicCommissioningWindow"; + { + Commands::OpenBasicCommissioningWindow::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["CommissioningTimeout"] = to_json(data.commissioningTimeout); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::RevokeCommissioning::Id: + { + cmd = "RevokeCommissioning"; + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void OperationalCredentialsClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::OperationalCredentials; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::AttestationRequest::Id: + { + cmd = "AttestationRequest"; + { + Commands::AttestationRequest::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["AttestationNonce"] = to_json(data.attestationNonce); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::CertificateChainRequest::Id: + { + cmd = "CertificateChainRequest"; + { + Commands::CertificateChainRequest::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["CertificateType"] = to_json(data.certificateType); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::CSRRequest::Id: + { + cmd = "CSRRequest"; + { + Commands::CSRRequest::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["CSRNonce"] = to_json(data.CSRNonce); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::CSRRequest::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.isForUpdateNOC.HasValue() ) { + try { + payload["IsForUpdateNOC"] = to_json(data.isForUpdateNOC.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::AddNOC::Id: + { + cmd = "AddNOC"; + { + Commands::AddNOC::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["NOCValue"] = to_json(data.NOCValue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::AddNOC::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.ICACValue.HasValue() ) { + try { + payload["ICACValue"] = to_json(data.ICACValue.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + { + Commands::AddNOC::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["IPKValue"] = to_json(data.IPKValue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::AddNOC::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["CaseAdminSubject"] = to_json(data.caseAdminSubject); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::AddNOC::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["AdminVendorId"] = to_json(data.adminVendorId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::UpdateNOC::Id: + { + cmd = "UpdateNOC"; + { + Commands::UpdateNOC::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["NOCValue"] = to_json(data.NOCValue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::UpdateNOC::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.ICACValue.HasValue() ) { + try { + payload["ICACValue"] = to_json(data.ICACValue.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::UpdateFabricLabel::Id: + { + cmd = "UpdateFabricLabel"; + { + Commands::UpdateFabricLabel::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Label"] = to_json(data.label); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::RemoveFabric::Id: + { + cmd = "RemoveFabric"; + { + Commands::RemoveFabric::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["FabricIndex"] = to_json(data.fabricIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::AddTrustedRootCertificate::Id: + { + cmd = "AddTrustedRootCertificate"; + { + Commands::AddTrustedRootCertificate::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["RootCertificate"] = to_json(data.rootCertificate); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void GroupKeyManagementClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::GroupKeyManagement; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::KeySetWrite::Id: + { + cmd = "KeySetWrite"; + { + Commands::KeySetWrite::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupKeySet"] = to_json(data.groupKeySet); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::KeySetRead::Id: + { + cmd = "KeySetRead"; + { + Commands::KeySetRead::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupKeySetID"] = to_json(data.groupKeySetID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::KeySetRemove::Id: + { + cmd = "KeySetRemove"; + { + Commands::KeySetRemove::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupKeySetID"] = to_json(data.groupKeySetID); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::KeySetReadAllIndices::Id: + { + cmd = "KeySetReadAllIndices"; + { + Commands::KeySetReadAllIndices::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["GroupKeySetIDs"] = to_json(data.groupKeySetIDs); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void FixedLabelClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::FixedLabel; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void UserLabelClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::UserLabel; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ProxyConfigurationClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::ProxyConfiguration; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ProxyDiscoveryClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::ProxyDiscovery; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ProxyValidClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::ProxyValid; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void BooleanStateClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::BooleanState; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ModeSelectClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::ModeSelect; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::ChangeToMode::Id: + { + cmd = "ChangeToMode"; + { + Commands::ChangeToMode::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["NewMode"] = to_json(data.newMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void DoorLockClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::DoorLock; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::LockDoor::Id: + { + cmd = "LockDoor"; + { + Commands::LockDoor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.pinCode.HasValue() ) { + try { + payload["PinCode"] = to_json(data.pinCode.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::UnlockDoor::Id: + { + cmd = "UnlockDoor"; + { + Commands::UnlockDoor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.pinCode.HasValue() ) { + try { + payload["PinCode"] = to_json(data.pinCode.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::UnlockWithTimeout::Id: + { + cmd = "UnlockWithTimeout"; + { + Commands::UnlockWithTimeout::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Timeout"] = to_json(data.timeout); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::UnlockWithTimeout::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.pinCode.HasValue() ) { + try { + payload["PinCode"] = to_json(data.pinCode.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::SetWeekDaySchedule::Id: + { + cmd = "SetWeekDaySchedule"; + { + Commands::SetWeekDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["WeekDayIndex"] = to_json(data.weekDayIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetWeekDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserIndex"] = to_json(data.userIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetWeekDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["DaysMask"] = to_json(data.daysMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetWeekDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StartHour"] = to_json(data.startHour); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetWeekDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StartMinute"] = to_json(data.startMinute); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetWeekDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["EndHour"] = to_json(data.endHour); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetWeekDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["EndMinute"] = to_json(data.endMinute); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::GetWeekDaySchedule::Id: + { + cmd = "GetWeekDaySchedule"; + { + Commands::GetWeekDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["WeekDayIndex"] = to_json(data.weekDayIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::GetWeekDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserIndex"] = to_json(data.userIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::ClearWeekDaySchedule::Id: + { + cmd = "ClearWeekDaySchedule"; + { + Commands::ClearWeekDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["WeekDayIndex"] = to_json(data.weekDayIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ClearWeekDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserIndex"] = to_json(data.userIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::SetYearDaySchedule::Id: + { + cmd = "SetYearDaySchedule"; + { + Commands::SetYearDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["YearDayIndex"] = to_json(data.yearDayIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetYearDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserIndex"] = to_json(data.userIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetYearDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["LocalStartTime"] = to_json(data.localStartTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetYearDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["LocalEndTime"] = to_json(data.localEndTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::GetYearDaySchedule::Id: + { + cmd = "GetYearDaySchedule"; + { + Commands::GetYearDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["YearDayIndex"] = to_json(data.yearDayIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::GetYearDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserIndex"] = to_json(data.userIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::ClearYearDaySchedule::Id: + { + cmd = "ClearYearDaySchedule"; + { + Commands::ClearYearDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["YearDayIndex"] = to_json(data.yearDayIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ClearYearDaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserIndex"] = to_json(data.userIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::SetHolidaySchedule::Id: + { + cmd = "SetHolidaySchedule"; + { + Commands::SetHolidaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["HolidayIndex"] = to_json(data.holidayIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetHolidaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["LocalStartTime"] = to_json(data.localStartTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetHolidaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["LocalEndTime"] = to_json(data.localEndTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetHolidaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OperatingMode"] = to_json(data.operatingMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::GetHolidaySchedule::Id: + { + cmd = "GetHolidaySchedule"; + { + Commands::GetHolidaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["HolidayIndex"] = to_json(data.holidayIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::ClearHolidaySchedule::Id: + { + cmd = "ClearHolidaySchedule"; + { + Commands::ClearHolidaySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["HolidayIndex"] = to_json(data.holidayIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::SetUser::Id: + { + cmd = "SetUser"; + { + Commands::SetUser::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OperationType"] = to_json(data.operationType); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetUser::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserIndex"] = to_json(data.userIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetUser::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserName"] = to_json(data.userName); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetUser::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserUniqueId"] = to_json(data.userUniqueId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetUser::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserStatus"] = to_json(data.userStatus); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetUser::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserType"] = to_json(data.userType); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetUser::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["CredentialRule"] = to_json(data.credentialRule); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::GetUser::Id: + { + cmd = "GetUser"; + { + Commands::GetUser::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserIndex"] = to_json(data.userIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::ClearUser::Id: + { + cmd = "ClearUser"; + { + Commands::ClearUser::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserIndex"] = to_json(data.userIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::SetCredential::Id: + { + cmd = "SetCredential"; + { + Commands::SetCredential::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OperationType"] = to_json(data.operationType); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetCredential::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Credential"] = to_json(data.credential); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetCredential::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["CredentialData"] = to_json(data.credentialData); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetCredential::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserIndex"] = to_json(data.userIndex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetCredential::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserStatus"] = to_json(data.userStatus); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetCredential::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UserType"] = to_json(data.userType); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::GetCredentialStatus::Id: + { + cmd = "GetCredentialStatus"; + { + Commands::GetCredentialStatus::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Credential"] = to_json(data.credential); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::ClearCredential::Id: + { + cmd = "ClearCredential"; + { + Commands::ClearCredential::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Credential"] = to_json(data.credential); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void WindowCoveringClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::WindowCovering; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::UpOrOpen::Id: + { + cmd = "UpOrOpen"; + } + break; + case Commands::DownOrClose::Id: + { + cmd = "DownOrClose"; + } + break; + case Commands::StopMotion::Id: + { + cmd = "StopMotion"; + } + break; + case Commands::GoToLiftValue::Id: + { + cmd = "GoToLiftValue"; + { + Commands::GoToLiftValue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["LiftValue"] = to_json(data.liftValue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::GoToLiftPercentage::Id: + { + cmd = "GoToLiftPercentage"; + { + Commands::GoToLiftPercentage::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["LiftPercent100thsValue"] = to_json(data.liftPercent100thsValue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::GoToTiltValue::Id: + { + cmd = "GoToTiltValue"; + { + Commands::GoToTiltValue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TiltValue"] = to_json(data.tiltValue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::GoToTiltPercentage::Id: + { + cmd = "GoToTiltPercentage"; + { + Commands::GoToTiltPercentage::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TiltPercent100thsValue"] = to_json(data.tiltPercent100thsValue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void BarrierControlClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::BarrierControl; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::BarrierControlGoToPercent::Id: + { + cmd = "BarrierControlGoToPercent"; + { + Commands::BarrierControlGoToPercent::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["PercentOpen"] = to_json(data.percentOpen); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::BarrierControlStop::Id: + { + cmd = "BarrierControlStop"; + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void PumpConfigurationAndControlClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::PumpConfigurationAndControl; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ThermostatClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::Thermostat; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::SetpointRaiseLower::Id: + { + cmd = "SetpointRaiseLower"; + { + Commands::SetpointRaiseLower::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Mode"] = to_json(data.mode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetpointRaiseLower::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Amount"] = to_json(data.amount); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::SetWeeklySchedule::Id: + { + cmd = "SetWeeklySchedule"; + { + Commands::SetWeeklySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["NumberOfTransitionsForSequence"] = to_json(data.numberOfTransitionsForSequence); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetWeeklySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["DayOfWeekForSequence"] = to_json(data.dayOfWeekForSequence); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetWeeklySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ModeForSequence"] = to_json(data.modeForSequence); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::SetWeeklySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Transitions"] = to_json(data.transitions); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::GetWeeklySchedule::Id: + { + cmd = "GetWeeklySchedule"; + { + Commands::GetWeeklySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["DaysToReturn"] = to_json(data.daysToReturn); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::GetWeeklySchedule::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ModeToReturn"] = to_json(data.modeToReturn); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::ClearWeeklySchedule::Id: + { + cmd = "ClearWeeklySchedule"; + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void FanControlClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::FanControl; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ThermostatUserInterfaceConfigurationClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::ThermostatUserInterfaceConfiguration; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ColorControlClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::ColorControl; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::MoveToHue::Id: + { + cmd = "MoveToHue"; + { + Commands::MoveToHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Hue"] = to_json(data.hue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Direction"] = to_json(data.direction); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::MoveHue::Id: + { + cmd = "MoveHue"; + { + Commands::MoveHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["MoveMode"] = to_json(data.moveMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Rate"] = to_json(data.rate); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::StepHue::Id: + { + cmd = "StepHue"; + { + Commands::StepHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepMode"] = to_json(data.stepMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepSize"] = to_json(data.stepSize); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::MoveToSaturation::Id: + { + cmd = "MoveToSaturation"; + { + Commands::MoveToSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Saturation"] = to_json(data.saturation); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::MoveSaturation::Id: + { + cmd = "MoveSaturation"; + { + Commands::MoveSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["MoveMode"] = to_json(data.moveMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Rate"] = to_json(data.rate); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::StepSaturation::Id: + { + cmd = "StepSaturation"; + { + Commands::StepSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepMode"] = to_json(data.stepMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepSize"] = to_json(data.stepSize); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::MoveToHueAndSaturation::Id: + { + cmd = "MoveToHueAndSaturation"; + { + Commands::MoveToHueAndSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Hue"] = to_json(data.hue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToHueAndSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Saturation"] = to_json(data.saturation); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToHueAndSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToHueAndSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToHueAndSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::MoveToColor::Id: + { + cmd = "MoveToColor"; + { + Commands::MoveToColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ColorX"] = to_json(data.colorX); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ColorY"] = to_json(data.colorY); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::MoveColor::Id: + { + cmd = "MoveColor"; + { + Commands::MoveColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["RateX"] = to_json(data.rateX); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["RateY"] = to_json(data.rateY); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::StepColor::Id: + { + cmd = "StepColor"; + { + Commands::StepColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepX"] = to_json(data.stepX); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepY"] = to_json(data.stepY); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepColor::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::MoveToColorTemperature::Id: + { + cmd = "MoveToColorTemperature"; + { + Commands::MoveToColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ColorTemperature"] = to_json(data.colorTemperature); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveToColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::EnhancedMoveToHue::Id: + { + cmd = "EnhancedMoveToHue"; + { + Commands::EnhancedMoveToHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["EnhancedHue"] = to_json(data.enhancedHue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedMoveToHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Direction"] = to_json(data.direction); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedMoveToHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedMoveToHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedMoveToHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::EnhancedMoveHue::Id: + { + cmd = "EnhancedMoveHue"; + { + Commands::EnhancedMoveHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["MoveMode"] = to_json(data.moveMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedMoveHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Rate"] = to_json(data.rate); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedMoveHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedMoveHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::EnhancedStepHue::Id: + { + cmd = "EnhancedStepHue"; + { + Commands::EnhancedStepHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepMode"] = to_json(data.stepMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedStepHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepSize"] = to_json(data.stepSize); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedStepHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedStepHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedStepHue::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::EnhancedMoveToHueAndSaturation::Id: + { + cmd = "EnhancedMoveToHueAndSaturation"; + { + Commands::EnhancedMoveToHueAndSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["EnhancedHue"] = to_json(data.enhancedHue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedMoveToHueAndSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Saturation"] = to_json(data.saturation); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedMoveToHueAndSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedMoveToHueAndSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::EnhancedMoveToHueAndSaturation::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::ColorLoopSet::Id: + { + cmd = "ColorLoopSet"; + { + Commands::ColorLoopSet::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["UpdateFlags"] = to_json(data.updateFlags); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ColorLoopSet::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Action"] = to_json(data.action); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ColorLoopSet::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Direction"] = to_json(data.direction); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ColorLoopSet::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Time"] = to_json(data.time); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ColorLoopSet::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StartHue"] = to_json(data.startHue); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ColorLoopSet::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ColorLoopSet::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::StopMoveStep::Id: + { + cmd = "StopMoveStep"; + { + Commands::StopMoveStep::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StopMoveStep::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::MoveColorTemperature::Id: + { + cmd = "MoveColorTemperature"; + { + Commands::MoveColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["MoveMode"] = to_json(data.moveMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Rate"] = to_json(data.rate); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ColorTemperatureMinimumMireds"] = to_json(data.colorTemperatureMinimumMireds); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ColorTemperatureMaximumMireds"] = to_json(data.colorTemperatureMaximumMireds); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::MoveColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::StepColorTemperature::Id: + { + cmd = "StepColorTemperature"; + { + Commands::StepColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepMode"] = to_json(data.stepMode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StepSize"] = to_json(data.stepSize); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TransitionTime"] = to_json(data.transitionTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ColorTemperatureMinimumMireds"] = to_json(data.colorTemperatureMinimumMireds); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ColorTemperatureMaximumMireds"] = to_json(data.colorTemperatureMaximumMireds); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsMask"] = to_json(data.optionsMask); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::StepColorTemperature::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["OptionsOverride"] = to_json(data.optionsOverride); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void BallastConfigurationClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::BallastConfiguration; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void IlluminanceMeasurementClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::IlluminanceMeasurement; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void TemperatureMeasurementClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::TemperatureMeasurement; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void PressureMeasurementClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::PressureMeasurement; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void FlowMeasurementClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::FlowMeasurement; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void RelativeHumidityMeasurementClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::RelativeHumidityMeasurement; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void OccupancySensingClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::OccupancySensing; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void WakeOnLanClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::WakeOnLan; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ChannelClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::Channel; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::ChangeChannel::Id: + { + cmd = "ChangeChannel"; + { + Commands::ChangeChannel::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Match"] = to_json(data.match); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::ChangeChannelByNumber::Id: + { + cmd = "ChangeChannelByNumber"; + { + Commands::ChangeChannelByNumber::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["MajorNumber"] = to_json(data.majorNumber); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::ChangeChannelByNumber::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["MinorNumber"] = to_json(data.minorNumber); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::SkipChannel::Id: + { + cmd = "SkipChannel"; + { + Commands::SkipChannel::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Count"] = to_json(data.count); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void TargetNavigatorClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::TargetNavigator; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::NavigateTarget::Id: + { + cmd = "NavigateTarget"; + { + Commands::NavigateTarget::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Target"] = to_json(data.target); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::NavigateTarget::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.data.HasValue() ) { + try { + payload["Data"] = to_json(data.data.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void MediaPlaybackClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::MediaPlayback; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::Play::Id: + { + cmd = "Play"; + } + break; + case Commands::Pause::Id: + { + cmd = "Pause"; + } + break; + case Commands::StopPlayback::Id: + { + cmd = "StopPlayback"; + } + break; + case Commands::StartOver::Id: + { + cmd = "StartOver"; + } + break; + case Commands::Previous::Id: + { + cmd = "Previous"; + } + break; + case Commands::Next::Id: + { + cmd = "Next"; + } + break; + case Commands::Rewind::Id: + { + cmd = "Rewind"; + } + break; + case Commands::FastForward::Id: + { + cmd = "FastForward"; + } + break; + case Commands::SkipForward::Id: + { + cmd = "SkipForward"; + { + Commands::SkipForward::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["DeltaPositionMilliseconds"] = to_json(data.deltaPositionMilliseconds); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::SkipBackward::Id: + { + cmd = "SkipBackward"; + { + Commands::SkipBackward::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["DeltaPositionMilliseconds"] = to_json(data.deltaPositionMilliseconds); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::Seek::Id: + { + cmd = "Seek"; + { + Commands::Seek::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Position"] = to_json(data.position); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void MediaInputClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::MediaInput; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::SelectInput::Id: + { + cmd = "SelectInput"; + { + Commands::SelectInput::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Index"] = to_json(data.index); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::ShowInputStatus::Id: + { + cmd = "ShowInputStatus"; + } + break; + case Commands::HideInputStatus::Id: + { + cmd = "HideInputStatus"; + } + break; + case Commands::RenameInput::Id: + { + cmd = "RenameInput"; + { + Commands::RenameInput::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Index"] = to_json(data.index); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::RenameInput::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Name"] = to_json(data.name); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void LowPowerClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::LowPower; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::Sleep::Id: + { + cmd = "Sleep"; + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void KeypadInputClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::KeypadInput; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::SendKey::Id: + { + cmd = "SendKey"; + { + Commands::SendKey::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["KeyCode"] = to_json(data.keyCode); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ContentLauncherClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::ContentLauncher; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::LaunchContent::Id: + { + cmd = "LaunchContent"; + { + Commands::LaunchContent::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Search"] = to_json(data.search); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::LaunchContent::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["AutoPlay"] = to_json(data.autoPlay); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::LaunchContent::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.data.HasValue() ) { + try { + payload["Data"] = to_json(data.data.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::LaunchURL::Id: + { + cmd = "LaunchURL"; + { + Commands::LaunchURL::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["ContentURL"] = to_json(data.contentURL); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::LaunchURL::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.displayString.HasValue() ) { + try { + payload["DisplayString"] = to_json(data.displayString.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + { + Commands::LaunchURL::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.brandingInformation.HasValue() ) { + try { + payload["BrandingInformation"] = to_json(data.brandingInformation.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void AudioOutputClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::AudioOutput; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::SelectOutput::Id: + { + cmd = "SelectOutput"; + { + Commands::SelectOutput::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Index"] = to_json(data.index); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::RenameOutput::Id: + { + cmd = "RenameOutput"; + { + Commands::RenameOutput::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Index"] = to_json(data.index); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::RenameOutput::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Name"] = to_json(data.name); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ApplicationLauncherClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::ApplicationLauncher; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::LaunchApp::Id: + { + cmd = "LaunchApp"; + { + Commands::LaunchApp::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Application"] = to_json(data.application); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::LaunchApp::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + if( data.data.HasValue() ) { + try { + payload["Data"] = to_json(data.data.Value()); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command arguments value to json format: %s", ex.what()); + } + } + } + } + } + break; + case Commands::StopApp::Id: + { + cmd = "StopApp"; + { + Commands::StopApp::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Application"] = to_json(data.application); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::HideApp::Id: + { + cmd = "HideApp"; + { + Commands::HideApp::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Application"] = to_json(data.application); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ApplicationBasicClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::ApplicationBasic; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void AccountLoginClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::AccountLogin; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::GetSetupPIN::Id: + { + cmd = "GetSetupPIN"; + { + Commands::GetSetupPIN::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TempAccountIdentifier"] = to_json(data.tempAccountIdentifier); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::Login::Id: + { + cmd = "Login"; + { + Commands::Login::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TempAccountIdentifier"] = to_json(data.tempAccountIdentifier); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::Login::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["SetupPIN"] = to_json(data.setupPIN); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::Logout::Id: + { + cmd = "Logout"; + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void ElectricalMeasurementClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::ElectricalMeasurement; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::GetProfileInfoCommand::Id: + { + cmd = "GetProfileInfoCommand"; + } + break; + case Commands::GetMeasurementProfileCommand::Id: + { + cmd = "GetMeasurementProfileCommand"; + { + Commands::GetMeasurementProfileCommand::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["AttributeId"] = to_json(data.attributeId); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::GetMeasurementProfileCommand::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["StartTime"] = to_json(data.startTime); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::GetMeasurementProfileCommand::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["NumberOfIntervals"] = to_json(data.numberOfIntervals); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} + +void FaultInjectionClusterCommandHandler::InvokeCommand( + CommandHandlerInterface::HandlerContext &ctxt) +{ + using namespace chip::app::Clusters::FaultInjection; + + auto unify_node = m_node_state_monitor.bridged_endpoint(ctxt.mRequestPath.mEndpointId); + if (!unify_node) { + sl_log_info(LOG_TAG, "The endpoint [%i] is not a part of unify matter bridge node", ctxt.mRequestPath.mEndpointId); + return; + } + + std::string cmd; + nlohmann::json payload = {}; + + switch (ctxt.mRequestPath.mCommandId) { + case Commands::FailAtFault::Id: + { + cmd = "FailAtFault"; + { + Commands::FailAtFault::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Type"] = to_json(data.type); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::FailAtFault::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Id"] = to_json(data.id); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::FailAtFault::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["NumCallsToSkip"] = to_json(data.numCallsToSkip); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::FailAtFault::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["NumCallsToFail"] = to_json(data.numCallsToFail); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::FailAtFault::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["TakeMutex"] = to_json(data.takeMutex); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + case Commands::FailRandomlyAtFault::Id: + { + cmd = "FailRandomlyAtFault"; + { + Commands::FailRandomlyAtFault::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Type"] = to_json(data.type); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::FailRandomlyAtFault::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Id"] = to_json(data.id); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + { + Commands::FailRandomlyAtFault::DecodableType data; + if (DataModel::Decode(ctxt.GetReader(), data) == CHIP_NO_ERROR) { + try { + payload["Percentage"] = to_json(data.percentage); + } catch (std::exception &ex) { + sl_log_warning(LOG_TAG, "Failed to add the command argument value to json format: %s", ex.what()); + } + } + } + } + break; + } + + if(!cmd.empty()) { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::Success); + send_unify_mqtt_cmd(ctxt, cmd, payload ); + sl_log_debug(LOG_TAG, "Mapped [%] command to unify dotdot data model", cmd.c_str()); + } else { + ctxt.mCommandHandler.AddStatus(ctxt.mRequestPath, Protocols::InteractionModel::Status::UnsupportedCommand); + } + ctxt.SetCommandHandled(); +} diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/command_translator.hpp b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/command_translator.hpp new file mode 100644 index 00000000000000..a73d9711442fc6 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/command_translator.hpp @@ -0,0 +1,785 @@ +/****************************************************************************** + * # 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 command_translator + * @brief cluster command translator for matter interface + * + * Translate cluster commands from the matter protocol to unify + * dotdot data model. + * + * @{ + */ + +#ifndef COMMAND_TRANSLATOR_HPP +#define 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, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::Identify::Id,"Identify", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ScenesClusterCommandHandler : public command_translator_interface +{ + public: + ScenesClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::Scenes::Id,"Scenes", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class OnOffClusterCommandHandler : public command_translator_interface +{ + public: + OnOffClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::OnOff::Id,"OnOff", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class OnOffSwitchConfigurationClusterCommandHandler : public command_translator_interface +{ + public: + OnOffSwitchConfigurationClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::OnOffSwitchConfiguration::Id,"OnOffSwitchConfiguration", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class LevelControlClusterCommandHandler : public command_translator_interface +{ + public: + LevelControlClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::LevelControl::Id,"LevelControl", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class BinaryInputBasicClusterCommandHandler : public command_translator_interface +{ + public: + BinaryInputBasicClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::BinaryInputBasic::Id,"BinaryInputBasic", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class PulseWidthModulationClusterCommandHandler : public command_translator_interface +{ + public: + PulseWidthModulationClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::PulseWidthModulation::Id,"PulseWidthModulation", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class DescriptorClusterCommandHandler : public command_translator_interface +{ + public: + DescriptorClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::Descriptor::Id,"Descriptor", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class BindingClusterCommandHandler : public command_translator_interface +{ + public: + BindingClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::Binding::Id,"Binding", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class AccessControlClusterCommandHandler : public command_translator_interface +{ + public: + AccessControlClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::AccessControl::Id,"AccessControl", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ActionsClusterCommandHandler : public command_translator_interface +{ + public: + ActionsClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::Actions::Id,"Actions", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class BasicClusterCommandHandler : public command_translator_interface +{ + public: + BasicClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::Basic::Id,"Basic", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class OtaSoftwareUpdateProviderClusterCommandHandler : public command_translator_interface +{ + public: + OtaSoftwareUpdateProviderClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::OtaSoftwareUpdateProvider::Id,"OtaSoftwareUpdateProvider", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class OtaSoftwareUpdateRequestorClusterCommandHandler : public command_translator_interface +{ + public: + OtaSoftwareUpdateRequestorClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::OtaSoftwareUpdateRequestor::Id,"OtaSoftwareUpdateRequestor", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class LocalizationConfigurationClusterCommandHandler : public command_translator_interface +{ + public: + LocalizationConfigurationClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::LocalizationConfiguration::Id,"LocalizationConfiguration", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class TimeFormatLocalizationClusterCommandHandler : public command_translator_interface +{ + public: + TimeFormatLocalizationClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::TimeFormatLocalization::Id,"TimeFormatLocalization", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class UnitLocalizationClusterCommandHandler : public command_translator_interface +{ + public: + UnitLocalizationClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::UnitLocalization::Id,"UnitLocalization", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class PowerSourceConfigurationClusterCommandHandler : public command_translator_interface +{ + public: + PowerSourceConfigurationClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::PowerSourceConfiguration::Id,"PowerSourceConfiguration", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class PowerSourceClusterCommandHandler : public command_translator_interface +{ + public: + PowerSourceClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::PowerSource::Id,"PowerSource", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class GeneralCommissioningClusterCommandHandler : public command_translator_interface +{ + public: + GeneralCommissioningClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::GeneralCommissioning::Id,"GeneralCommissioning", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class DiagnosticLogsClusterCommandHandler : public command_translator_interface +{ + public: + DiagnosticLogsClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::DiagnosticLogs::Id,"DiagnosticLogs", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class GeneralDiagnosticsClusterCommandHandler : public command_translator_interface +{ + public: + GeneralDiagnosticsClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::GeneralDiagnostics::Id,"GeneralDiagnostics", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class SoftwareDiagnosticsClusterCommandHandler : public command_translator_interface +{ + public: + SoftwareDiagnosticsClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::SoftwareDiagnostics::Id,"SoftwareDiagnostics", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ThreadNetworkDiagnosticsClusterCommandHandler : public command_translator_interface +{ + public: + ThreadNetworkDiagnosticsClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::ThreadNetworkDiagnostics::Id,"ThreadNetworkDiagnostics", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class WiFiNetworkDiagnosticsClusterCommandHandler : public command_translator_interface +{ + public: + WiFiNetworkDiagnosticsClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::WiFiNetworkDiagnostics::Id,"WiFiNetworkDiagnostics", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class EthernetNetworkDiagnosticsClusterCommandHandler : public command_translator_interface +{ + public: + EthernetNetworkDiagnosticsClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::EthernetNetworkDiagnostics::Id,"EthernetNetworkDiagnostics", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class TimeSynchronizationClusterCommandHandler : public command_translator_interface +{ + public: + TimeSynchronizationClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::TimeSynchronization::Id,"TimeSynchronization", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class BridgedDeviceBasicClusterCommandHandler : public command_translator_interface +{ + public: + BridgedDeviceBasicClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::BridgedDeviceBasic::Id,"BridgedDeviceBasic", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class SwitchClusterCommandHandler : public command_translator_interface +{ + public: + SwitchClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::Switch::Id,"Switch", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class AdministratorCommissioningClusterCommandHandler : public command_translator_interface +{ + public: + AdministratorCommissioningClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::AdministratorCommissioning::Id,"AdministratorCommissioning", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class OperationalCredentialsClusterCommandHandler : public command_translator_interface +{ + public: + OperationalCredentialsClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::OperationalCredentials::Id,"OperationalCredentials", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class GroupKeyManagementClusterCommandHandler : public command_translator_interface +{ + public: + GroupKeyManagementClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::GroupKeyManagement::Id,"GroupKeyManagement", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class FixedLabelClusterCommandHandler : public command_translator_interface +{ + public: + FixedLabelClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::FixedLabel::Id,"FixedLabel", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class UserLabelClusterCommandHandler : public command_translator_interface +{ + public: + UserLabelClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::UserLabel::Id,"UserLabel", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ProxyConfigurationClusterCommandHandler : public command_translator_interface +{ + public: + ProxyConfigurationClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::ProxyConfiguration::Id,"ProxyConfiguration", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ProxyDiscoveryClusterCommandHandler : public command_translator_interface +{ + public: + ProxyDiscoveryClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::ProxyDiscovery::Id,"ProxyDiscovery", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ProxyValidClusterCommandHandler : public command_translator_interface +{ + public: + ProxyValidClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::ProxyValid::Id,"ProxyValid", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class BooleanStateClusterCommandHandler : public command_translator_interface +{ + public: + BooleanStateClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::BooleanState::Id,"BooleanState", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ModeSelectClusterCommandHandler : public command_translator_interface +{ + public: + ModeSelectClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::ModeSelect::Id,"ModeSelect", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class DoorLockClusterCommandHandler : public command_translator_interface +{ + public: + DoorLockClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::DoorLock::Id,"DoorLock", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class WindowCoveringClusterCommandHandler : public command_translator_interface +{ + public: + WindowCoveringClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::WindowCovering::Id,"WindowCovering", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class BarrierControlClusterCommandHandler : public command_translator_interface +{ + public: + BarrierControlClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::BarrierControl::Id,"BarrierControl", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class PumpConfigurationAndControlClusterCommandHandler : public command_translator_interface +{ + public: + PumpConfigurationAndControlClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::PumpConfigurationAndControl::Id,"PumpConfigurationAndControl", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ThermostatClusterCommandHandler : public command_translator_interface +{ + public: + ThermostatClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::Thermostat::Id,"Thermostat", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class FanControlClusterCommandHandler : public command_translator_interface +{ + public: + FanControlClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::FanControl::Id,"FanControl", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ThermostatUserInterfaceConfigurationClusterCommandHandler : public command_translator_interface +{ + public: + ThermostatUserInterfaceConfigurationClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id,"ThermostatUserInterfaceConfiguration", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ColorControlClusterCommandHandler : public command_translator_interface +{ + public: + ColorControlClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::ColorControl::Id,"ColorControl", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class BallastConfigurationClusterCommandHandler : public command_translator_interface +{ + public: + BallastConfigurationClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::BallastConfiguration::Id,"BallastConfiguration", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class IlluminanceMeasurementClusterCommandHandler : public command_translator_interface +{ + public: + IlluminanceMeasurementClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::IlluminanceMeasurement::Id,"IlluminanceMeasurement", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class TemperatureMeasurementClusterCommandHandler : public command_translator_interface +{ + public: + TemperatureMeasurementClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::TemperatureMeasurement::Id,"TemperatureMeasurement", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class PressureMeasurementClusterCommandHandler : public command_translator_interface +{ + public: + PressureMeasurementClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::PressureMeasurement::Id,"PressureMeasurement", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class FlowMeasurementClusterCommandHandler : public command_translator_interface +{ + public: + FlowMeasurementClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::FlowMeasurement::Id,"FlowMeasurement", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class RelativeHumidityMeasurementClusterCommandHandler : public command_translator_interface +{ + public: + RelativeHumidityMeasurementClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::RelativeHumidityMeasurement::Id,"RelativeHumidityMeasurement", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class OccupancySensingClusterCommandHandler : public command_translator_interface +{ + public: + OccupancySensingClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::OccupancySensing::Id,"OccupancySensing", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class WakeOnLanClusterCommandHandler : public command_translator_interface +{ + public: + WakeOnLanClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::WakeOnLan::Id,"WakeOnLan", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ChannelClusterCommandHandler : public command_translator_interface +{ + public: + ChannelClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::Channel::Id,"Channel", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class TargetNavigatorClusterCommandHandler : public command_translator_interface +{ + public: + TargetNavigatorClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::TargetNavigator::Id,"TargetNavigator", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class MediaPlaybackClusterCommandHandler : public command_translator_interface +{ + public: + MediaPlaybackClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::MediaPlayback::Id,"MediaPlayback", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class MediaInputClusterCommandHandler : public command_translator_interface +{ + public: + MediaInputClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::MediaInput::Id,"MediaInput", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class LowPowerClusterCommandHandler : public command_translator_interface +{ + public: + LowPowerClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::LowPower::Id,"LowPower", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class KeypadInputClusterCommandHandler : public command_translator_interface +{ + public: + KeypadInputClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::KeypadInput::Id,"KeypadInput", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ContentLauncherClusterCommandHandler : public command_translator_interface +{ + public: + ContentLauncherClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::ContentLauncher::Id,"ContentLauncher", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class AudioOutputClusterCommandHandler : public command_translator_interface +{ + public: + AudioOutputClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::AudioOutput::Id,"AudioOutput", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ApplicationLauncherClusterCommandHandler : public command_translator_interface +{ + public: + ApplicationLauncherClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::ApplicationLauncher::Id,"ApplicationLauncher", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ApplicationBasicClusterCommandHandler : public command_translator_interface +{ + public: + ApplicationBasicClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::ApplicationBasic::Id,"ApplicationBasic", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class AccountLoginClusterCommandHandler : public command_translator_interface +{ + public: + AccountLoginClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::AccountLogin::Id,"AccountLogin", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class ElectricalMeasurementClusterCommandHandler : public command_translator_interface +{ + public: + ElectricalMeasurementClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::ElectricalMeasurement::Id,"ElectricalMeasurement", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; +class FaultInjectionClusterCommandHandler : public command_translator_interface +{ + public: + FaultInjectionClusterCommandHandler( + const matter_node_state_monitor &node_state_monitor, UicMqtt &uic_mqtt) : + command_translator_interface(node_state_monitor, + chip::app::Clusters::FaultInjection::Id,"FaultInjection", uic_mqtt) + {} + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext + &HandlerContext) override; +}; + +} // namespace unify::matter_bridge + +#endif //COMMAND_TRANSLATOR_HPP +/** @} end command_translator */ diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/unify_accessors.cpp b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/unify_accessors.cpp new file mode 100644 index 00000000000000..43c10945485f39 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/unify_accessors.cpp @@ -0,0 +1,25370 @@ + +/** + * @file + * This file contains definitions for accessors around clusters attributes. + */ + +#define CHIP_USE_ENUM_CLASS_FOR_IM_ENUM +#include + +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app; +namespace unify { +namespace matter_bridge { + +namespace Identify { +namespace Attributes { + +namespace IdentifyTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace IdentifyTime + +namespace IdentifyType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace IdentifyType + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // Identify + +namespace Scenes { +namespace Attributes { + +namespace SceneCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SceneCount + +namespace CurrentScene { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentScene + +namespace CurrentGroup { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::GroupId& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::GroupId& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentGroup + +namespace SceneValid { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SceneValid + +namespace NameSupport { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NameSupport + +namespace LastConfiguredBy { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LastConfiguredBy + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // Scenes + +namespace OnOff { +namespace Attributes { + +namespace OnOff { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OnOff + +namespace GlobalSceneControl { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace GlobalSceneControl + +namespace OnTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OnTime + +namespace OffWaitTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OffWaitTime + +namespace StartUpOnOff { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace StartUpOnOff + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // OnOff + +namespace OnOffSwitchConfiguration { +namespace Attributes { + +namespace SwitchType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SwitchType + +namespace SwitchActions { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SwitchActions + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // OnOffSwitchConfiguration + +namespace LevelControl { +namespace Attributes { + +namespace CurrentLevel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentLevel + +namespace RemainingTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RemainingTime + +namespace MinLevel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinLevel + +namespace MaxLevel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxLevel + +namespace CurrentFrequency { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentFrequency + +namespace MinFrequency { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinFrequency + +namespace MaxFrequency { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxFrequency + +namespace Options { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Options + +namespace OnOffTransitionTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OnOffTransitionTime + +namespace OnLevel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OnLevel + +namespace OnTransitionTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OnTransitionTime + +namespace OffTransitionTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OffTransitionTime + +namespace DefaultMoveRate { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DefaultMoveRate + +namespace StartUpCurrentLevel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace StartUpCurrentLevel + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // LevelControl + +namespace BinaryInputBasic { +namespace Attributes { + +namespace ActiveText { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActiveText + +namespace Description { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Description + +namespace InactiveText { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace InactiveText + +namespace OutOfService { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OutOfService + +namespace Polarity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Polarity + +namespace PresentValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PresentValue + +namespace Reliability { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Reliability + +namespace StatusFlags { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace StatusFlags + +namespace ApplicationType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ApplicationType + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // BinaryInputBasic + +namespace PulseWidthModulation { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // PulseWidthModulation + +namespace Descriptor { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // Descriptor + +namespace Binding { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // Binding + +namespace AccessControl { +namespace Attributes { + +namespace SubjectsPerAccessControlEntry { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SubjectsPerAccessControlEntry + +namespace TargetsPerAccessControlEntry { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TargetsPerAccessControlEntry + +namespace AccessControlEntriesPerFabric { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AccessControlEntriesPerFabric + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // AccessControl + +namespace Actions { +namespace Attributes { + +namespace SetupURL { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SetupURL + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // Actions + +namespace Basic { +namespace Attributes { + +namespace DataModelRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DataModelRevision + +namespace VendorName { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace VendorName + +namespace VendorID { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::VendorId& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::VendorId& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace VendorID + +namespace ProductName { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ProductName + +namespace ProductID { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ProductID + +namespace NodeLabel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NodeLabel + +namespace Location { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Location + +namespace HardwareVersion { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace HardwareVersion + +namespace HardwareVersionString { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace HardwareVersionString + +namespace SoftwareVersion { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SoftwareVersion + +namespace SoftwareVersionString { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SoftwareVersionString + +namespace ManufacturingDate { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ManufacturingDate + +namespace PartNumber { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PartNumber + +namespace ProductURL { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ProductURL + +namespace ProductLabel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ProductLabel + +namespace SerialNumber { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SerialNumber + +namespace LocalConfigDisabled { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LocalConfigDisabled + +namespace Reachable { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Reachable + +namespace UniqueID { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UniqueID + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // Basic + +namespace OtaSoftwareUpdateProvider { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // OtaSoftwareUpdateProvider + +namespace OtaSoftwareUpdateRequestor { +namespace Attributes { + +namespace UpdatePossible { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UpdatePossible + +namespace UpdateState { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UpdateState + +namespace UpdateStateProgress { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UpdateStateProgress + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // OtaSoftwareUpdateRequestor + +namespace LocalizationConfiguration { +namespace Attributes { + +namespace ActiveLocale { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActiveLocale + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // LocalizationConfiguration + +namespace TimeFormatLocalization { +namespace Attributes { + +namespace HourFormat { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::TimeFormatLocalization::HourFormat& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::TimeFormatLocalization::HourFormat& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace HourFormat + +namespace ActiveCalendarType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::TimeFormatLocalization::CalendarType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::TimeFormatLocalization::CalendarType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActiveCalendarType + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // TimeFormatLocalization + +namespace UnitLocalization { +namespace Attributes { + +namespace TemperatureUnit { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::UnitLocalization::TempUnit& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::UnitLocalization::TempUnit& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TemperatureUnit + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // UnitLocalization + +namespace PowerSourceConfiguration { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // PowerSourceConfiguration + +namespace PowerSource { +namespace Attributes { + +namespace Status { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PowerSource::PowerSourceStatus& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PowerSource::PowerSourceStatus& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Status + +namespace Order { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Order + +namespace Description { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Description + +namespace WiredAssessedInputVoltage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WiredAssessedInputVoltage + +namespace WiredAssessedInputFrequency { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WiredAssessedInputFrequency + +namespace WiredCurrentType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PowerSource::WiredCurrentType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PowerSource::WiredCurrentType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WiredCurrentType + +namespace WiredAssessedCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WiredAssessedCurrent + +namespace WiredNominalVoltage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WiredNominalVoltage + +namespace WiredMaximumCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WiredMaximumCurrent + +namespace WiredPresent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WiredPresent + +namespace BatVoltage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatVoltage + +namespace BatPercentRemaining { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatPercentRemaining + +namespace BatTimeRemaining { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatTimeRemaining + +namespace BatChargeLevel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PowerSource::BatChargeLevel& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PowerSource::BatChargeLevel& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatChargeLevel + +namespace BatReplacementNeeded { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatReplacementNeeded + +namespace BatReplaceability { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PowerSource::BatReplaceability& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PowerSource::BatReplaceability& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatReplaceability + +namespace BatPresent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatPresent + +namespace BatReplacementDescription { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatReplacementDescription + +namespace BatCommonDesignation { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatCommonDesignation + +namespace BatANSIDesignation { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatANSIDesignation + +namespace BatIECDesignation { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatIECDesignation + +namespace BatApprovedChemistry { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatApprovedChemistry + +namespace BatCapacity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatCapacity + +namespace BatQuantity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatQuantity + +namespace BatChargeState { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PowerSource::BatChargeState& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PowerSource::BatChargeState& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatChargeState + +namespace BatTimeToFullCharge { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatTimeToFullCharge + +namespace BatFunctionalWhileCharging { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatFunctionalWhileCharging + +namespace BatChargingCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BatChargingCurrent + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // PowerSource + +namespace GeneralCommissioning { +namespace Attributes { + +namespace Breadcrumb { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Breadcrumb + +namespace RegulatoryConfig { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RegulatoryConfig + +namespace LocationCapability { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LocationCapability + +namespace SupportsConcurrentConnection { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SupportsConcurrentConnection + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // GeneralCommissioning + +namespace DiagnosticLogs { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // DiagnosticLogs + +namespace GeneralDiagnostics { +namespace Attributes { + +namespace RebootCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RebootCount + +namespace UpTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UpTime + +namespace TotalOperationalHours { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TotalOperationalHours + +namespace BootReasons { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BootReasons + +namespace TestEventTriggersEnabled { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TestEventTriggersEnabled + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // GeneralDiagnostics + +namespace SoftwareDiagnostics { +namespace Attributes { + +namespace CurrentHeapFree { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentHeapFree + +namespace CurrentHeapUsed { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentHeapUsed + +namespace CurrentHeapHighWatermark { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentHeapHighWatermark + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // SoftwareDiagnostics + +namespace ThreadNetworkDiagnostics { +namespace Attributes { + +namespace Channel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Channel + +namespace RoutingRole { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RoutingRole + +namespace NetworkName { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NetworkName + +namespace PanId { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PanId + +namespace ExtendedPanId { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ExtendedPanId + +namespace MeshLocalPrefix { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeshLocalPrefix + +namespace OverrunCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OverrunCount + +namespace PartitionId { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PartitionId + +namespace Weighting { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Weighting + +namespace DataVersion { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DataVersion + +namespace StableDataVersion { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace StableDataVersion + +namespace LeaderRouterId { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LeaderRouterId + +namespace DetachedRoleCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DetachedRoleCount + +namespace ChildRoleCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ChildRoleCount + +namespace RouterRoleCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RouterRoleCount + +namespace LeaderRoleCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LeaderRoleCount + +namespace AttachAttemptCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AttachAttemptCount + +namespace PartitionIdChangeCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PartitionIdChangeCount + +namespace BetterPartitionAttachAttemptCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BetterPartitionAttachAttemptCount + +namespace ParentChangeCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ParentChangeCount + +namespace TxTotalCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxTotalCount + +namespace TxUnicastCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxUnicastCount + +namespace TxBroadcastCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxBroadcastCount + +namespace TxAckRequestedCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxAckRequestedCount + +namespace TxAckedCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxAckedCount + +namespace TxNoAckRequestedCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxNoAckRequestedCount + +namespace TxDataCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxDataCount + +namespace TxDataPollCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxDataPollCount + +namespace TxBeaconCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxBeaconCount + +namespace TxBeaconRequestCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxBeaconRequestCount + +namespace TxOtherCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxOtherCount + +namespace TxRetryCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxRetryCount + +namespace TxDirectMaxRetryExpiryCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxDirectMaxRetryExpiryCount + +namespace TxIndirectMaxRetryExpiryCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxIndirectMaxRetryExpiryCount + +namespace TxErrCcaCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxErrCcaCount + +namespace TxErrAbortCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxErrAbortCount + +namespace TxErrBusyChannelCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxErrBusyChannelCount + +namespace RxTotalCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxTotalCount + +namespace RxUnicastCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxUnicastCount + +namespace RxBroadcastCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxBroadcastCount + +namespace RxDataCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxDataCount + +namespace RxDataPollCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxDataPollCount + +namespace RxBeaconCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxBeaconCount + +namespace RxBeaconRequestCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxBeaconRequestCount + +namespace RxOtherCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxOtherCount + +namespace RxAddressFilteredCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxAddressFilteredCount + +namespace RxDestAddrFilteredCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxDestAddrFilteredCount + +namespace RxDuplicatedCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxDuplicatedCount + +namespace RxErrNoFrameCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxErrNoFrameCount + +namespace RxErrUnknownNeighborCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxErrUnknownNeighborCount + +namespace RxErrInvalidSrcAddrCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxErrInvalidSrcAddrCount + +namespace RxErrSecCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxErrSecCount + +namespace RxErrFcsCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxErrFcsCount + +namespace RxErrOtherCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RxErrOtherCount + +namespace ActiveTimestamp { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActiveTimestamp + +namespace PendingTimestamp { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PendingTimestamp + +namespace Delay { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Delay + +namespace ChannelPage0Mask { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ChannelPage0Mask + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // ThreadNetworkDiagnostics + +namespace WiFiNetworkDiagnostics { +namespace Attributes { + +namespace Bssid { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Bssid + +namespace SecurityType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SecurityType + +namespace WiFiVersion { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WiFiVersion + +namespace ChannelNumber { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ChannelNumber + +namespace Rssi { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Rssi + +namespace BeaconLostCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BeaconLostCount + +namespace BeaconRxCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BeaconRxCount + +namespace PacketMulticastRxCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PacketMulticastRxCount + +namespace PacketMulticastTxCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PacketMulticastTxCount + +namespace PacketUnicastRxCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PacketUnicastRxCount + +namespace PacketUnicastTxCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PacketUnicastTxCount + +namespace CurrentMaxRate { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentMaxRate + +namespace OverrunCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OverrunCount + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // WiFiNetworkDiagnostics + +namespace EthernetNetworkDiagnostics { +namespace Attributes { + +namespace PHYRate { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PHYRate + +namespace FullDuplex { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FullDuplex + +namespace PacketRxCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PacketRxCount + +namespace PacketTxCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PacketTxCount + +namespace TxErrCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TxErrCount + +namespace CollisionCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CollisionCount + +namespace OverrunCount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OverrunCount + +namespace CarrierDetect { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CarrierDetect + +namespace TimeSinceReset { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TimeSinceReset + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // EthernetNetworkDiagnostics + +namespace TimeSynchronization { +namespace Attributes { + +namespace UTCTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UTCTime + +namespace Granularity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::TimeSynchronization::GranularityEnum& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::TimeSynchronization::GranularityEnum& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Granularity + +namespace TimeSource { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::TimeSynchronization::TimeSourceEnum& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::TimeSynchronization::TimeSourceEnum& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TimeSource + +namespace TrustedTimeNodeId { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TrustedTimeNodeId + +namespace DefaultNtp { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DefaultNtp + +namespace LocalTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LocalTime + +namespace TimeZoneDatabase { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TimeZoneDatabase + +namespace NtpServerPort { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NtpServerPort + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // TimeSynchronization + +namespace BridgedDeviceBasic { +namespace Attributes { + +namespace VendorName { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace VendorName + +namespace VendorID { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::VendorId& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::VendorId& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace VendorID + +namespace ProductName { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ProductName + +namespace NodeLabel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NodeLabel + +namespace HardwareVersion { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace HardwareVersion + +namespace HardwareVersionString { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace HardwareVersionString + +namespace SoftwareVersion { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SoftwareVersion + +namespace SoftwareVersionString { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SoftwareVersionString + +namespace ManufacturingDate { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ManufacturingDate + +namespace PartNumber { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PartNumber + +namespace ProductURL { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ProductURL + +namespace ProductLabel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ProductLabel + +namespace SerialNumber { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SerialNumber + +namespace Reachable { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Reachable + +namespace UniqueID { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UniqueID + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // BridgedDeviceBasic + +namespace Switch { +namespace Attributes { + +namespace NumberOfPositions { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfPositions + +namespace CurrentPosition { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentPosition + +namespace MultiPressMax { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MultiPressMax + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // Switch + +namespace AdministratorCommissioning { +namespace Attributes { + +namespace WindowStatus { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WindowStatus + +namespace AdminFabricIndex { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AdminFabricIndex + +namespace AdminVendorId { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AdminVendorId + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // AdministratorCommissioning + +namespace OperationalCredentials { +namespace Attributes { + +namespace SupportedFabrics { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SupportedFabrics + +namespace CommissionedFabrics { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CommissionedFabrics + +namespace CurrentFabricIndex { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentFabricIndex + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // OperationalCredentials + +namespace GroupKeyManagement { +namespace Attributes { + +namespace MaxGroupsPerFabric { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxGroupsPerFabric + +namespace MaxGroupKeysPerFabric { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxGroupKeysPerFabric + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // GroupKeyManagement + +namespace FixedLabel { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // FixedLabel + +namespace UserLabel { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // UserLabel + +namespace ProxyConfiguration { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // ProxyConfiguration + +namespace ProxyDiscovery { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // ProxyDiscovery + +namespace ProxyValid { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // ProxyValid + +namespace BooleanState { +namespace Attributes { + +namespace StateValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace StateValue + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // BooleanState + +namespace ModeSelect { +namespace Attributes { + +namespace Description { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Description + +namespace StandardNamespace { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace StandardNamespace + +namespace CurrentMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentMode + +namespace StartUpMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace StartUpMode + +namespace OnMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OnMode + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // ModeSelect + +namespace DoorLock { +namespace Attributes { + +namespace LockState { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LockState + +namespace LockType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::DoorLock::DlLockType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::DoorLock::DlLockType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LockType + +namespace ActuatorEnabled { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActuatorEnabled + +namespace DoorState { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DoorState + +namespace DoorOpenEvents { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DoorOpenEvents + +namespace DoorClosedEvents { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DoorClosedEvents + +namespace OpenPeriod { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OpenPeriod + +namespace NumberOfTotalUsersSupported { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfTotalUsersSupported + +namespace NumberOfPINUsersSupported { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfPINUsersSupported + +namespace NumberOfRFIDUsersSupported { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfRFIDUsersSupported + +namespace NumberOfWeekDaySchedulesSupportedPerUser { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfWeekDaySchedulesSupportedPerUser + +namespace NumberOfYearDaySchedulesSupportedPerUser { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfYearDaySchedulesSupportedPerUser + +namespace NumberOfHolidaySchedulesSupported { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfHolidaySchedulesSupported + +namespace MaxPINCodeLength { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxPINCodeLength + +namespace MinPINCodeLength { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinPINCodeLength + +namespace MaxRFIDCodeLength { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxRFIDCodeLength + +namespace MinRFIDCodeLength { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinRFIDCodeLength + +namespace CredentialRulesSupport { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CredentialRulesSupport + +namespace NumberOfCredentialsSupportedPerUser { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfCredentialsSupportedPerUser + +namespace Language { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Language + +namespace LEDSettings { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LEDSettings + +namespace AutoRelockTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AutoRelockTime + +namespace SoundVolume { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SoundVolume + +namespace OperatingMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::DoorLock::DlOperatingMode& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::DoorLock::DlOperatingMode& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OperatingMode + +namespace SupportedOperatingModes { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SupportedOperatingModes + +namespace DefaultConfigurationRegister { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DefaultConfigurationRegister + +namespace EnableLocalProgramming { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace EnableLocalProgramming + +namespace EnableOneTouchLocking { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace EnableOneTouchLocking + +namespace EnableInsideStatusLED { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace EnableInsideStatusLED + +namespace EnablePrivacyModeButton { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace EnablePrivacyModeButton + +namespace LocalProgrammingFeatures { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LocalProgrammingFeatures + +namespace WrongCodeEntryLimit { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WrongCodeEntryLimit + +namespace UserCodeTemporaryDisableTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UserCodeTemporaryDisableTime + +namespace SendPINOverTheAir { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SendPINOverTheAir + +namespace RequirePINforRemoteOperation { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RequirePINforRemoteOperation + +namespace ExpiringUserTimeout { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ExpiringUserTimeout + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // DoorLock + +namespace WindowCovering { +namespace Attributes { + +namespace Type { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::WindowCovering::Type& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::WindowCovering::Type& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Type + +namespace PhysicalClosedLimitLift { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PhysicalClosedLimitLift + +namespace PhysicalClosedLimitTilt { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PhysicalClosedLimitTilt + +namespace CurrentPositionLift { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentPositionLift + +namespace CurrentPositionTilt { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentPositionTilt + +namespace NumberOfActuationsLift { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfActuationsLift + +namespace NumberOfActuationsTilt { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfActuationsTilt + +namespace ConfigStatus { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ConfigStatus + +namespace CurrentPositionLiftPercentage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentPositionLiftPercentage + +namespace CurrentPositionTiltPercentage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentPositionTiltPercentage + +namespace OperationalStatus { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OperationalStatus + +namespace TargetPositionLiftPercent100ths { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TargetPositionLiftPercent100ths + +namespace TargetPositionTiltPercent100ths { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TargetPositionTiltPercent100ths + +namespace EndProductType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::WindowCovering::EndProductType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::WindowCovering::EndProductType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace EndProductType + +namespace CurrentPositionLiftPercent100ths { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentPositionLiftPercent100ths + +namespace CurrentPositionTiltPercent100ths { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentPositionTiltPercent100ths + +namespace InstalledOpenLimitLift { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace InstalledOpenLimitLift + +namespace InstalledClosedLimitLift { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace InstalledClosedLimitLift + +namespace InstalledOpenLimitTilt { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace InstalledOpenLimitTilt + +namespace InstalledClosedLimitTilt { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace InstalledClosedLimitTilt + +namespace Mode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Mode + +namespace SafetyStatus { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SafetyStatus + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // WindowCovering + +namespace BarrierControl { +namespace Attributes { + +namespace BarrierMovingState { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BarrierMovingState + +namespace BarrierSafetyStatus { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BarrierSafetyStatus + +namespace BarrierCapabilities { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BarrierCapabilities + +namespace BarrierOpenEvents { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BarrierOpenEvents + +namespace BarrierCloseEvents { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BarrierCloseEvents + +namespace BarrierCommandOpenEvents { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BarrierCommandOpenEvents + +namespace BarrierCommandCloseEvents { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BarrierCommandCloseEvents + +namespace BarrierOpenPeriod { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BarrierOpenPeriod + +namespace BarrierClosePeriod { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BarrierClosePeriod + +namespace BarrierPosition { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BarrierPosition + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // BarrierControl + +namespace PumpConfigurationAndControl { +namespace Attributes { + +namespace MaxPressure { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxPressure + +namespace MaxSpeed { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxSpeed + +namespace MaxFlow { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxFlow + +namespace MinConstPressure { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinConstPressure + +namespace MaxConstPressure { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxConstPressure + +namespace MinCompPressure { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinCompPressure + +namespace MaxCompPressure { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxCompPressure + +namespace MinConstSpeed { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinConstSpeed + +namespace MaxConstSpeed { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxConstSpeed + +namespace MinConstFlow { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinConstFlow + +namespace MaxConstFlow { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxConstFlow + +namespace MinConstTemp { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinConstTemp + +namespace MaxConstTemp { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxConstTemp + +namespace PumpStatus { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PumpStatus + +namespace EffectiveOperationMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace EffectiveOperationMode + +namespace EffectiveControlMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace EffectiveControlMode + +namespace Capacity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Capacity + +namespace Speed { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Speed + +namespace LifetimeRunningHours { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LifetimeRunningHours + +namespace Power { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Power + +namespace LifetimeEnergyConsumed { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LifetimeEnergyConsumed + +namespace OperationMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OperationMode + +namespace ControlMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ControlMode + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // PumpConfigurationAndControl + +namespace Thermostat { +namespace Attributes { + +namespace LocalTemperature { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LocalTemperature + +namespace OutdoorTemperature { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OutdoorTemperature + +namespace Occupancy { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Occupancy + +namespace AbsMinHeatSetpointLimit { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AbsMinHeatSetpointLimit + +namespace AbsMaxHeatSetpointLimit { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AbsMaxHeatSetpointLimit + +namespace AbsMinCoolSetpointLimit { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AbsMinCoolSetpointLimit + +namespace AbsMaxCoolSetpointLimit { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AbsMaxCoolSetpointLimit + +namespace PICoolingDemand { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PICoolingDemand + +namespace PIHeatingDemand { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PIHeatingDemand + +namespace HVACSystemTypeConfiguration { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace HVACSystemTypeConfiguration + +namespace LocalTemperatureCalibration { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LocalTemperatureCalibration + +namespace OccupiedCoolingSetpoint { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OccupiedCoolingSetpoint + +namespace OccupiedHeatingSetpoint { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OccupiedHeatingSetpoint + +namespace UnoccupiedCoolingSetpoint { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UnoccupiedCoolingSetpoint + +namespace UnoccupiedHeatingSetpoint { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UnoccupiedHeatingSetpoint + +namespace MinHeatSetpointLimit { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinHeatSetpointLimit + +namespace MaxHeatSetpointLimit { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxHeatSetpointLimit + +namespace MinCoolSetpointLimit { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinCoolSetpointLimit + +namespace MaxCoolSetpointLimit { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxCoolSetpointLimit + +namespace MinSetpointDeadBand { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinSetpointDeadBand + +namespace RemoteSensing { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RemoteSensing + +namespace ControlSequenceOfOperation { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::Thermostat::ThermostatControlSequence& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::Thermostat::ThermostatControlSequence& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ControlSequenceOfOperation + +namespace SystemMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SystemMode + +namespace ThermostatRunningMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ThermostatRunningMode + +namespace StartOfWeek { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace StartOfWeek + +namespace NumberOfWeeklyTransitions { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfWeeklyTransitions + +namespace NumberOfDailyTransitions { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfDailyTransitions + +namespace TemperatureSetpointHold { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TemperatureSetpointHold + +namespace TemperatureSetpointHoldDuration { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TemperatureSetpointHoldDuration + +namespace ThermostatProgrammingOperationMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ThermostatProgrammingOperationMode + +namespace ThermostatRunningState { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ThermostatRunningState + +namespace SetpointChangeSource { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SetpointChangeSource + +namespace SetpointChangeAmount { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SetpointChangeAmount + +namespace SetpointChangeSourceTimestamp { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SetpointChangeSourceTimestamp + +namespace OccupiedSetback { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OccupiedSetback + +namespace OccupiedSetbackMin { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OccupiedSetbackMin + +namespace OccupiedSetbackMax { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OccupiedSetbackMax + +namespace UnoccupiedSetback { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UnoccupiedSetback + +namespace UnoccupiedSetbackMin { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UnoccupiedSetbackMin + +namespace UnoccupiedSetbackMax { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UnoccupiedSetbackMax + +namespace EmergencyHeatDelta { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace EmergencyHeatDelta + +namespace ACType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ACType + +namespace ACCapacity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ACCapacity + +namespace ACRefrigerantType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ACRefrigerantType + +namespace ACCompressorType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ACCompressorType + +namespace ACErrorCode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ACErrorCode + +namespace ACLouverPosition { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ACLouverPosition + +namespace ACCoilTemperature { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ACCoilTemperature + +namespace ACCapacityformat { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ACCapacityformat + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // Thermostat + +namespace FanControl { +namespace Attributes { + +namespace FanMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::FanControl::FanModeType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::FanControl::FanModeType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FanMode + +namespace FanModeSequence { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::FanControl::FanModeSequenceType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::FanControl::FanModeSequenceType& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FanModeSequence + +namespace PercentSetting { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PercentSetting + +namespace PercentCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PercentCurrent + +namespace SpeedMax { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SpeedMax + +namespace SpeedSetting { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SpeedSetting + +namespace SpeedCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SpeedCurrent + +namespace RockSupport { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RockSupport + +namespace RockSetting { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RockSetting + +namespace WindSupport { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WindSupport + +namespace WindSetting { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WindSetting + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // FanControl + +namespace ThermostatUserInterfaceConfiguration { +namespace Attributes { + +namespace TemperatureDisplayMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TemperatureDisplayMode + +namespace KeypadLockout { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace KeypadLockout + +namespace ScheduleProgrammingVisibility { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ScheduleProgrammingVisibility + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // ThermostatUserInterfaceConfiguration + +namespace ColorControl { +namespace Attributes { + +namespace CurrentHue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentHue + +namespace CurrentSaturation { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentSaturation + +namespace RemainingTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RemainingTime + +namespace CurrentX { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentX + +namespace CurrentY { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentY + +namespace DriftCompensation { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DriftCompensation + +namespace CompensationText { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CompensationText + +namespace ColorTemperatureMireds { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorTemperatureMireds + +namespace ColorMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorMode + +namespace Options { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Options + +namespace NumberOfPrimaries { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NumberOfPrimaries + +namespace Primary1X { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary1X + +namespace Primary1Y { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary1Y + +namespace Primary1Intensity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary1Intensity + +namespace Primary2X { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary2X + +namespace Primary2Y { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary2Y + +namespace Primary2Intensity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary2Intensity + +namespace Primary3X { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary3X + +namespace Primary3Y { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary3Y + +namespace Primary3Intensity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary3Intensity + +namespace Primary4X { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary4X + +namespace Primary4Y { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary4Y + +namespace Primary4Intensity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary4Intensity + +namespace Primary5X { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary5X + +namespace Primary5Y { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary5Y + +namespace Primary5Intensity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary5Intensity + +namespace Primary6X { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary6X + +namespace Primary6Y { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary6Y + +namespace Primary6Intensity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Primary6Intensity + +namespace WhitePointX { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WhitePointX + +namespace WhitePointY { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace WhitePointY + +namespace ColorPointRX { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorPointRX + +namespace ColorPointRY { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorPointRY + +namespace ColorPointRIntensity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorPointRIntensity + +namespace ColorPointGX { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorPointGX + +namespace ColorPointGY { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorPointGY + +namespace ColorPointGIntensity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorPointGIntensity + +namespace ColorPointBX { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorPointBX + +namespace ColorPointBY { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorPointBY + +namespace ColorPointBIntensity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorPointBIntensity + +namespace EnhancedCurrentHue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace EnhancedCurrentHue + +namespace EnhancedColorMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace EnhancedColorMode + +namespace ColorLoopActive { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorLoopActive + +namespace ColorLoopDirection { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorLoopDirection + +namespace ColorLoopTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorLoopTime + +namespace ColorLoopStartEnhancedHue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorLoopStartEnhancedHue + +namespace ColorLoopStoredEnhancedHue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorLoopStoredEnhancedHue + +namespace ColorCapabilities { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorCapabilities + +namespace ColorTempPhysicalMinMireds { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorTempPhysicalMinMireds + +namespace ColorTempPhysicalMaxMireds { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ColorTempPhysicalMaxMireds + +namespace CoupleColorTempToLevelMinMireds { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CoupleColorTempToLevelMinMireds + +namespace StartUpColorTemperatureMireds { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace StartUpColorTemperatureMireds + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // ColorControl + +namespace BallastConfiguration { +namespace Attributes { + +namespace PhysicalMinLevel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PhysicalMinLevel + +namespace PhysicalMaxLevel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PhysicalMaxLevel + +namespace BallastStatus { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BallastStatus + +namespace MinLevel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinLevel + +namespace MaxLevel { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxLevel + +namespace IntrinsicBalanceFactor { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace IntrinsicBalanceFactor + +namespace BallastFactorAdjustment { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace BallastFactorAdjustment + +namespace LampQuantity { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LampQuantity + +namespace LampType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LampType + +namespace LampManufacturer { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LampManufacturer + +namespace LampRatedHours { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LampRatedHours + +namespace LampBurnHours { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LampBurnHours + +namespace LampAlarmMode { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LampAlarmMode + +namespace LampBurnHoursTripPoint { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits>; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LampBurnHoursTripPoint + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // BallastConfiguration + +namespace IlluminanceMeasurement { +namespace Attributes { + +namespace MeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasuredValue + +namespace MinMeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinMeasuredValue + +namespace MaxMeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxMeasuredValue + +namespace Tolerance { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Tolerance + +namespace LightSensorType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LightSensorType + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // IlluminanceMeasurement + +namespace TemperatureMeasurement { +namespace Attributes { + +namespace MeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasuredValue + +namespace MinMeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinMeasuredValue + +namespace MaxMeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxMeasuredValue + +namespace Tolerance { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Tolerance + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // TemperatureMeasurement + +namespace PressureMeasurement { +namespace Attributes { + +namespace MeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasuredValue + +namespace MinMeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinMeasuredValue + +namespace MaxMeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxMeasuredValue + +namespace Tolerance { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Tolerance + +namespace ScaledValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ScaledValue + +namespace MinScaledValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinScaledValue + +namespace MaxScaledValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxScaledValue + +namespace ScaledTolerance { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ScaledTolerance + +namespace Scale { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Scale + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // PressureMeasurement + +namespace FlowMeasurement { +namespace Attributes { + +namespace MeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasuredValue + +namespace MinMeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinMeasuredValue + +namespace MaxMeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxMeasuredValue + +namespace Tolerance { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Tolerance + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // FlowMeasurement + +namespace RelativeHumidityMeasurement { +namespace Attributes { + +namespace MeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasuredValue + +namespace MinMeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MinMeasuredValue + +namespace MaxMeasuredValue { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MaxMeasuredValue + +namespace Tolerance { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Tolerance + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // RelativeHumidityMeasurement + +namespace OccupancySensing { +namespace Attributes { + +namespace Occupancy { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Occupancy + +namespace OccupancySensorType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OccupancySensorType + +namespace OccupancySensorTypeBitmap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OccupancySensorTypeBitmap + +namespace PirOccupiedToUnoccupiedDelay { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PirOccupiedToUnoccupiedDelay + +namespace PirUnoccupiedToOccupiedDelay { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PirUnoccupiedToOccupiedDelay + +namespace PirUnoccupiedToOccupiedThreshold { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PirUnoccupiedToOccupiedThreshold + +namespace UltrasonicOccupiedToUnoccupiedDelay { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UltrasonicOccupiedToUnoccupiedDelay + +namespace UltrasonicUnoccupiedToOccupiedDelay { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UltrasonicUnoccupiedToOccupiedDelay + +namespace UltrasonicUnoccupiedToOccupiedThreshold { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace UltrasonicUnoccupiedToOccupiedThreshold + +namespace PhysicalContactOccupiedToUnoccupiedDelay { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PhysicalContactOccupiedToUnoccupiedDelay + +namespace PhysicalContactUnoccupiedToOccupiedDelay { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PhysicalContactUnoccupiedToOccupiedDelay + +namespace PhysicalContactUnoccupiedToOccupiedThreshold { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PhysicalContactUnoccupiedToOccupiedThreshold + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // OccupancySensing + +namespace WakeOnLan { +namespace Attributes { + +namespace MACAddress { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MACAddress + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // WakeOnLan + +namespace Channel { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // Channel + +namespace TargetNavigator { +namespace Attributes { + +namespace CurrentTarget { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentTarget + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // TargetNavigator + +namespace MediaPlayback { +namespace Attributes { + +namespace CurrentState { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::MediaPlayback::PlaybackStateEnum& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::MediaPlayback::PlaybackStateEnum& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentState + +namespace StartTime { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace StartTime + +namespace Duration { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Duration + +namespace PlaybackSpeed { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, float& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const float& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PlaybackSpeed + +namespace SeekRangeEnd { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SeekRangeEnd + +namespace SeekRangeStart { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value.SetNonNull(tmp); + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SeekRangeStart + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // MediaPlayback + +namespace MediaInput { +namespace Attributes { + +namespace CurrentInput { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentInput + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // MediaInput + +namespace LowPower { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // LowPower + +namespace KeypadInput { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // KeypadInput + +namespace ContentLauncher { +namespace Attributes { + +namespace SupportedStreamingProtocols { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace SupportedStreamingProtocols + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // ContentLauncher + +namespace AudioOutput { +namespace Attributes { + +namespace CurrentOutput { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentOutput + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // AudioOutput + +namespace ApplicationLauncher { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // ApplicationLauncher + +namespace ApplicationBasic { +namespace Attributes { + +namespace VendorName { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace VendorName + +namespace VendorID { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::VendorId& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::VendorId& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace VendorID + +namespace ApplicationName { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ApplicationName + +namespace ProductID { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ProductID + +namespace Status { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Status + +namespace ApplicationVersion { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); cache.set(endpoint,value); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ApplicationVersion + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // ApplicationBasic + +namespace AccountLogin { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // AccountLogin + +namespace ElectricalMeasurement { +namespace Attributes { + +namespace MeasurementType { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasurementType + +namespace DcVoltage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcVoltage + +namespace DcVoltageMin { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcVoltageMin + +namespace DcVoltageMax { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcVoltageMax + +namespace DcCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcCurrent + +namespace DcCurrentMin { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcCurrentMin + +namespace DcCurrentMax { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcCurrentMax + +namespace DcPower { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcPower + +namespace DcPowerMin { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcPowerMin + +namespace DcPowerMax { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcPowerMax + +namespace DcVoltageMultiplier { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcVoltageMultiplier + +namespace DcVoltageDivisor { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcVoltageDivisor + +namespace DcCurrentMultiplier { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcCurrentMultiplier + +namespace DcCurrentDivisor { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcCurrentDivisor + +namespace DcPowerMultiplier { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcPowerMultiplier + +namespace DcPowerDivisor { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace DcPowerDivisor + +namespace AcFrequency { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcFrequency + +namespace AcFrequencyMin { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcFrequencyMin + +namespace AcFrequencyMax { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcFrequencyMax + +namespace NeutralCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace NeutralCurrent + +namespace TotalActivePower { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TotalActivePower + +namespace TotalReactivePower { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TotalReactivePower + +namespace TotalApparentPower { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace TotalApparentPower + +namespace Measured1stHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Measured1stHarmonicCurrent + +namespace Measured3rdHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Measured3rdHarmonicCurrent + +namespace Measured5thHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Measured5thHarmonicCurrent + +namespace Measured7thHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Measured7thHarmonicCurrent + +namespace Measured9thHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Measured9thHarmonicCurrent + +namespace Measured11thHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace Measured11thHarmonicCurrent + +namespace MeasuredPhase1stHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasuredPhase1stHarmonicCurrent + +namespace MeasuredPhase3rdHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasuredPhase3rdHarmonicCurrent + +namespace MeasuredPhase5thHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasuredPhase5thHarmonicCurrent + +namespace MeasuredPhase7thHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasuredPhase7thHarmonicCurrent + +namespace MeasuredPhase9thHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasuredPhase9thHarmonicCurrent + +namespace MeasuredPhase11thHarmonicCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace MeasuredPhase11thHarmonicCurrent + +namespace AcFrequencyMultiplier { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcFrequencyMultiplier + +namespace AcFrequencyDivisor { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcFrequencyDivisor + +namespace PowerMultiplier { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PowerMultiplier + +namespace PowerDivisor { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PowerDivisor + +namespace HarmonicCurrentMultiplier { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace HarmonicCurrentMultiplier + +namespace PhaseHarmonicCurrentMultiplier { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PhaseHarmonicCurrentMultiplier + +namespace InstantaneousVoltage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace InstantaneousVoltage + +namespace InstantaneousLineCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace InstantaneousLineCurrent + +namespace InstantaneousActiveCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace InstantaneousActiveCurrent + +namespace InstantaneousReactiveCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace InstantaneousReactiveCurrent + +namespace InstantaneousPower { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace InstantaneousPower + +namespace RmsVoltage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltage + +namespace RmsVoltageMin { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageMin + +namespace RmsVoltageMax { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageMax + +namespace RmsCurrent { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsCurrent + +namespace RmsCurrentMin { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsCurrentMin + +namespace RmsCurrentMax { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsCurrentMax + +namespace ActivePower { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActivePower + +namespace ActivePowerMin { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActivePowerMin + +namespace ActivePowerMax { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActivePowerMax + +namespace ReactivePower { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ReactivePower + +namespace ApparentPower { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ApparentPower + +namespace PowerFactor { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PowerFactor + +namespace AverageRmsVoltageMeasurementPeriod { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AverageRmsVoltageMeasurementPeriod + +namespace AverageRmsUnderVoltageCounter { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AverageRmsUnderVoltageCounter + +namespace RmsExtremeOverVoltagePeriod { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsExtremeOverVoltagePeriod + +namespace RmsExtremeUnderVoltagePeriod { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsExtremeUnderVoltagePeriod + +namespace RmsVoltageSagPeriod { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageSagPeriod + +namespace RmsVoltageSwellPeriod { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageSwellPeriod + +namespace AcVoltageMultiplier { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcVoltageMultiplier + +namespace AcVoltageDivisor { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcVoltageDivisor + +namespace AcCurrentMultiplier { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcCurrentMultiplier + +namespace AcCurrentDivisor { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcCurrentDivisor + +namespace AcPowerMultiplier { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcPowerMultiplier + +namespace AcPowerDivisor { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcPowerDivisor + +namespace OverloadAlarmsMask { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace OverloadAlarmsMask + +namespace VoltageOverload { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace VoltageOverload + +namespace CurrentOverload { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace CurrentOverload + +namespace AcOverloadAlarmsMask { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcOverloadAlarmsMask + +namespace AcVoltageOverload { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcVoltageOverload + +namespace AcCurrentOverload { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcCurrentOverload + +namespace AcActivePowerOverload { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcActivePowerOverload + +namespace AcReactivePowerOverload { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AcReactivePowerOverload + +namespace AverageRmsOverVoltage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AverageRmsOverVoltage + +namespace AverageRmsUnderVoltage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AverageRmsUnderVoltage + +namespace RmsExtremeOverVoltage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsExtremeOverVoltage + +namespace RmsExtremeUnderVoltage { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsExtremeUnderVoltage + +namespace RmsVoltageSag { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageSag + +namespace RmsVoltageSwell { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageSwell + +namespace LineCurrentPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LineCurrentPhaseB + +namespace ActiveCurrentPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActiveCurrentPhaseB + +namespace ReactiveCurrentPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ReactiveCurrentPhaseB + +namespace RmsVoltagePhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltagePhaseB + +namespace RmsVoltageMinPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageMinPhaseB + +namespace RmsVoltageMaxPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageMaxPhaseB + +namespace RmsCurrentPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsCurrentPhaseB + +namespace RmsCurrentMinPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsCurrentMinPhaseB + +namespace RmsCurrentMaxPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsCurrentMaxPhaseB + +namespace ActivePowerPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActivePowerPhaseB + +namespace ActivePowerMinPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActivePowerMinPhaseB + +namespace ActivePowerMaxPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActivePowerMaxPhaseB + +namespace ReactivePowerPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ReactivePowerPhaseB + +namespace ApparentPowerPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ApparentPowerPhaseB + +namespace PowerFactorPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PowerFactorPhaseB + +namespace AverageRmsVoltageMeasurementPeriodPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AverageRmsVoltageMeasurementPeriodPhaseB + +namespace AverageRmsOverVoltageCounterPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AverageRmsOverVoltageCounterPhaseB + +namespace AverageRmsUnderVoltageCounterPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AverageRmsUnderVoltageCounterPhaseB + +namespace RmsExtremeOverVoltagePeriodPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsExtremeOverVoltagePeriodPhaseB + +namespace RmsExtremeUnderVoltagePeriodPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsExtremeUnderVoltagePeriodPhaseB + +namespace RmsVoltageSagPeriodPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageSagPeriodPhaseB + +namespace RmsVoltageSwellPeriodPhaseB { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageSwellPeriodPhaseB + +namespace LineCurrentPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace LineCurrentPhaseC + +namespace ActiveCurrentPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActiveCurrentPhaseC + +namespace ReactiveCurrentPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ReactiveCurrentPhaseC + +namespace RmsVoltagePhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltagePhaseC + +namespace RmsVoltageMinPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageMinPhaseC + +namespace RmsVoltageMaxPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageMaxPhaseC + +namespace RmsCurrentPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsCurrentPhaseC + +namespace RmsCurrentMinPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsCurrentMinPhaseC + +namespace RmsCurrentMaxPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsCurrentMaxPhaseC + +namespace ActivePowerPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActivePowerPhaseC + +namespace ActivePowerMinPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActivePowerMinPhaseC + +namespace ActivePowerMaxPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ActivePowerMaxPhaseC + +namespace ReactivePowerPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ReactivePowerPhaseC + +namespace ApparentPowerPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ApparentPowerPhaseC + +namespace PowerFactorPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace PowerFactorPhaseC + +namespace AverageRmsVoltageMeasurementPeriodPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AverageRmsVoltageMeasurementPeriodPhaseC + +namespace AverageRmsOverVoltageCounterPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AverageRmsOverVoltageCounterPhaseC + +namespace AverageRmsUnderVoltageCounterPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace AverageRmsUnderVoltageCounterPhaseC + +namespace RmsExtremeOverVoltagePeriodPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsExtremeOverVoltagePeriodPhaseC + +namespace RmsExtremeUnderVoltagePeriodPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsExtremeUnderVoltagePeriodPhaseC + +namespace RmsVoltageSagPeriodPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageSagPeriodPhaseC + +namespace RmsVoltageSwellPeriodPhaseC { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace RmsVoltageSwellPeriodPhaseC + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // ElectricalMeasurement + +namespace FaultInjection { +namespace Attributes { + +namespace FeatureMap { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace FeatureMap + +namespace ClusterRevision { + + + + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + value = tmp; + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); using Traits = NumericAttributeTraits; + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + cache.set(endpoint,storageValue); + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace ClusterRevision + +} // namespace Attributes +} // FaultInjection + + +} // matter_bridge +} // unify diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/unify_accessors.hpp b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/unify_accessors.hpp new file mode 100644 index 00000000000000..e8e87b0c0c2520 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/gen/unify_accessors.hpp @@ -0,0 +1,4720 @@ + +/** + * @file + * This file contains declarations for accessors around clusters attributes. + */ + +#pragma once + +#include +#include +#include +#include + +namespace unify { +namespace matter_bridge { + +namespace Identify { +namespace Attributes { + +namespace IdentifyTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace IdentifyTime + +namespace IdentifyType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace IdentifyType + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // Identify + +namespace Groups { +namespace Attributes { + +namespace NameSupport { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace NameSupport + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // Groups + +namespace Scenes { +namespace Attributes { + +namespace SceneCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace SceneCount + +namespace CurrentScene { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace CurrentScene + +namespace CurrentGroup { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::GroupId& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::GroupId& value); +} // namespace CurrentGroup + +namespace SceneValid { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace SceneValid + +namespace NameSupport { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace NameSupport + +namespace LastConfiguredBy { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LastConfiguredBy + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // Scenes + +namespace OnOff { +namespace Attributes { + +namespace OnOff { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace OnOff + +namespace GlobalSceneControl { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace GlobalSceneControl + +namespace OnTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace OnTime + +namespace OffWaitTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace OffWaitTime + +namespace StartUpOnOff { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace StartUpOnOff + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // OnOff + +namespace OnOffSwitchConfiguration { +namespace Attributes { + +namespace SwitchType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace SwitchType + +namespace SwitchActions { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace SwitchActions + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // OnOffSwitchConfiguration + +namespace LevelControl { +namespace Attributes { + +namespace CurrentLevel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace CurrentLevel + +namespace RemainingTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RemainingTime + +namespace MinLevel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace MinLevel + +namespace MaxLevel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace MaxLevel + +namespace CurrentFrequency { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace CurrentFrequency + +namespace MinFrequency { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace MinFrequency + +namespace MaxFrequency { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace MaxFrequency + +namespace Options { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace Options + +namespace OnOffTransitionTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace OnOffTransitionTime + +namespace OnLevel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace OnLevel + +namespace OnTransitionTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace OnTransitionTime + +namespace OffTransitionTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace OffTransitionTime + +namespace DefaultMoveRate { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace DefaultMoveRate + +namespace StartUpCurrentLevel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace StartUpCurrentLevel + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // LevelControl + +namespace BinaryInputBasic { +namespace Attributes { + +namespace ActiveText { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ActiveText + +namespace Description { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace Description + +namespace InactiveText { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace InactiveText + +namespace OutOfService { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace OutOfService + +namespace Polarity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace Polarity + +namespace PresentValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace PresentValue + +namespace Reliability { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace Reliability + +namespace StatusFlags { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace StatusFlags + +namespace ApplicationType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace ApplicationType + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // BinaryInputBasic + +namespace PulseWidthModulation { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // PulseWidthModulation + +namespace Descriptor { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // Descriptor + +namespace Binding { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // Binding + +namespace AccessControl { +namespace Attributes { + +namespace SubjectsPerAccessControlEntry { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace SubjectsPerAccessControlEntry + +namespace TargetsPerAccessControlEntry { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace TargetsPerAccessControlEntry + +namespace AccessControlEntriesPerFabric { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AccessControlEntriesPerFabric + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // AccessControl + +namespace Actions { +namespace Attributes { + +namespace SetupURL { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace SetupURL + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // Actions + +namespace Basic { +namespace Attributes { + +namespace DataModelRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace DataModelRevision + +namespace VendorName { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace VendorName + +namespace VendorID { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::VendorId& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::VendorId& value); +} // namespace VendorID + +namespace ProductName { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ProductName + +namespace ProductID { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ProductID + +namespace NodeLabel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace NodeLabel + +namespace Location { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace Location + +namespace HardwareVersion { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace HardwareVersion + +namespace HardwareVersionString { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace HardwareVersionString + +namespace SoftwareVersion { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace SoftwareVersion + +namespace SoftwareVersionString { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace SoftwareVersionString + +namespace ManufacturingDate { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ManufacturingDate + +namespace PartNumber { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace PartNumber + +namespace ProductURL { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ProductURL + +namespace ProductLabel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ProductLabel + +namespace SerialNumber { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace SerialNumber + +namespace LocalConfigDisabled { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace LocalConfigDisabled + +namespace Reachable { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace Reachable + +namespace UniqueID { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace UniqueID + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // Basic + +namespace OtaSoftwareUpdateProvider { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // OtaSoftwareUpdateProvider + +namespace OtaSoftwareUpdateRequestor { +namespace Attributes { + +namespace UpdatePossible { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace UpdatePossible + +namespace UpdateState { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum& value); +} // namespace UpdateState + +namespace UpdateStateProgress { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace UpdateStateProgress + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // OtaSoftwareUpdateRequestor + +namespace LocalizationConfiguration { +namespace Attributes { + +namespace ActiveLocale { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ActiveLocale + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // LocalizationConfiguration + +namespace TimeFormatLocalization { +namespace Attributes { + +namespace HourFormat { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::TimeFormatLocalization::HourFormat& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::TimeFormatLocalization::HourFormat& value); +} // namespace HourFormat + +namespace ActiveCalendarType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::TimeFormatLocalization::CalendarType& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::TimeFormatLocalization::CalendarType& value); +} // namespace ActiveCalendarType + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // TimeFormatLocalization + +namespace UnitLocalization { +namespace Attributes { + +namespace TemperatureUnit { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::UnitLocalization::TempUnit& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::UnitLocalization::TempUnit& value); +} // namespace TemperatureUnit + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // UnitLocalization + +namespace PowerSourceConfiguration { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // PowerSourceConfiguration + +namespace PowerSource { +namespace Attributes { + +namespace Status { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PowerSource::PowerSourceStatus& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PowerSource::PowerSourceStatus& value); +} // namespace Status + +namespace Order { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace Order + +namespace Description { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace Description + +namespace WiredAssessedInputVoltage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace WiredAssessedInputVoltage + +namespace WiredAssessedInputFrequency { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace WiredAssessedInputFrequency + +namespace WiredCurrentType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PowerSource::WiredCurrentType& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PowerSource::WiredCurrentType& value); +} // namespace WiredCurrentType + +namespace WiredAssessedCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace WiredAssessedCurrent + +namespace WiredNominalVoltage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace WiredNominalVoltage + +namespace WiredMaximumCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace WiredMaximumCurrent + +namespace WiredPresent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace WiredPresent + +namespace BatVoltage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace BatVoltage + +namespace BatPercentRemaining { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace BatPercentRemaining + +namespace BatTimeRemaining { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace BatTimeRemaining + +namespace BatChargeLevel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PowerSource::BatChargeLevel& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PowerSource::BatChargeLevel& value); +} // namespace BatChargeLevel + +namespace BatReplacementNeeded { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace BatReplacementNeeded + +namespace BatReplaceability { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PowerSource::BatReplaceability& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PowerSource::BatReplaceability& value); +} // namespace BatReplaceability + +namespace BatPresent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace BatPresent + +namespace BatReplacementDescription { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace BatReplacementDescription + +namespace BatCommonDesignation { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace BatCommonDesignation + +namespace BatANSIDesignation { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace BatANSIDesignation + +namespace BatIECDesignation { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace BatIECDesignation + +namespace BatApprovedChemistry { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace BatApprovedChemistry + +namespace BatCapacity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace BatCapacity + +namespace BatQuantity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace BatQuantity + +namespace BatChargeState { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PowerSource::BatChargeState& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PowerSource::BatChargeState& value); +} // namespace BatChargeState + +namespace BatTimeToFullCharge { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace BatTimeToFullCharge + +namespace BatFunctionalWhileCharging { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace BatFunctionalWhileCharging + +namespace BatChargingCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace BatChargingCurrent + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // PowerSource + +namespace GeneralCommissioning { +namespace Attributes { + +namespace Breadcrumb { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace Breadcrumb + +namespace RegulatoryConfig { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType& value); +} // namespace RegulatoryConfig + +namespace LocationCapability { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType& value); +} // namespace LocationCapability + +namespace SupportsConcurrentConnection { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace SupportsConcurrentConnection + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // GeneralCommissioning + +namespace NetworkCommissioning { +namespace Attributes { + +namespace MaxNetworks { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace MaxNetworks + +namespace ScanMaxTimeSeconds { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ScanMaxTimeSeconds + +namespace ConnectMaxTimeSeconds { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ConnectMaxTimeSeconds + +namespace InterfaceEnabled { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace InterfaceEnabled + +namespace LastNetworkingStatus { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LastNetworkingStatus + +namespace LastNetworkID { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LastNetworkID + +namespace LastConnectErrorValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LastConnectErrorValue + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // NetworkCommissioning + +namespace DiagnosticLogs { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // DiagnosticLogs + +namespace GeneralDiagnostics { +namespace Attributes { + +namespace RebootCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RebootCount + +namespace UpTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace UpTime + +namespace TotalOperationalHours { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TotalOperationalHours + +namespace BootReasons { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace BootReasons + +namespace TestEventTriggersEnabled { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace TestEventTriggersEnabled + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // GeneralDiagnostics + +namespace SoftwareDiagnostics { +namespace Attributes { + +namespace CurrentHeapFree { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace CurrentHeapFree + +namespace CurrentHeapUsed { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace CurrentHeapUsed + +namespace CurrentHeapHighWatermark { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace CurrentHeapHighWatermark + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // SoftwareDiagnostics + +namespace ThreadNetworkDiagnostics { +namespace Attributes { + +namespace Channel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Channel + +namespace RoutingRole { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace RoutingRole + +namespace NetworkName { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NetworkName + +namespace PanId { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace PanId + +namespace ExtendedPanId { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace ExtendedPanId + +namespace MeshLocalPrefix { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MeshLocalPrefix + +namespace OverrunCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace OverrunCount + +namespace PartitionId { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace PartitionId + +namespace Weighting { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Weighting + +namespace DataVersion { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace DataVersion + +namespace StableDataVersion { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace StableDataVersion + +namespace LeaderRouterId { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LeaderRouterId + +namespace DetachedRoleCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace DetachedRoleCount + +namespace ChildRoleCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ChildRoleCount + +namespace RouterRoleCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RouterRoleCount + +namespace LeaderRoleCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace LeaderRoleCount + +namespace AttachAttemptCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AttachAttemptCount + +namespace PartitionIdChangeCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace PartitionIdChangeCount + +namespace BetterPartitionAttachAttemptCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace BetterPartitionAttachAttemptCount + +namespace ParentChangeCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ParentChangeCount + +namespace TxTotalCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxTotalCount + +namespace TxUnicastCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxUnicastCount + +namespace TxBroadcastCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxBroadcastCount + +namespace TxAckRequestedCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxAckRequestedCount + +namespace TxAckedCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxAckedCount + +namespace TxNoAckRequestedCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxNoAckRequestedCount + +namespace TxDataCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxDataCount + +namespace TxDataPollCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxDataPollCount + +namespace TxBeaconCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxBeaconCount + +namespace TxBeaconRequestCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxBeaconRequestCount + +namespace TxOtherCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxOtherCount + +namespace TxRetryCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxRetryCount + +namespace TxDirectMaxRetryExpiryCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxDirectMaxRetryExpiryCount + +namespace TxIndirectMaxRetryExpiryCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxIndirectMaxRetryExpiryCount + +namespace TxErrCcaCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxErrCcaCount + +namespace TxErrAbortCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxErrAbortCount + +namespace TxErrBusyChannelCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TxErrBusyChannelCount + +namespace RxTotalCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxTotalCount + +namespace RxUnicastCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxUnicastCount + +namespace RxBroadcastCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxBroadcastCount + +namespace RxDataCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxDataCount + +namespace RxDataPollCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxDataPollCount + +namespace RxBeaconCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxBeaconCount + +namespace RxBeaconRequestCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxBeaconRequestCount + +namespace RxOtherCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxOtherCount + +namespace RxAddressFilteredCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxAddressFilteredCount + +namespace RxDestAddrFilteredCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxDestAddrFilteredCount + +namespace RxDuplicatedCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxDuplicatedCount + +namespace RxErrNoFrameCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxErrNoFrameCount + +namespace RxErrUnknownNeighborCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxErrUnknownNeighborCount + +namespace RxErrInvalidSrcAddrCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxErrInvalidSrcAddrCount + +namespace RxErrSecCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxErrSecCount + +namespace RxErrFcsCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxErrFcsCount + +namespace RxErrOtherCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace RxErrOtherCount + +namespace ActiveTimestamp { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace ActiveTimestamp + +namespace PendingTimestamp { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace PendingTimestamp + +namespace Delay { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Delay + +namespace ChannelPage0Mask { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace ChannelPage0Mask + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // ThreadNetworkDiagnostics + +namespace WiFiNetworkDiagnostics { +namespace Attributes { + +namespace Bssid { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Bssid + +namespace SecurityType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace SecurityType + +namespace WiFiVersion { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace WiFiVersion + +namespace ChannelNumber { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace ChannelNumber + +namespace Rssi { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Rssi + +namespace BeaconLostCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace BeaconLostCount + +namespace BeaconRxCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace BeaconRxCount + +namespace PacketMulticastRxCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace PacketMulticastRxCount + +namespace PacketMulticastTxCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace PacketMulticastTxCount + +namespace PacketUnicastRxCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace PacketUnicastRxCount + +namespace PacketUnicastTxCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace PacketUnicastTxCount + +namespace CurrentMaxRate { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace CurrentMaxRate + +namespace OverrunCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace OverrunCount + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // WiFiNetworkDiagnostics + +namespace EthernetNetworkDiagnostics { +namespace Attributes { + +namespace PHYRate { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace PHYRate + +namespace FullDuplex { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace FullDuplex + +namespace PacketRxCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace PacketRxCount + +namespace PacketTxCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace PacketTxCount + +namespace TxErrCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace TxErrCount + +namespace CollisionCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace CollisionCount + +namespace OverrunCount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace OverrunCount + +namespace CarrierDetect { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace CarrierDetect + +namespace TimeSinceReset { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace TimeSinceReset + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // EthernetNetworkDiagnostics + +namespace TimeSynchronization { +namespace Attributes { + +namespace UTCTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace UTCTime + +namespace Granularity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::TimeSynchronization::GranularityEnum& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::TimeSynchronization::GranularityEnum& value); +} // namespace Granularity + +namespace TimeSource { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::TimeSynchronization::TimeSourceEnum& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::TimeSynchronization::TimeSourceEnum& value); +} // namespace TimeSource + +namespace TrustedTimeNodeId { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace TrustedTimeNodeId + +namespace DefaultNtp { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace DefaultNtp + +namespace LocalTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LocalTime + +namespace TimeZoneDatabase { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace TimeZoneDatabase + +namespace NtpServerPort { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NtpServerPort + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // TimeSynchronization + +namespace BridgedDeviceBasic { +namespace Attributes { + +namespace VendorName { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace VendorName + +namespace VendorID { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::VendorId& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::VendorId& value); +} // namespace VendorID + +namespace ProductName { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ProductName + +namespace NodeLabel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace NodeLabel + +namespace HardwareVersion { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace HardwareVersion + +namespace HardwareVersionString { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace HardwareVersionString + +namespace SoftwareVersion { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace SoftwareVersion + +namespace SoftwareVersionString { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace SoftwareVersionString + +namespace ManufacturingDate { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ManufacturingDate + +namespace PartNumber { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace PartNumber + +namespace ProductURL { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ProductURL + +namespace ProductLabel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ProductLabel + +namespace SerialNumber { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace SerialNumber + +namespace Reachable { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace Reachable + +namespace UniqueID { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace UniqueID + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // BridgedDeviceBasic + +namespace Switch { +namespace Attributes { + +namespace NumberOfPositions { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace NumberOfPositions + +namespace CurrentPosition { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace CurrentPosition + +namespace MultiPressMax { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace MultiPressMax + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // Switch + +namespace AdministratorCommissioning { +namespace Attributes { + +namespace WindowStatus { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus& value); +} // namespace WindowStatus + +namespace AdminFabricIndex { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace AdminFabricIndex + +namespace AdminVendorId { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace AdminVendorId + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // AdministratorCommissioning + +namespace OperationalCredentials { +namespace Attributes { + +namespace SupportedFabrics { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace SupportedFabrics + +namespace CommissionedFabrics { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace CommissionedFabrics + +namespace CurrentFabricIndex { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace CurrentFabricIndex + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // OperationalCredentials + +namespace GroupKeyManagement { +namespace Attributes { + +namespace MaxGroupsPerFabric { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace MaxGroupsPerFabric + +namespace MaxGroupKeysPerFabric { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace MaxGroupKeysPerFabric + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // GroupKeyManagement + +namespace FixedLabel { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // FixedLabel + +namespace UserLabel { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // UserLabel + +namespace ProxyConfiguration { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // ProxyConfiguration + +namespace ProxyDiscovery { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // ProxyDiscovery + +namespace ProxyValid { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // ProxyValid + +namespace BooleanState { +namespace Attributes { + +namespace StateValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace StateValue + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // BooleanState + +namespace ModeSelect { +namespace Attributes { + +namespace Description { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace Description + +namespace StandardNamespace { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace StandardNamespace + +namespace CurrentMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace CurrentMode + +namespace StartUpMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace StartUpMode + +namespace OnMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace OnMode + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // ModeSelect + +namespace DoorLock { +namespace Attributes { + +namespace LockState { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LockState + +namespace LockType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::DoorLock::DlLockType& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::DoorLock::DlLockType& value); +} // namespace LockType + +namespace ActuatorEnabled { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace ActuatorEnabled + +namespace DoorState { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace DoorState + +namespace DoorOpenEvents { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace DoorOpenEvents + +namespace DoorClosedEvents { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace DoorClosedEvents + +namespace OpenPeriod { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace OpenPeriod + +namespace NumberOfTotalUsersSupported { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace NumberOfTotalUsersSupported + +namespace NumberOfPINUsersSupported { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace NumberOfPINUsersSupported + +namespace NumberOfRFIDUsersSupported { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace NumberOfRFIDUsersSupported + +namespace NumberOfWeekDaySchedulesSupportedPerUser { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace NumberOfWeekDaySchedulesSupportedPerUser + +namespace NumberOfYearDaySchedulesSupportedPerUser { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace NumberOfYearDaySchedulesSupportedPerUser + +namespace NumberOfHolidaySchedulesSupported { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace NumberOfHolidaySchedulesSupported + +namespace MaxPINCodeLength { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace MaxPINCodeLength + +namespace MinPINCodeLength { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace MinPINCodeLength + +namespace MaxRFIDCodeLength { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace MaxRFIDCodeLength + +namespace MinRFIDCodeLength { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace MinRFIDCodeLength + +namespace CredentialRulesSupport { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace CredentialRulesSupport + +namespace NumberOfCredentialsSupportedPerUser { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace NumberOfCredentialsSupportedPerUser + +namespace Language { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace Language + +namespace LEDSettings { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace LEDSettings + +namespace AutoRelockTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace AutoRelockTime + +namespace SoundVolume { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace SoundVolume + +namespace OperatingMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::DoorLock::DlOperatingMode& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::DoorLock::DlOperatingMode& value); +} // namespace OperatingMode + +namespace SupportedOperatingModes { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace SupportedOperatingModes + +namespace DefaultConfigurationRegister { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace DefaultConfigurationRegister + +namespace EnableLocalProgramming { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace EnableLocalProgramming + +namespace EnableOneTouchLocking { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace EnableOneTouchLocking + +namespace EnableInsideStatusLED { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace EnableInsideStatusLED + +namespace EnablePrivacyModeButton { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace EnablePrivacyModeButton + +namespace LocalProgrammingFeatures { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace LocalProgrammingFeatures + +namespace WrongCodeEntryLimit { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace WrongCodeEntryLimit + +namespace UserCodeTemporaryDisableTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace UserCodeTemporaryDisableTime + +namespace SendPINOverTheAir { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace SendPINOverTheAir + +namespace RequirePINforRemoteOperation { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace RequirePINforRemoteOperation + +namespace ExpiringUserTimeout { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ExpiringUserTimeout + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // DoorLock + +namespace WindowCovering { +namespace Attributes { + +namespace Type { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::WindowCovering::Type& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::WindowCovering::Type& value); +} // namespace Type + +namespace PhysicalClosedLimitLift { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace PhysicalClosedLimitLift + +namespace PhysicalClosedLimitTilt { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace PhysicalClosedLimitTilt + +namespace CurrentPositionLift { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace CurrentPositionLift + +namespace CurrentPositionTilt { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace CurrentPositionTilt + +namespace NumberOfActuationsLift { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace NumberOfActuationsLift + +namespace NumberOfActuationsTilt { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace NumberOfActuationsTilt + +namespace ConfigStatus { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace ConfigStatus + +namespace CurrentPositionLiftPercentage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace CurrentPositionLiftPercentage + +namespace CurrentPositionTiltPercentage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace CurrentPositionTiltPercentage + +namespace OperationalStatus { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace OperationalStatus + +namespace TargetPositionLiftPercent100ths { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace TargetPositionLiftPercent100ths + +namespace TargetPositionTiltPercent100ths { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace TargetPositionTiltPercent100ths + +namespace EndProductType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::WindowCovering::EndProductType& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::WindowCovering::EndProductType& value); +} // namespace EndProductType + +namespace CurrentPositionLiftPercent100ths { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace CurrentPositionLiftPercent100ths + +namespace CurrentPositionTiltPercent100ths { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace CurrentPositionTiltPercent100ths + +namespace InstalledOpenLimitLift { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace InstalledOpenLimitLift + +namespace InstalledClosedLimitLift { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace InstalledClosedLimitLift + +namespace InstalledOpenLimitTilt { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace InstalledOpenLimitTilt + +namespace InstalledClosedLimitTilt { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace InstalledClosedLimitTilt + +namespace Mode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace Mode + +namespace SafetyStatus { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace SafetyStatus + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // WindowCovering + +namespace BarrierControl { +namespace Attributes { + +namespace BarrierMovingState { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace BarrierMovingState + +namespace BarrierSafetyStatus { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace BarrierSafetyStatus + +namespace BarrierCapabilities { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace BarrierCapabilities + +namespace BarrierOpenEvents { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace BarrierOpenEvents + +namespace BarrierCloseEvents { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace BarrierCloseEvents + +namespace BarrierCommandOpenEvents { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace BarrierCommandOpenEvents + +namespace BarrierCommandCloseEvents { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace BarrierCommandCloseEvents + +namespace BarrierOpenPeriod { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace BarrierOpenPeriod + +namespace BarrierClosePeriod { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace BarrierClosePeriod + +namespace BarrierPosition { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace BarrierPosition + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // BarrierControl + +namespace PumpConfigurationAndControl { +namespace Attributes { + +namespace MaxPressure { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxPressure + +namespace MaxSpeed { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxSpeed + +namespace MaxFlow { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxFlow + +namespace MinConstPressure { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MinConstPressure + +namespace MaxConstPressure { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxConstPressure + +namespace MinCompPressure { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MinCompPressure + +namespace MaxCompPressure { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxCompPressure + +namespace MinConstSpeed { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MinConstSpeed + +namespace MaxConstSpeed { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxConstSpeed + +namespace MinConstFlow { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MinConstFlow + +namespace MaxConstFlow { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxConstFlow + +namespace MinConstTemp { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MinConstTemp + +namespace MaxConstTemp { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxConstTemp + +namespace PumpStatus { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace PumpStatus + +namespace EffectiveOperationMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode& value); +} // namespace EffectiveOperationMode + +namespace EffectiveControlMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode& value); +} // namespace EffectiveControlMode + +namespace Capacity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Capacity + +namespace Speed { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Speed + +namespace LifetimeRunningHours { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LifetimeRunningHours + +namespace Power { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Power + +namespace LifetimeEnergyConsumed { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LifetimeEnergyConsumed + +namespace OperationMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode& value); +} // namespace OperationMode + +namespace ControlMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode& value); +} // namespace ControlMode + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // PumpConfigurationAndControl + +namespace Thermostat { +namespace Attributes { + +namespace LocalTemperature { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LocalTemperature + +namespace OutdoorTemperature { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace OutdoorTemperature + +namespace Occupancy { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace Occupancy + +namespace AbsMinHeatSetpointLimit { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace AbsMinHeatSetpointLimit + +namespace AbsMaxHeatSetpointLimit { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace AbsMaxHeatSetpointLimit + +namespace AbsMinCoolSetpointLimit { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace AbsMinCoolSetpointLimit + +namespace AbsMaxCoolSetpointLimit { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace AbsMaxCoolSetpointLimit + +namespace PICoolingDemand { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace PICoolingDemand + +namespace PIHeatingDemand { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace PIHeatingDemand + +namespace HVACSystemTypeConfiguration { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace HVACSystemTypeConfiguration + +namespace LocalTemperatureCalibration { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value); +} // namespace LocalTemperatureCalibration + +namespace OccupiedCoolingSetpoint { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace OccupiedCoolingSetpoint + +namespace OccupiedHeatingSetpoint { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace OccupiedHeatingSetpoint + +namespace UnoccupiedCoolingSetpoint { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace UnoccupiedCoolingSetpoint + +namespace UnoccupiedHeatingSetpoint { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace UnoccupiedHeatingSetpoint + +namespace MinHeatSetpointLimit { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace MinHeatSetpointLimit + +namespace MaxHeatSetpointLimit { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace MaxHeatSetpointLimit + +namespace MinCoolSetpointLimit { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace MinCoolSetpointLimit + +namespace MaxCoolSetpointLimit { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace MaxCoolSetpointLimit + +namespace MinSetpointDeadBand { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value); +} // namespace MinSetpointDeadBand + +namespace RemoteSensing { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace RemoteSensing + +namespace ControlSequenceOfOperation { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::Thermostat::ThermostatControlSequence& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::Thermostat::ThermostatControlSequence& value); +} // namespace ControlSequenceOfOperation + +namespace SystemMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace SystemMode + +namespace ThermostatRunningMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ThermostatRunningMode + +namespace StartOfWeek { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace StartOfWeek + +namespace NumberOfWeeklyTransitions { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace NumberOfWeeklyTransitions + +namespace NumberOfDailyTransitions { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace NumberOfDailyTransitions + +namespace TemperatureSetpointHold { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace TemperatureSetpointHold + +namespace TemperatureSetpointHoldDuration { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace TemperatureSetpointHoldDuration + +namespace ThermostatProgrammingOperationMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ThermostatProgrammingOperationMode + +namespace ThermostatRunningState { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ThermostatRunningState + +namespace SetpointChangeSource { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace SetpointChangeSource + +namespace SetpointChangeAmount { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace SetpointChangeAmount + +namespace SetpointChangeSourceTimestamp { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace SetpointChangeSourceTimestamp + +namespace OccupiedSetback { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace OccupiedSetback + +namespace OccupiedSetbackMin { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace OccupiedSetbackMin + +namespace OccupiedSetbackMax { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace OccupiedSetbackMax + +namespace UnoccupiedSetback { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace UnoccupiedSetback + +namespace UnoccupiedSetbackMin { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace UnoccupiedSetbackMin + +namespace UnoccupiedSetbackMax { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace UnoccupiedSetbackMax + +namespace EmergencyHeatDelta { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace EmergencyHeatDelta + +namespace ACType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ACType + +namespace ACCapacity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ACCapacity + +namespace ACRefrigerantType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ACRefrigerantType + +namespace ACCompressorType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ACCompressorType + +namespace ACErrorCode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace ACErrorCode + +namespace ACLouverPosition { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ACLouverPosition + +namespace ACCoilTemperature { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace ACCoilTemperature + +namespace ACCapacityformat { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ACCapacityformat + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // Thermostat + +namespace FanControl { +namespace Attributes { + +namespace FanMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::FanControl::FanModeType& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::FanControl::FanModeType& value); +} // namespace FanMode + +namespace FanModeSequence { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::FanControl::FanModeSequenceType& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::FanControl::FanModeSequenceType& value); +} // namespace FanModeSequence + +namespace PercentSetting { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace PercentSetting + +namespace PercentCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace PercentCurrent + +namespace SpeedMax { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace SpeedMax + +namespace SpeedSetting { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace SpeedSetting + +namespace SpeedCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace SpeedCurrent + +namespace RockSupport { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace RockSupport + +namespace RockSetting { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace RockSetting + +namespace WindSupport { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace WindSupport + +namespace WindSetting { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace WindSetting + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // FanControl + +namespace ThermostatUserInterfaceConfiguration { +namespace Attributes { + +namespace TemperatureDisplayMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace TemperatureDisplayMode + +namespace KeypadLockout { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace KeypadLockout + +namespace ScheduleProgrammingVisibility { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ScheduleProgrammingVisibility + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // ThermostatUserInterfaceConfiguration + +namespace ColorControl { +namespace Attributes { + +namespace CurrentHue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace CurrentHue + +namespace CurrentSaturation { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace CurrentSaturation + +namespace RemainingTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RemainingTime + +namespace CurrentX { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace CurrentX + +namespace CurrentY { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace CurrentY + +namespace DriftCompensation { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace DriftCompensation + +namespace CompensationText { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace CompensationText + +namespace ColorTemperatureMireds { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorTemperatureMireds + +namespace ColorMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ColorMode + +namespace Options { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace Options + +namespace NumberOfPrimaries { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NumberOfPrimaries + +namespace Primary1X { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary1X + +namespace Primary1Y { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary1Y + +namespace Primary1Intensity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Primary1Intensity + +namespace Primary2X { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary2X + +namespace Primary2Y { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary2Y + +namespace Primary2Intensity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Primary2Intensity + +namespace Primary3X { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary3X + +namespace Primary3Y { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary3Y + +namespace Primary3Intensity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Primary3Intensity + +namespace Primary4X { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary4X + +namespace Primary4Y { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary4Y + +namespace Primary4Intensity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Primary4Intensity + +namespace Primary5X { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary5X + +namespace Primary5Y { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary5Y + +namespace Primary5Intensity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Primary5Intensity + +namespace Primary6X { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary6X + +namespace Primary6Y { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Primary6Y + +namespace Primary6Intensity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Primary6Intensity + +namespace WhitePointX { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace WhitePointX + +namespace WhitePointY { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace WhitePointY + +namespace ColorPointRX { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorPointRX + +namespace ColorPointRY { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorPointRY + +namespace ColorPointRIntensity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace ColorPointRIntensity + +namespace ColorPointGX { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorPointGX + +namespace ColorPointGY { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorPointGY + +namespace ColorPointGIntensity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace ColorPointGIntensity + +namespace ColorPointBX { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorPointBX + +namespace ColorPointBY { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorPointBY + +namespace ColorPointBIntensity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace ColorPointBIntensity + +namespace EnhancedCurrentHue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace EnhancedCurrentHue + +namespace EnhancedColorMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace EnhancedColorMode + +namespace ColorLoopActive { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ColorLoopActive + +namespace ColorLoopDirection { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace ColorLoopDirection + +namespace ColorLoopTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorLoopTime + +namespace ColorLoopStartEnhancedHue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorLoopStartEnhancedHue + +namespace ColorLoopStoredEnhancedHue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorLoopStoredEnhancedHue + +namespace ColorCapabilities { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorCapabilities + +namespace ColorTempPhysicalMinMireds { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorTempPhysicalMinMireds + +namespace ColorTempPhysicalMaxMireds { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ColorTempPhysicalMaxMireds + +namespace CoupleColorTempToLevelMinMireds { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace CoupleColorTempToLevelMinMireds + +namespace StartUpColorTemperatureMireds { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace StartUpColorTemperatureMireds + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // ColorControl + +namespace BallastConfiguration { +namespace Attributes { + +namespace PhysicalMinLevel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace PhysicalMinLevel + +namespace PhysicalMaxLevel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace PhysicalMaxLevel + +namespace BallastStatus { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace BallastStatus + +namespace MinLevel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace MinLevel + +namespace MaxLevel { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace MaxLevel + +namespace IntrinsicBalanceFactor { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace IntrinsicBalanceFactor + +namespace BallastFactorAdjustment { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace BallastFactorAdjustment + +namespace LampQuantity { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace LampQuantity + +namespace LampType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace LampType + +namespace LampManufacturer { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace LampManufacturer + +namespace LampRatedHours { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LampRatedHours + +namespace LampBurnHours { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LampBurnHours + +namespace LampAlarmMode { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace LampAlarmMode + +namespace LampBurnHoursTripPoint { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LampBurnHoursTripPoint + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // BallastConfiguration + +namespace IlluminanceMeasurement { +namespace Attributes { + +namespace MeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MeasuredValue + +namespace MinMeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MinMeasuredValue + +namespace MaxMeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxMeasuredValue + +namespace Tolerance { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Tolerance + +namespace LightSensorType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace LightSensorType + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // IlluminanceMeasurement + +namespace TemperatureMeasurement { +namespace Attributes { + +namespace MeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MeasuredValue + +namespace MinMeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MinMeasuredValue + +namespace MaxMeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxMeasuredValue + +namespace Tolerance { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Tolerance + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // TemperatureMeasurement + +namespace PressureMeasurement { +namespace Attributes { + +namespace MeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MeasuredValue + +namespace MinMeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MinMeasuredValue + +namespace MaxMeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxMeasuredValue + +namespace Tolerance { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Tolerance + +namespace ScaledValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace ScaledValue + +namespace MinScaledValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MinScaledValue + +namespace MaxScaledValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxScaledValue + +namespace ScaledTolerance { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ScaledTolerance + +namespace Scale { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value); +} // namespace Scale + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // PressureMeasurement + +namespace FlowMeasurement { +namespace Attributes { + +namespace MeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MeasuredValue + +namespace MinMeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MinMeasuredValue + +namespace MaxMeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxMeasuredValue + +namespace Tolerance { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Tolerance + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // FlowMeasurement + +namespace RelativeHumidityMeasurement { +namespace Attributes { + +namespace MeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MeasuredValue + +namespace MinMeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MinMeasuredValue + +namespace MaxMeasuredValue { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace MaxMeasuredValue + +namespace Tolerance { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Tolerance + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // RelativeHumidityMeasurement + +namespace OccupancySensing { +namespace Attributes { + +namespace Occupancy { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace Occupancy + +namespace OccupancySensorType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace OccupancySensorType + +namespace OccupancySensorTypeBitmap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace OccupancySensorTypeBitmap + +namespace PirOccupiedToUnoccupiedDelay { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace PirOccupiedToUnoccupiedDelay + +namespace PirUnoccupiedToOccupiedDelay { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace PirUnoccupiedToOccupiedDelay + +namespace PirUnoccupiedToOccupiedThreshold { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace PirUnoccupiedToOccupiedThreshold + +namespace UltrasonicOccupiedToUnoccupiedDelay { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace UltrasonicOccupiedToUnoccupiedDelay + +namespace UltrasonicUnoccupiedToOccupiedDelay { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace UltrasonicUnoccupiedToOccupiedDelay + +namespace UltrasonicUnoccupiedToOccupiedThreshold { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace UltrasonicUnoccupiedToOccupiedThreshold + +namespace PhysicalContactOccupiedToUnoccupiedDelay { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace PhysicalContactOccupiedToUnoccupiedDelay + +namespace PhysicalContactUnoccupiedToOccupiedDelay { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace PhysicalContactUnoccupiedToOccupiedDelay + +namespace PhysicalContactUnoccupiedToOccupiedThreshold { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace PhysicalContactUnoccupiedToOccupiedThreshold + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // OccupancySensing + +namespace WakeOnLan { +namespace Attributes { + +namespace MACAddress { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace MACAddress + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // WakeOnLan + +namespace Channel { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // Channel + +namespace TargetNavigator { +namespace Attributes { + +namespace CurrentTarget { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace CurrentTarget + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // TargetNavigator + +namespace MediaPlayback { +namespace Attributes { + +namespace CurrentState { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::MediaPlayback::PlaybackStateEnum& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::MediaPlayback::PlaybackStateEnum& value); +} // namespace CurrentState + +namespace StartTime { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace StartTime + +namespace Duration { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace Duration + +namespace PlaybackSpeed { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, float& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const float& value); +} // namespace PlaybackSpeed + +namespace SeekRangeEnd { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace SeekRangeEnd + +namespace SeekRangeStart { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace SeekRangeStart + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // MediaPlayback + +namespace MediaInput { +namespace Attributes { + +namespace CurrentInput { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace CurrentInput + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // MediaInput + +namespace LowPower { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // LowPower + +namespace KeypadInput { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // KeypadInput + +namespace ContentLauncher { +namespace Attributes { + +namespace SupportedStreamingProtocols { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace SupportedStreamingProtocols + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // ContentLauncher + +namespace AudioOutput { +namespace Attributes { + +namespace CurrentOutput { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace CurrentOutput + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // AudioOutput + +namespace ApplicationLauncher { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // ApplicationLauncher + +namespace ApplicationBasic { +namespace Attributes { + +namespace VendorName { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace VendorName + +namespace VendorID { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::VendorId& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::VendorId& value); +} // namespace VendorID + +namespace ApplicationName { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ApplicationName + +namespace ProductID { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ProductID + +namespace Status { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum& value); +} // namespace Status + +namespace ApplicationVersion { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace ApplicationVersion + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // ApplicationBasic + +namespace AccountLogin { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // AccountLogin + +namespace ElectricalMeasurement { +namespace Attributes { + +namespace MeasurementType { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace MeasurementType + +namespace DcVoltage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace DcVoltage + +namespace DcVoltageMin { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace DcVoltageMin + +namespace DcVoltageMax { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace DcVoltageMax + +namespace DcCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace DcCurrent + +namespace DcCurrentMin { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace DcCurrentMin + +namespace DcCurrentMax { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace DcCurrentMax + +namespace DcPower { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace DcPower + +namespace DcPowerMin { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace DcPowerMin + +namespace DcPowerMax { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace DcPowerMax + +namespace DcVoltageMultiplier { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace DcVoltageMultiplier + +namespace DcVoltageDivisor { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace DcVoltageDivisor + +namespace DcCurrentMultiplier { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace DcCurrentMultiplier + +namespace DcCurrentDivisor { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace DcCurrentDivisor + +namespace DcPowerMultiplier { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace DcPowerMultiplier + +namespace DcPowerDivisor { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace DcPowerDivisor + +namespace AcFrequency { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcFrequency + +namespace AcFrequencyMin { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcFrequencyMin + +namespace AcFrequencyMax { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcFrequencyMax + +namespace NeutralCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace NeutralCurrent + +namespace TotalActivePower { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int32_t& value); +} // namespace TotalActivePower + +namespace TotalReactivePower { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int32_t& value); +} // namespace TotalReactivePower + +namespace TotalApparentPower { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace TotalApparentPower + +namespace Measured1stHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace Measured1stHarmonicCurrent + +namespace Measured3rdHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace Measured3rdHarmonicCurrent + +namespace Measured5thHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace Measured5thHarmonicCurrent + +namespace Measured7thHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace Measured7thHarmonicCurrent + +namespace Measured9thHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace Measured9thHarmonicCurrent + +namespace Measured11thHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace Measured11thHarmonicCurrent + +namespace MeasuredPhase1stHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace MeasuredPhase1stHarmonicCurrent + +namespace MeasuredPhase3rdHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace MeasuredPhase3rdHarmonicCurrent + +namespace MeasuredPhase5thHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace MeasuredPhase5thHarmonicCurrent + +namespace MeasuredPhase7thHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace MeasuredPhase7thHarmonicCurrent + +namespace MeasuredPhase9thHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace MeasuredPhase9thHarmonicCurrent + +namespace MeasuredPhase11thHarmonicCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace MeasuredPhase11thHarmonicCurrent + +namespace AcFrequencyMultiplier { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcFrequencyMultiplier + +namespace AcFrequencyDivisor { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcFrequencyDivisor + +namespace PowerMultiplier { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace PowerMultiplier + +namespace PowerDivisor { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace PowerDivisor + +namespace HarmonicCurrentMultiplier { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value); +} // namespace HarmonicCurrentMultiplier + +namespace PhaseHarmonicCurrentMultiplier { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value); +} // namespace PhaseHarmonicCurrentMultiplier + +namespace InstantaneousVoltage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace InstantaneousVoltage + +namespace InstantaneousLineCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace InstantaneousLineCurrent + +namespace InstantaneousActiveCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace InstantaneousActiveCurrent + +namespace InstantaneousReactiveCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace InstantaneousReactiveCurrent + +namespace InstantaneousPower { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace InstantaneousPower + +namespace RmsVoltage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltage + +namespace RmsVoltageMin { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageMin + +namespace RmsVoltageMax { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageMax + +namespace RmsCurrent { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsCurrent + +namespace RmsCurrentMin { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsCurrentMin + +namespace RmsCurrentMax { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsCurrentMax + +namespace ActivePower { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ActivePower + +namespace ActivePowerMin { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ActivePowerMin + +namespace ActivePowerMax { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ActivePowerMax + +namespace ReactivePower { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ReactivePower + +namespace ApparentPower { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ApparentPower + +namespace PowerFactor { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value); +} // namespace PowerFactor + +namespace AverageRmsVoltageMeasurementPeriod { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AverageRmsVoltageMeasurementPeriod + +namespace AverageRmsUnderVoltageCounter { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AverageRmsUnderVoltageCounter + +namespace RmsExtremeOverVoltagePeriod { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsExtremeOverVoltagePeriod + +namespace RmsExtremeUnderVoltagePeriod { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsExtremeUnderVoltagePeriod + +namespace RmsVoltageSagPeriod { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageSagPeriod + +namespace RmsVoltageSwellPeriod { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageSwellPeriod + +namespace AcVoltageMultiplier { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcVoltageMultiplier + +namespace AcVoltageDivisor { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcVoltageDivisor + +namespace AcCurrentMultiplier { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcCurrentMultiplier + +namespace AcCurrentDivisor { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcCurrentDivisor + +namespace AcPowerMultiplier { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcPowerMultiplier + +namespace AcPowerDivisor { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcPowerDivisor + +namespace OverloadAlarmsMask { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace OverloadAlarmsMask + +namespace VoltageOverload { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace VoltageOverload + +namespace CurrentOverload { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace CurrentOverload + +namespace AcOverloadAlarmsMask { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AcOverloadAlarmsMask + +namespace AcVoltageOverload { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace AcVoltageOverload + +namespace AcCurrentOverload { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace AcCurrentOverload + +namespace AcActivePowerOverload { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace AcActivePowerOverload + +namespace AcReactivePowerOverload { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace AcReactivePowerOverload + +namespace AverageRmsOverVoltage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace AverageRmsOverVoltage + +namespace AverageRmsUnderVoltage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace AverageRmsUnderVoltage + +namespace RmsExtremeOverVoltage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace RmsExtremeOverVoltage + +namespace RmsExtremeUnderVoltage { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace RmsExtremeUnderVoltage + +namespace RmsVoltageSag { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace RmsVoltageSag + +namespace RmsVoltageSwell { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace RmsVoltageSwell + +namespace LineCurrentPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace LineCurrentPhaseB + +namespace ActiveCurrentPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ActiveCurrentPhaseB + +namespace ReactiveCurrentPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ReactiveCurrentPhaseB + +namespace RmsVoltagePhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltagePhaseB + +namespace RmsVoltageMinPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageMinPhaseB + +namespace RmsVoltageMaxPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageMaxPhaseB + +namespace RmsCurrentPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsCurrentPhaseB + +namespace RmsCurrentMinPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsCurrentMinPhaseB + +namespace RmsCurrentMaxPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsCurrentMaxPhaseB + +namespace ActivePowerPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ActivePowerPhaseB + +namespace ActivePowerMinPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ActivePowerMinPhaseB + +namespace ActivePowerMaxPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ActivePowerMaxPhaseB + +namespace ReactivePowerPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ReactivePowerPhaseB + +namespace ApparentPowerPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ApparentPowerPhaseB + +namespace PowerFactorPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value); +} // namespace PowerFactorPhaseB + +namespace AverageRmsVoltageMeasurementPeriodPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AverageRmsVoltageMeasurementPeriodPhaseB + +namespace AverageRmsOverVoltageCounterPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AverageRmsOverVoltageCounterPhaseB + +namespace AverageRmsUnderVoltageCounterPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AverageRmsUnderVoltageCounterPhaseB + +namespace RmsExtremeOverVoltagePeriodPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsExtremeOverVoltagePeriodPhaseB + +namespace RmsExtremeUnderVoltagePeriodPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsExtremeUnderVoltagePeriodPhaseB + +namespace RmsVoltageSagPeriodPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageSagPeriodPhaseB + +namespace RmsVoltageSwellPeriodPhaseB { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageSwellPeriodPhaseB + +namespace LineCurrentPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace LineCurrentPhaseC + +namespace ActiveCurrentPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ActiveCurrentPhaseC + +namespace ReactiveCurrentPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ReactiveCurrentPhaseC + +namespace RmsVoltagePhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltagePhaseC + +namespace RmsVoltageMinPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageMinPhaseC + +namespace RmsVoltageMaxPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageMaxPhaseC + +namespace RmsCurrentPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsCurrentPhaseC + +namespace RmsCurrentMinPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsCurrentMinPhaseC + +namespace RmsCurrentMaxPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsCurrentMaxPhaseC + +namespace ActivePowerPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ActivePowerPhaseC + +namespace ActivePowerMinPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ActivePowerMinPhaseC + +namespace ActivePowerMaxPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ActivePowerMaxPhaseC + +namespace ReactivePowerPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace ReactivePowerPhaseC + +namespace ApparentPowerPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ApparentPowerPhaseC + +namespace PowerFactorPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value); +} // namespace PowerFactorPhaseC + +namespace AverageRmsVoltageMeasurementPeriodPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AverageRmsVoltageMeasurementPeriodPhaseC + +namespace AverageRmsOverVoltageCounterPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AverageRmsOverVoltageCounterPhaseC + +namespace AverageRmsUnderVoltageCounterPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace AverageRmsUnderVoltageCounterPhaseC + +namespace RmsExtremeOverVoltagePeriodPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsExtremeOverVoltagePeriodPhaseC + +namespace RmsExtremeUnderVoltagePeriodPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsExtremeUnderVoltagePeriodPhaseC + +namespace RmsVoltageSagPeriodPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageSagPeriodPhaseC + +namespace RmsVoltageSwellPeriodPhaseC { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RmsVoltageSwellPeriodPhaseC + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // ElectricalMeasurement + +namespace TestCluster { +namespace Attributes { + +namespace Boolean { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace Boolean + +namespace Bitmap8 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace Bitmap8 + +namespace Bitmap16 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace Bitmap16 + +namespace Bitmap32 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace Bitmap32 + +namespace Bitmap64 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::BitMask& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::BitMask& value); +} // namespace Bitmap64 + +namespace Int8u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace Int8u + +namespace Int16u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Int16u + +namespace Int24u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace Int24u + +namespace Int32u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace Int32u + +namespace Int40u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace Int40u + +namespace Int48u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace Int48u + +namespace Int56u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace Int56u + +namespace Int64u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace Int64u + +namespace Int8s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value); +} // namespace Int8s + +namespace Int16s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace Int16s + +namespace Int24s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int32_t& value); +} // namespace Int24s + +namespace Int32s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int32_t& value); +} // namespace Int32s + +namespace Int40s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int64_t& value); +} // namespace Int40s + +namespace Int48s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int64_t& value); +} // namespace Int48s + +namespace Int56s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int64_t& value); +} // namespace Int56s + +namespace Int64s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int64_t& value); +} // namespace Int64s + +namespace Enum8 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace Enum8 + +namespace Enum16 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace Enum16 + +namespace FloatSingle { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, float& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const float& value); +} // namespace FloatSingle + +namespace FloatDouble { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, double& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const double& value); +} // namespace FloatDouble + +namespace OctetString { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::ByteSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::ByteSpan& value); +} // namespace OctetString + +namespace LongOctetString { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::ByteSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::ByteSpan& value); +} // namespace LongOctetString + +namespace CharString { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace CharString + +namespace LongCharString { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::CharSpan& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::CharSpan& value); +} // namespace LongCharString + +namespace EpochUs { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint64_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint64_t& value); +} // namespace EpochUs + +namespace EpochS { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace EpochS + +namespace VendorId { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::VendorId& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::VendorId& value); +} // namespace VendorId + +namespace EnumAttr { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::Clusters::TestCluster::SimpleEnum& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::Clusters::TestCluster::SimpleEnum& value); +} // namespace EnumAttr + +namespace RangeRestrictedInt8u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace RangeRestrictedInt8u + +namespace RangeRestrictedInt8s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int8_t& value); +} // namespace RangeRestrictedInt8s + +namespace RangeRestrictedInt16u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace RangeRestrictedInt16u + +namespace RangeRestrictedInt16s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, int16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const int16_t& value); +} // namespace RangeRestrictedInt16s + +namespace TimedWriteBoolean { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace TimedWriteBoolean + +namespace GeneralErrorBoolean { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace GeneralErrorBoolean + +namespace ClusterErrorBoolean { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace ClusterErrorBoolean + +namespace Unsupported { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, bool& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const bool& value); +} // namespace Unsupported + +namespace NullableBoolean { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableBoolean + +namespace NullableBitmap8 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable>& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable>& value); +} // namespace NullableBitmap8 + +namespace NullableBitmap16 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable>& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable>& value); +} // namespace NullableBitmap16 + +namespace NullableBitmap32 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable>& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable>& value); +} // namespace NullableBitmap32 + +namespace NullableBitmap64 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable>& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable>& value); +} // namespace NullableBitmap64 + +namespace NullableInt8u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt8u + +namespace NullableInt16u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt16u + +namespace NullableInt24u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt24u + +namespace NullableInt32u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt32u + +namespace NullableInt40u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt40u + +namespace NullableInt48u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt48u + +namespace NullableInt56u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt56u + +namespace NullableInt64u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt64u + +namespace NullableInt8s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt8s + +namespace NullableInt16s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt16s + +namespace NullableInt24s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt24s + +namespace NullableInt32s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt32s + +namespace NullableInt40s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt40s + +namespace NullableInt48s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt48s + +namespace NullableInt56s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt56s + +namespace NullableInt64s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableInt64s + +namespace NullableEnum8 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableEnum8 + +namespace NullableEnum16 { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableEnum16 + +namespace NullableFloatSingle { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableFloatSingle + +namespace NullableFloatDouble { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableFloatDouble + +namespace NullableOctetString { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableOctetString + +namespace NullableCharString { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableCharString + +namespace NullableEnumAttr { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableEnumAttr + +namespace NullableRangeRestrictedInt8u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableRangeRestrictedInt8u + +namespace NullableRangeRestrictedInt8s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableRangeRestrictedInt8s + +namespace NullableRangeRestrictedInt16u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableRangeRestrictedInt16u + +namespace NullableRangeRestrictedInt16s { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, chip::app::DataModel::Nullable& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const chip::app::DataModel::Nullable& value); +} // namespace NullableRangeRestrictedInt16s + +namespace WriteOnlyInt8u { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint8_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint8_t& value); +} // namespace WriteOnlyInt8u + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // TestCluster + +namespace FaultInjection { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint32_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint32_t& value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, uint16_t& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const uint16_t& value); +} // namespace ClusterRevision + +} // namespace Attributes +} // FaultInjection + + +} // matter_bridge +} // unify diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/run_zap.sh b/silabs_examples/unify-matter-bridge/linux/zap-handlers/run_zap.sh new file mode 100755 index 00000000000000..e41203ff2ec83c --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/run_zap.sh @@ -0,0 +1,8 @@ + +pushd ../../../../ + +./scripts/tools/zap/generate.py -t silabs_examples/unify-matter-bridge/linux/zap-handlers/bridge-templates.json \ + -o silabs_examples/unify-matter-bridge/linux/zap-handlers/gen \ + silabs_examples/unify-matter-bridge/unify-matter-bridge-common/unify-matter-bridge.zap + +popd diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/unify-helper.js b/silabs_examples/unify-matter-bridge/linux/zap-handlers/unify-helper.js new file mode 100644 index 00000000000000..469133901505b3 --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/unify-helper.js @@ -0,0 +1,11 @@ +function supportedCluster(clusterName) { + switch (clusterName) { + case "Network Commissioning": return false + case "Groups": return false + case "Test Cluster": return false + default: return true + } +} + + +exports.supportedCluster = supportedCluster diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/unify_accessors.cpp.zapt b/silabs_examples/unify-matter-bridge/linux/zap-handlers/unify_accessors.cpp.zapt new file mode 100644 index 00000000000000..4468e27dee649d --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/unify_accessors.cpp.zapt @@ -0,0 +1,92 @@ + +/** + * @file + * This file contains definitions for accessors around clusters attributes. + */ + +#define CHIP_USE_ENUM_CLASS_FOR_IM_ENUM +#include + +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::app; +namespace unify { +namespace matter_bridge { + +{{#zcl_clusters}} +{{#if (supportedCluster label)}} +{{#zcl_attributes_server}} +{{#first}} +namespace {{asUpperCamelCase parent.label}} { +namespace Attributes { + +{{/first}} +{{#if_is_struct type}} +{{else if (canHaveSimpleAccessors this)}} +namespace {{asUpperCamelCase label}} { + +{{#*inline "clusterId"}}Clusters::{{asUpperCamelCase parent.label}}::Id{{/inline}} +{{#*inline "sizingBytes"}}{{#if (isShortString type)}}1{{else}}2{{/if}}{{/inline}} + + +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, {{zapTypeToEncodableClusterObjectType type ns=parent.name forceNotOptional=true}}& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + + using Traits = NumericAttributeTraits<{{accessorTraitType type}}>; + Traits::StorageType temp_storage; + + cache.get(endpoint,temp_storage); + auto tmp = Traits::StorageToWorking(temp_storage); + + {{#if isNullable }} + value.SetNonNull(tmp); + {{else}} + value = tmp; + {{/if}} + return EMBER_ZCL_STATUS_SUCCESS; +} + +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const {{zapTypeToEncodableClusterObjectType type ns=parent.name forceNotOptional=true}}& value) +{ + attribute_state_cache& cache = attribute_state_cache::get_instance(); + {{~#if (isString type)}} + cache.set<{{accessorTraitType type}}>(endpoint,value); + {{else}} + using Traits = NumericAttributeTraits<{{accessorTraitType type}}>; + Traits::StorageType storageValue; + {{#if isNullable}} + if(value.HasValidValue()) { + Traits::WorkingToStorage(value.Value(), storageValue); + } else { + return EMBER_ZCL_STATUS_FAILURE; + } + {{else}} + Traits::WorkingToStorage(value, storageValue); + {{/if}} + cache.set(endpoint,storageValue); + {{/if}} + return EMBER_ZCL_STATUS_SUCCESS; +} + + +} // namespace {{asUpperCamelCase label}} + +{{/if_is_struct}} +{{#last}} +} // namespace Attributes +} // {{asUpperCamelCase parent.label}} + +{{/last}} +{{/zcl_attributes_server}} +{{/if}} +{{/zcl_clusters}} + +} // matter_bridge +} // unify diff --git a/silabs_examples/unify-matter-bridge/linux/zap-handlers/unify_accessors.hpp.zapt b/silabs_examples/unify-matter-bridge/linux/zap-handlers/unify_accessors.hpp.zapt new file mode 100644 index 00000000000000..d0e9382a18a7ce --- /dev/null +++ b/silabs_examples/unify-matter-bridge/linux/zap-handlers/unify_accessors.hpp.zapt @@ -0,0 +1,41 @@ + +/** + * @file + * This file contains declarations for accessors around clusters attributes. + */ + +#pragma once + +#include +#include +#include +#include + +namespace unify { +namespace matter_bridge { + +{{#zcl_clusters}} +{{#zcl_attributes_server}} +{{#first}} +namespace {{asUpperCamelCase parent.label}} { +namespace Attributes { + +{{/first}} +{{#if_is_struct type}} +{{else if (canHaveSimpleAccessors this)}} +namespace {{asUpperCamelCase label}} { +EmberAfStatus Get(const chip::app::ConcreteAttributePath& endpoint, {{zapTypeToEncodableClusterObjectType type ns=parent.name forceNotOptional=true}}& value); +EmberAfStatus Set(const chip::app::ConcreteAttributePath& endpoint, const {{zapTypeToEncodableClusterObjectType type ns=parent.name forceNotOptional=true}}& value); +} // namespace {{asUpperCamelCase label}} + +{{/if_is_struct}} +{{#last}} +} // namespace Attributes +} // {{asUpperCamelCase parent.label}} + +{{/last}} +{{/zcl_attributes_server}} +{{/zcl_clusters}} + +} // matter_bridge +} // unify diff --git a/silabs_examples/unify-matter-bridge/linux/zap/addon-helper.js b/silabs_examples/unify-matter-bridge/linux/zap/addon-helper.js index 6e28e583d7edd1..4f7803f71b689d 100644 --- a/silabs_examples/unify-matter-bridge/linux/zap/addon-helper.js +++ b/silabs_examples/unify-matter-bridge/linux/zap/addon-helper.js @@ -55,7 +55,8 @@ function chipSupportedCluster(clusterName) { "FlowMeasurement":{}, "OccupancySensing":{}, "IasZone":{}, - "IaswD":{}, + "IaswD":{}, + "Basic": {}, }; return clusterName in clusters } @@ -67,6 +68,19 @@ function chipSupportedAttribute(cluster, attribute) { switch (cluster + "_" + attribute) { case "DoorLock_SecurityLevel": return false case "ColorControl_Options": return false + case "Basic_ZCLVersion": return false + case "Basic_StackVersion": return false + case "Basic_GenericDevice-Class": return false + case "Basic_GenericDevice-Type": return false + case "Basic_ProductCode": return false + case "Basic_ManufacturerVersionDetails": return false + case "Basic_LocationDescription": return false + case "Basic_Basic_PhysicalEnvironment": return false + case "Basic_AlarmMask": return false + case "Basic_DisableLocalConfig": return false + case "Basic_ResetToFactoryDefaults": return false + case "Basic_PhysicalEnvironment": return false + case "Basic_DeviceEnabled": return false default: return true } } @@ -82,6 +96,7 @@ function chipSupportedCommands(cluster, command) { case "Level_MoveToClosestFrequency": return false case "DoorLock_Toggle": return false case "Identify_IdentifyQuery": return false + case "Basic_ResetToFactoryDefaults": return false default: return true } } @@ -113,6 +128,17 @@ function chipAttributeConversion(attributeName) { case "ZoneID": return "ZoneId" case "ColorTemperatureMireds": return "ColorTemperature" case "IASCIEAddress": return "IasCieAddress" + case "ManufacturerName": return "VendorName" + case "ModelIdentifier": return "ProductName" + case "HWVersion": return "HardwareVersion" + case "ModelIdentifier": return "HardwareVersionString" + case "ApplicationVersion": return "SoftwareVersion" + case "SWBuildID": return "SoftwareVersionString" + case "DateCode": return "ManufacturingDate" + case "ProductURL": return "ProductURL" + case "ProductLabel": return "ProductLabel" + case "SerialNumber": return "SerialNumber" + case "ApplicationVersion": return "UniqueID" default: return asUpperCamelCase(attributeName) } } @@ -151,7 +177,7 @@ function chipClusterConversion(clusterName) { case "RelativityHumidity": return "RelativityHumidityMeasurement" case "IASWD": return "IasWd" case "IASZone": return "IasZone" - case "Basic": return "ApplicationBasic" + case "Basic": return "BridgedDeviceBasic" //case "PowerConfiguration": return "PowerSourceConfiguration" default: return asUpperCamelCase(clusterName) } diff --git a/silabs_examples/unify-matter-bridge/readme_building.md b/silabs_examples/unify-matter-bridge/readme_building.md index df21364311eab4..f060c4e8d455e8 100644 --- a/silabs_examples/unify-matter-bridge/readme_building.md +++ b/silabs_examples/unify-matter-bridge/readme_building.md @@ -1,16 +1,32 @@ -# Building the Unify Matter Bridge +# Unify Matter Bridge + +The Unify Matter Bridge bridges the Matter ecosystem with the Unify ecosystem. + +## Building the Unify Matter Bridge + +This building guide cross compiles for armhf architecture. 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 + +### Checkout submodules + +For the Unify bridge we checkout the necessary submodules with the below +command. ```bash -matter$ git clone ssh://git@stash.silabs.com/uic/uic.git --recursive ../uic +matter$ ./scripts/checkout_submodules.py --platform linux ``` -# Build the docker container +### Downloading and staging the uic repo + +```bash +matter$ git clone --depth 1 --branch ver_1.2.1-103-g34db9516-unify-matter-bridge ssh://git@stash.silabs.com/uic/uic.git --recursive ../uic +``` + +#### Build the docker container (armhf compilation) ```bash matter$ docker build -t unify-matter silabs_examples/unify-matter-bridge/docker/ @@ -22,7 +38,7 @@ Starting the docker: matter$ docker run -it -v $PWD:/matter -v $PWD/../uic:/uic unify-matter ``` -# Buiding libunify +#### Building libunify The Unify Matter Bridge is depending on the libunify library from the Unify project. @@ -30,38 +46,64 @@ 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 +docker/uic$ cmake -DCMAKE_INSTALL_PREFIX=$PWD/stage -GNinja -DCMAKE_TOOLCHAIN_FILE=../cmake/armhf_debian.cmake -B build_unify_armhf/ -S components +docker/uic$ cmake --build build_unify_armhf +docker/uic$ cmake --install build_unify_armhf --prefix $PWD/stage ``` -Setup pkg-config to look at the stage folder +After having cross compiled unify library we set two paths in the +PKG_CONFIG_PATH. The first path is for the staged unify library and the second +one is for cross compiling to armhf. ```bash docker/uic$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$PWD/stage/share/pkgconfig +docker/uic$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/arm-linux-gnueabihf/pkgconfig ``` -# Setup the matter build environment +### 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. +the below command. The source command will load a number of build tools, and +will make sure the correct toolchains and compilers are used for compiling the +unify matter bridge. ```bash -docker$ ./scripts/build/gn_bootstrap.sh +docker$ source ./scripts/activate.sh ``` Compile the Unify bridge ```bash -docker$ cd silabs_examples/unify-matter-bridge/linux/ -docker$ gn gen out/host -docker$ ninja -C out/host +docker/matter$ cd silabs_examples/unify-matter-bridge/linux/ +docker/silabs_examples/unify-matter-bridge/linux$ gn gen out/armhf --args='target_cpu="arm"' +docker/silabs_examples/unify-matter-bridge/linux$ ninja -C out/armhf ``` + +After building the unify-matter-bridge binary is located at +`out/armhf/obj/bin/unify-matter-bridge`. + +### Unit testing + +It is always preferable to write unit testing for quality software. So we +encourage to do this when developing for the Unify Matter Bridge. + +Documentation on unit testing can be found within the +[README.md](linux/src/tests/README.md) of the `linux/src/tests` folder. + +### Trouble shooting + +Common errors one might encounter: + +1. If you did not source the `matter/scripts/activate.sh` `gn` and other common + build tools won't be found. +2. If you did not export the `pkgconfig` for the `arm-linux-gnueabihf` toolchain + you will get errors such as `G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));` +3. If you are compiling unit tests do not try to compile the matter bridge at + the same time. This will not work as when compiling unit tests you are also + compiling unit tests for all other sub components. +4. If you are encountering errors linking to `libunify` try to redo the compile + steps of the `libunify`. +5. Encountering problems with the submodules can be due to trying to checkout + the submodules inside of the docker container. 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 index ba1be4eecd3ac8..2f64ee017d59ca 100644 --- a/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/BUILD.gn +++ b/silabs_examples/unify-matter-bridge/unify-matter-bridge-common/BUILD.gn @@ -1,16 +1,15 @@ -# 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. +# ****************************************************************************** +# * # 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. +# * +# ****************************************************************************** import("//build_overrides/chip.gni") 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 index 036cbda81ad736..71273bfb78f615 100644 --- 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 @@ -1,20 +1,15 @@ -/* +/****************************************************************************** + * # 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. * - * 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 @@ -28,7 +23,7 @@ #pragma once // overrides CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT in CHIPProjectConfig -#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT 16 +#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT 255 // include the CHIPProjectConfig from config/standalone #include