diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 55fcf9f6500dc4..e4c4b5d337e06e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -242,7 +242,7 @@ jobs: run: | ./scripts/run_in_build_env.sh "./scripts/run_codegen_targets.sh out/sanitizers" - name: Clang-tidy validation - timeout-minutes: 45 + timeout-minutes: 60 run: | ./scripts/run_in_build_env.sh \ "./scripts/run-clang-tidy-on-compile-commands.py \ @@ -462,7 +462,7 @@ jobs: run: | ./scripts/run_in_build_env.sh "./scripts/run_codegen_targets.sh out/default" - name: Clang-tidy validation - timeout-minutes: 45 + timeout-minutes: 60 run: | ./scripts/run_in_build_env.sh \ "./scripts/run-clang-tidy-on-compile-commands.py \ diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index 642d04b60f3bbf..7239575c686d4b 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -113,6 +113,8 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target android-arm64-tv-server build" + - name: Clean out build output + run: rm -rf ./out - name: Build Android arm64-chip-tool run: | ./scripts/run_in_build_env.sh \ diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 3d5bad7b9207e8..bda66ca507030b 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -197,7 +197,7 @@ jobs: src/app/zap-templates/zcl/data-model/draft/electrical-measurement-cluster.xml \ src/app/zap-templates/zcl/data-model/draft/input-output-value-clusters.xml \ src/app/zap-templates/zcl/data-model/draft/onoff-switch-configuration-cluster.xml \ - src/app/zap-templates/zcl/data-model/chip/replacable-monitoring-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.xml \ " - name: Build Apps timeout-minutes: 60 @@ -509,6 +509,8 @@ jobs: scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_ACE_1_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff"' scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_ACE_1_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021"' scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_CGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021"' + scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_DA_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values"' + scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_DA_1_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values"' scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py"' - name: Uploading core files uses: actions/upload-artifact@v3 diff --git a/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp b/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp index cab8f9730a8514..17fa5d007b8493 100644 --- a/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp @@ -73,7 +73,7 @@ Status StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointI return Status::Success; } } - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %u", mode); + ChipLogProgress(Zcl, "Cannot find the mode %u", mode); return Status::InvalidCommand; } diff --git a/examples/bridge-app/esp32/README.md b/examples/bridge-app/esp32/README.md index cf514b163a7f36..891a93d81a2892 100644 --- a/examples/bridge-app/esp32/README.md +++ b/examples/bridge-app/esp32/README.md @@ -1,7 +1,7 @@ -# CHIP ESP32 Bridge App Example +# Matter ESP32 Bridge App Example Please -[setup ESP-IDF and CHIP Environment](../../../docs/guides/esp32/setup_idf_chip.md) +[setup ESP-IDF and Matter Environment](../../../docs/guides/esp32/setup_idf_chip.md) and refer [building and commissioning](../../../docs/guides/esp32/build_app_and_commission.md) guides to get started. diff --git a/examples/bridge-app/linux/README.md b/examples/bridge-app/linux/README.md index f9e8c9708b64a0..826206c2e9fe7d 100644 --- a/examples/bridge-app/linux/README.md +++ b/examples/bridge-app/linux/README.md @@ -1,14 +1,14 @@ -# CHIP Linux Bridge Example +# Matter Linux Bridge Example An example demonstrating a simple lighting bridge and the use of dynamic endpoints. The document will describe the theory of operation and how to build -and run CHIP Linux Bridge Example on Raspberry Pi. This doc is tested on +and run Matter Linux Bridge Example on Raspberry Pi. This doc is tested on **Ubuntu for Raspberry Pi Server 20.04 LTS (aarch64)** and **Ubuntu for Raspberry Pi Desktop 20.10 (aarch64)**
-- [CHIP Linux Bridge Example](#chip-linux-bridge-example) +- [Matter Linux Bridge Example](#matter-linux-bridge-example) - [Theory of Operation](#theory-of-operation) - [Building](#building) - [Running the Complete Example on Raspberry Pi 4](#running-the-complete-example-on-raspberry-pi-4) diff --git a/examples/dynamic-bridge-app/linux/BUILD.gn b/examples/dynamic-bridge-app/linux/BUILD.gn index 52fe054ecdd571..08c718915eb7e3 100644 --- a/examples/dynamic-bridge-app/linux/BUILD.gn +++ b/examples/dynamic-bridge-app/linux/BUILD.gn @@ -40,7 +40,6 @@ chip_codegen("chip-bridge-codegen") { "bridge/Switch.h", "bridge/TemperatureMeasurement.h", "bridge/BridgeClustersImpl.h", - "bridge/BridgeGlobalStructs.h", ] } diff --git a/examples/dynamic-bridge-app/linux/README.md b/examples/dynamic-bridge-app/linux/README.md index 1e1d4f3fb9f141..cefae9a466f5c7 100644 --- a/examples/dynamic-bridge-app/linux/README.md +++ b/examples/dynamic-bridge-app/linux/README.md @@ -1,14 +1,14 @@ -# CHIP Linux Bridge Example +# Matter Linux Dynamic Endpoints Bridge Example An example demonstrating a simple lighting bridge and the use of dynamic endpoints. The document will describe the theory of operation and how to build -and run CHIP Linux Bridge Example on Raspberry Pi. This doc is tested on +and run Matter Linux Bridge Example on Raspberry Pi. This doc is tested on **Ubuntu for Raspberry Pi Server 20.04 LTS (aarch64)** and **Ubuntu for Raspberry Pi Desktop 20.10 (aarch64)**
-- [CHIP Linux Bridge Example](#chip-linux-bridge-example) +- [Matter Linux Dynamic Endpoints Bridge Example](#matter-linux-dynamic-endpoints-bridge-example) - [Theory of Operation](#theory-of-operation) - [Building](#building) - [Running the Complete Example on Raspberry Pi 4](#running-the-complete-example-on-raspberry-pi-4) diff --git a/examples/lock-app/linux/main.cpp b/examples/lock-app/linux/main.cpp index bf6cb027107406..be81b6a520ac90 100644 --- a/examples/lock-app/linux/main.cpp +++ b/examples/lock-app/linux/main.cpp @@ -87,6 +87,6 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & // TODO: Watch for LockState, DoorState, Mode, etc changes and trigger appropriate action if (attributePath.mClusterId == Clusters::DoorLock::Id) { - emberAfDoorLockClusterPrintln("Door Lock attribute changed"); + ChipLogProgress(Zcl, "Door Lock attribute changed"); } } diff --git a/examples/placeholder/linux/static-supported-modes-manager.cpp b/examples/placeholder/linux/static-supported-modes-manager.cpp index cab8f9730a8514..17fa5d007b8493 100644 --- a/examples/placeholder/linux/static-supported-modes-manager.cpp +++ b/examples/placeholder/linux/static-supported-modes-manager.cpp @@ -73,7 +73,7 @@ Status StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointI return Status::Success; } } - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %u", mode); + ChipLogProgress(Zcl, "Cannot find the mode %u", mode); return Status::InvalidCommand; } diff --git a/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp b/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp index ec752cd8be67ba..769d5cbd43be53 100644 --- a/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp +++ b/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp @@ -17,8 +17,6 @@ */ #include "static-supported-modes-manager.h" -#include -#include #include using namespace chip; @@ -176,7 +174,7 @@ Status StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointI return Status::Success; } } - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %u", mode); + ChipLogProgress(Zcl, "Cannot find the mode %u", mode); return Status::InvalidCommand; } diff --git a/examples/window-app/common/src/WindowApp.cpp b/examples/window-app/common/src/WindowApp.cpp index 1f870503b1c818..11d49b7e34ed20 100644 --- a/examples/window-app/common/src/WindowApp.cpp +++ b/examples/window-app/common/src/WindowApp.cpp @@ -295,7 +295,7 @@ void WindowApp::DispatchEventAttributeChange(chip::EndpointId endpoint, chip::At if (nullptr == cover) { - emberAfWindowCoveringClusterPrint("Ep[%u] not supported AttributeId=%u\n", endpoint, (unsigned int) attribute); + ChipLogProgress(Zcl, "Ep[%u] not supported AttributeId=%u\n", endpoint, (unsigned int) attribute); return; } @@ -675,7 +675,7 @@ void WindowApp::Cover::OnTiltTimeout(WindowApp::Timer & timer) void WindowApp::Cover::SchedulePositionSet(chip::Percent100ths position, bool isTilt) { CoverWorkData * data = chip::Platform::New(); - VerifyOrReturn(data != nullptr, emberAfWindowCoveringClusterPrint("Cover::SchedulePositionSet - Out of Memory for WorkData")); + VerifyOrReturn(data != nullptr, ChipLogProgress(Zcl, "Cover::SchedulePositionSet - Out of Memory for WorkData")); data->mEndpointId = mEndpoint; data->percent100ths = position; @@ -701,7 +701,7 @@ void WindowApp::Cover::CallbackPositionSet(intptr_t arg) void WindowApp::Cover::ScheduleOperationalStateSet(OperationalState opState, bool isTilt) { CoverWorkData * data = chip::Platform::New(); - VerifyOrReturn(data != nullptr, emberAfWindowCoveringClusterPrint("Cover::OperationalStatusSet - Out of Memory for WorkData")); + VerifyOrReturn(data != nullptr, ChipLogProgress(Zcl, "Cover::OperationalStatusSet - Out of Memory for WorkData")); data->mEndpointId = mEndpoint; data->opState = opState; diff --git a/scripts/py_matter_idl/BUILD.gn b/scripts/py_matter_idl/BUILD.gn index 4a82d06a13dcfb..06bdb3da4a673b 100644 --- a/scripts/py_matter_idl/BUILD.gn +++ b/scripts/py_matter_idl/BUILD.gn @@ -39,19 +39,16 @@ pw_python_package("matter_idl") { "matter_idl/tests/inputs/several_clusters.matter", "matter_idl/tests/inputs/simple_attribute.matter", "matter_idl/tests/outputs/cluster_struct_attribute/bridge/BridgeClustersImpl.h", - "matter_idl/tests/outputs/cluster_struct_attribute/bridge/BridgeGlobalStructs.h", "matter_idl/tests/outputs/cluster_struct_attribute/bridge/DemoClusterServer.h", "matter_idl/tests/outputs/cluster_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp", "matter_idl/tests/outputs/cluster_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp", "matter_idl/tests/outputs/global_struct_attribute/bridge/BridgeClustersImpl.h", - "matter_idl/tests/outputs/global_struct_attribute/bridge/BridgeGlobalStructs.h", "matter_idl/tests/outputs/global_struct_attribute/bridge/DemoClusterServer.h", "matter_idl/tests/outputs/global_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp", "matter_idl/tests/outputs/global_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp", "matter_idl/tests/outputs/optional_argument/jni/MyClusterClient-ReadImpl.cpp", "matter_idl/tests/outputs/optional_argument/jni/MyClusterClient-InvokeSubscribeImpl.cpp", "matter_idl/tests/outputs/several_clusters/bridge/BridgeClustersImpl.h", - "matter_idl/tests/outputs/several_clusters/bridge/BridgeGlobalStructs.h", "matter_idl/tests/outputs/several_clusters/bridge/FirstServer.h", "matter_idl/tests/outputs/several_clusters/bridge/SecondServer.h", "matter_idl/tests/outputs/several_clusters/bridge/Third.h", @@ -65,7 +62,6 @@ pw_python_package("matter_idl") { "matter_idl/tests/outputs/several_clusters/jni/SecondClient-InvokeSubscribeImpl.cpp", "matter_idl/tests/outputs/several_clusters/jni/ThirdClient-InvokeSubscribeImpl.cpp", "matter_idl/tests/outputs/simple_attribute/bridge/BridgeClustersImpl.h", - "matter_idl/tests/outputs/simple_attribute/bridge/BridgeGlobalStructs.h", "matter_idl/tests/outputs/simple_attribute/bridge/MyClusterServer.h", "matter_idl/tests/outputs/simple_attribute/jni/MyClusterClient-ReadImpl.cpp", "matter_idl/tests/outputs/simple_attribute/jni/MyClusterClient-InvokeSubscribeImpl.cpp", diff --git a/scripts/py_matter_idl/matter_idl/generators/bridge/BridgeClustersCpp.jinja b/scripts/py_matter_idl/matter_idl/generators/bridge/BridgeClustersCpp.jinja index 14a6aca640b0ad..4a6514bed3e421 100644 --- a/scripts/py_matter_idl/matter_idl/generators/bridge/BridgeClustersCpp.jinja +++ b/scripts/py_matter_idl/matter_idl/generators/bridge/BridgeClustersCpp.jinja @@ -1,6 +1,5 @@ #pragma once -#include "BridgeGlobalStructs.h" #include "GeneratedClusters.h" namespace clusters { diff --git a/scripts/py_matter_idl/matter_idl/generators/bridge/BridgeClustersHeader.jinja b/scripts/py_matter_idl/matter_idl/generators/bridge/BridgeClustersHeader.jinja index 698da602ccf698..452cdb845916a6 100644 --- a/scripts/py_matter_idl/matter_idl/generators/bridge/BridgeClustersHeader.jinja +++ b/scripts/py_matter_idl/matter_idl/generators/bridge/BridgeClustersHeader.jinja @@ -1,7 +1,5 @@ #include -#include "bridge/BridgeGlobalStructs.h" - namespace clusters { {%- for cluster in clusters %} diff --git a/scripts/py_matter_idl/matter_idl/generators/bridge/__init__.py b/scripts/py_matter_idl/matter_idl/generators/bridge/__init__.py index a4f7e60b537554..ef6f812de35def 100644 --- a/scripts/py_matter_idl/matter_idl/generators/bridge/__init__.py +++ b/scripts/py_matter_idl/matter_idl/generators/bridge/__init__.py @@ -179,12 +179,3 @@ def internal_render_all(self): 'idl': self.idl, } ) - - self.internal_render_one_output( - template_path="BridgeClustersGlobalStructs.jinja", - output_file_name="bridge/BridgeGlobalStructs.h", - vars={ - 'idl': self.idl, - 'structs': self.idl.structs, - } - ) diff --git a/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml b/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml index 15d10402db20de..7646b1d3d14a06 100644 --- a/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml +++ b/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml @@ -54,22 +54,18 @@ java-class: bridge: inputs/simple_attribute.matter: bridge/BridgeClustersImpl.h: outputs/simple_attribute/bridge/BridgeClustersImpl.h - bridge/BridgeGlobalStructs.h: outputs/simple_attribute/bridge/BridgeGlobalStructs.h bridge/MyClusterServer.h: outputs/simple_attribute/bridge/MyClusterServer.h inputs/global_struct_attribute.matter: bridge/BridgeClustersImpl.h: outputs/global_struct_attribute/bridge/BridgeClustersImpl.h - bridge/BridgeGlobalStructs.h: outputs/global_struct_attribute/bridge/BridgeGlobalStructs.h bridge/DemoClusterServer.h: outputs/global_struct_attribute/bridge/DemoClusterServer.h inputs/cluster_struct_attribute.matter: bridge/BridgeClustersImpl.h: outputs/cluster_struct_attribute/bridge/BridgeClustersImpl.h - bridge/BridgeGlobalStructs.h: outputs/cluster_struct_attribute/bridge/BridgeGlobalStructs.h bridge/DemoClusterServer.h: outputs/cluster_struct_attribute/bridge/DemoClusterServer.h inputs/several_clusters.matter: bridge/BridgeClustersImpl.h: outputs/several_clusters/bridge/BridgeClustersImpl.h - bridge/BridgeGlobalStructs.h: outputs/several_clusters/bridge/BridgeGlobalStructs.h bridge/FirstServer.h: outputs/several_clusters/bridge/FirstServer.h bridge/SecondServer.h: outputs/several_clusters/bridge/SecondServer.h bridge/ThirdServer.h: outputs/several_clusters/bridge/ThirdServer.h @@ -77,7 +73,6 @@ bridge: inputs/cluster_with_commands.matter: bridge/BridgeClustersImpl.h: outputs/cluster_with_commands/bridge/BridgeClustersImpl.h - bridge/BridgeGlobalStructs.h: outputs/cluster_with_commands/bridge/BridgeGlobalStructs.h bridge/OnOff.h: outputs/cluster_with_commands/bridge/OnOff.h cpp-app: diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/bridge/BridgeGlobalStructs.h b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/bridge/BridgeGlobalStructs.h deleted file mode 100644 index d8fdc6c0b4556a..00000000000000 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/bridge/BridgeGlobalStructs.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -namespace clusters { - - - -} diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/bridge/DemoClusterServer.h b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/bridge/DemoClusterServer.h index eac0b0aeca0d1c..b6abee142e78ce 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/bridge/DemoClusterServer.h +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/bridge/DemoClusterServer.h @@ -1,6 +1,5 @@ #pragma once -#include "BridgeGlobalStructs.h" #include "GeneratedClusters.h" namespace clusters { diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_with_commands/bridge/BridgeGlobalStructs.h b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_with_commands/bridge/BridgeGlobalStructs.h deleted file mode 100644 index d8fdc6c0b4556a..00000000000000 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_with_commands/bridge/BridgeGlobalStructs.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -namespace clusters { - - - -} diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_with_commands/bridge/OnOff.h b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_with_commands/bridge/OnOff.h index 1e34c2c7953418..383751db0cd325 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_with_commands/bridge/OnOff.h +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_with_commands/bridge/OnOff.h @@ -1,6 +1,5 @@ #pragma once -#include "BridgeGlobalStructs.h" #include "GeneratedClusters.h" namespace clusters { diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/bridge/BridgeGlobalStructs.h b/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/bridge/BridgeGlobalStructs.h deleted file mode 100644 index 19f6189f7b59b2..00000000000000 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/bridge/BridgeGlobalStructs.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -namespace clusters { - - -struct LabelStruct -{ - CHIP_ERROR Decode(chip::TLV::TLVReader & reader) - { - chip::app::Clusters::detail::Structs::LabelStruct::DecodableType t; - CHIP_ERROR err = t.Decode(reader); - if(err == CHIP_NO_ERROR) { - chip::Value::Assign(label, t.label); - chip::Value::Assign(value, t.value); - } - return err; - } - - CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const - { - chip::app::Clusters::detail::Structs::LabelStruct::Type t; - chip::Value::Assign(t.label, label); - chip::Value::Assign(t.value, value); - return t.Encode(writer, tag); - } - std::string label; - std::string value; -}; - -} diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/bridge/DemoClusterServer.h b/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/bridge/DemoClusterServer.h index 3c6feeb5a3baba..a449dc374a0862 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/bridge/DemoClusterServer.h +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/bridge/DemoClusterServer.h @@ -1,6 +1,5 @@ #pragma once -#include "BridgeGlobalStructs.h" #include "GeneratedClusters.h" namespace clusters { diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/BridgeGlobalStructs.h b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/BridgeGlobalStructs.h deleted file mode 100644 index d8fdc6c0b4556a..00000000000000 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/BridgeGlobalStructs.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -namespace clusters { - - - -} diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/FirstServer.h b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/FirstServer.h index 2786817c0dc8a5..5cb389e01564d1 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/FirstServer.h +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/FirstServer.h @@ -1,6 +1,5 @@ #pragma once -#include "BridgeGlobalStructs.h" #include "GeneratedClusters.h" namespace clusters { diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/SecondServer.h b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/SecondServer.h index 71905bf252bd60..a0d24591b94c62 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/SecondServer.h +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/SecondServer.h @@ -1,6 +1,5 @@ #pragma once -#include "BridgeGlobalStructs.h" #include "GeneratedClusters.h" namespace clusters { diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/Third.h b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/Third.h index 3b15195c0af9e4..55344700f7814d 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/Third.h +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/Third.h @@ -1,6 +1,5 @@ #pragma once -#include "BridgeGlobalStructs.h" #include "GeneratedClusters.h" namespace clusters { diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/ThirdServer.h b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/ThirdServer.h index d2f8bccb12d648..67176424a52608 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/ThirdServer.h +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/bridge/ThirdServer.h @@ -1,6 +1,5 @@ #pragma once -#include "BridgeGlobalStructs.h" #include "GeneratedClusters.h" namespace clusters { diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/bridge/BridgeGlobalStructs.h b/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/bridge/BridgeGlobalStructs.h deleted file mode 100644 index d8fdc6c0b4556a..00000000000000 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/bridge/BridgeGlobalStructs.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -namespace clusters { - - - -} diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/bridge/MyClusterServer.h b/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/bridge/MyClusterServer.h index 831b39de9cfca4..47445252f41f77 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/bridge/MyClusterServer.h +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/bridge/MyClusterServer.h @@ -1,6 +1,5 @@ #pragma once -#include "BridgeGlobalStructs.h" #include "GeneratedClusters.h" namespace clusters { diff --git a/scripts/py_matter_yamltests/matter_yamltests/hooks.py b/scripts/py_matter_yamltests/matter_yamltests/hooks.py index 7e779420759e6c..6017dd68ad8f2f 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/hooks.py +++ b/scripts/py_matter_yamltests/matter_yamltests/hooks.py @@ -14,6 +14,7 @@ # limitations under the License. from .errors import TestStepError +from .parser import TestStep class TestParserHooks(): @@ -143,18 +144,18 @@ def step_skipped(self, name: str, expression: str): """ pass - def step_start(self, name: str): + def step_start(self, request: TestStep): """ This method is called when the runner starts running a step from the test. Parameters ---------- - name: str - The name of the test step that is starting. + request: TestStep + The original request as defined by the test step. """ pass - def step_success(self, logger, logs, duration: int, request): + def step_success(self, logger, logs, duration: int, request: TestStep): """ This method is called when running a step succeeds. @@ -169,12 +170,12 @@ def step_success(self, logger, logs, duration: int, request): duration: int How long it took to run the test step, in milliseconds. - request: + request: TestStep The original request as defined by the test step. """ pass - def step_failure(self, logger, logs, duration: int, request, received): + def step_failure(self, logger, logs, duration: int, request: TestStep, received): """ This method is called when running a step fails. @@ -189,7 +190,7 @@ def step_failure(self, logger, logs, duration: int, request, received): duration: int How long it took to run the test step, in milliseconds. - request: + request: TestStep The original request as defined by the test step. received: diff --git a/scripts/py_matter_yamltests/matter_yamltests/parser_config.py b/scripts/py_matter_yamltests/matter_yamltests/parser_config.py index 251aa5ebb17266..17b19f2b4588ef 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/parser_config.py +++ b/scripts/py_matter_yamltests/matter_yamltests/parser_config.py @@ -29,7 +29,7 @@ def get_config(test_file: str): config_options = {} yaml_loader = YamlLoader() - _, _, config, _ = yaml_loader.load(test_file) + _, _, _, config, _ = yaml_loader.load(test_file) config_options = {key: value if not isinstance( value, dict) else value['defaultValue'] for key, value in config.items()} return config_options diff --git a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/log_commands.py b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/log_commands.py index 00a98e285c84e6..16bb5ebe2e370a 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/log_commands.py +++ b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/log_commands.py @@ -39,7 +39,17 @@ class LogCommands(PseudoCluster): definition = _DEFINITION async def UserPrompt(self, request): - pass + expected_value = None + for value in request.arguments.get("values", []): + if value.get('name') and 'expectedValue' in value['name']: + expected_value = value['value'] + request.responses = [{"values": [{"name": "expectedValue", "value": expected_value}]}] + + if expected_value is not None: + input_result = input("") + return {"value": {"expectedValue": input_result}} + + return {} async def Log(self, request): pass diff --git a/scripts/py_matter_yamltests/matter_yamltests/runner.py b/scripts/py_matter_yamltests/matter_yamltests/runner.py index 6f201c8ea6ad74..9d560216321494 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/runner.py +++ b/scripts/py_matter_yamltests/matter_yamltests/runner.py @@ -180,11 +180,11 @@ async def _run(self, parser: TestParser, config: TestRunnerConfig): hooks.step_skipped(request.label, request.pics) continue elif not config.adapter: - hooks.step_start(request.label) + hooks.step_start(request) hooks.step_unknown() continue else: - hooks.step_start(request.label) + hooks.step_start(request) start = time.time() if config.pseudo_clusters.supports(request): diff --git a/scripts/rules.matterlint b/scripts/rules.matterlint index 9aac905e0db834..af393232526ef3 100644 --- a/scripts/rules.matterlint +++ b/scripts/rules.matterlint @@ -80,7 +80,7 @@ load "../src/app/zap-templates/zcl/data-model/draft/electrical-measurement-clust load "../src/app/zap-templates/zcl/data-model/draft/input-output-value-clusters.xml"; load "../src/app/zap-templates/zcl/data-model/draft/onoff-switch-configuration-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/air-quality-cluster.xml"; -load "../src/app/zap-templates/zcl/data-model/chip/replacable-monitoring-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.xml"; all endpoints { // These attributes follow a different code path and do not have to be diff --git a/scripts/tests/yaml/tests_logger.py b/scripts/tests/yaml/tests_logger.py index 0f718e243dbbb8..f01b0d28ec26a4 100755 --- a/scripts/tests/yaml/tests_logger.py +++ b/scripts/tests/yaml/tests_logger.py @@ -23,6 +23,7 @@ import click from matter_yamltests.errors import TestStepError, TestStepKeyError from matter_yamltests.hooks import TestParserHooks, TestRunnerHooks, WebSocketRunnerHooks +from matter_yamltests.parser import TestStep def _strikethrough(str): @@ -193,11 +194,16 @@ def step_skipped(self, name: str, expression: str): self.__index += 1 self.__skipped += 1 - def step_start(self, name: str): + def step_start(self, request: TestStep): if self.__use_test_harness_log_format: - print(self.__strings.test_harness_step_start.format(index=self.__index, name=name)) - - print(self.__strings.step_start.format(index=self.__index, name=click.style(name, bold=True)), end='') + print(self.__strings.test_harness_step_start.format(index=self.__index, name=request.label)) + + print(self.__strings.step_start.format(index=self.__index, name=click.style(request.label, bold=True)), end='') + # This is to keep previous behavior of UserPrompt. Where it logs USER_PROMPT prior to user input. See link below: + # https://github.com/project-chip/connectedhomeip/blob/6644a4b0b0d1272ae325c651b27bd0e7068f3a8a/src/app/tests/suites/commands/log/LogCommands.cpp#L31 + if request.command == 'UserPrompt': + message = request.arguments['values'][0]['value'] + print("\n" + self.__strings.user_prompt.format(message=f'{message}')) # flushing stdout such that the previous print statement is visible on the screen for long running tasks. sys.stdout.flush() @@ -208,7 +214,7 @@ def step_unknown(self): self.__runned += 1 - def step_success(self, logger, logs, duration: int, request): + def step_success(self, logger, logs, duration: int, request: TestStep): print(self.__strings.step_result.format(state=_SUCCESS, duration=duration)) self.__print_results(logger) @@ -218,9 +224,6 @@ def step_success(self, logger, logs, duration: int, request): elif request.command == 'Log': message = request.arguments['values'][0]['value'] print(self.__strings.log.format(message=f'{message}')) - elif request.command == 'UserPrompt': - message = request.arguments['values'][0]['value'] - print(self.__strings.user_prompt.format(message=f'{message}')) if self.__show_adapter_logs: self.__log_printer.print(logs) @@ -230,7 +233,7 @@ def step_success(self, logger, logs, duration: int, request): self.__errors += logger.errors self.__runned += 1 - def step_failure(self, logger, logs, duration: int, request, received): + def step_failure(self, logger, logs, duration: int, request: TestStep, received): print(self.__strings.step_result.format(state=_FAILURE, duration=duration)) self.__print_results(logger) diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index a0a46f1a02e74a..29abc1f321a9bd 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -559,7 +559,6 @@ CHIP_ERROR CommandHandler::RollbackResponse() { VerifyOrReturnError(mState == State::Preparing || mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); mInvokeResponseBuilder.Rollback(mBackupWriter); - mInvokeResponseBuilder.ResetError(); // Note: We only support one command per request, so we reset the state to Idle here, need to review the states when adding // supports of having multiple requests in the same transaction. MoveToState(State::Idle); diff --git a/src/app/MessageDef/Builder.h b/src/app/MessageDef/Builder.h index 5585bb8deadb62..f3609953c3a5ab 100644 --- a/src/app/MessageDef/Builder.h +++ b/src/app/MessageDef/Builder.h @@ -81,9 +81,13 @@ class Builder /** * Rollback the request state to the checkpointed TLVWriter * - * @param[in] aPoint A that captured the state via Checkpoint() at some point in the past + * @param[in] aPoint A writer that captured the state via Checkpoint() at some point in the past */ - void Rollback(const chip::TLV::TLVWriter & aPoint) { *mpWriter = aPoint; } + void Rollback(const chip::TLV::TLVWriter & aPoint) + { + *mpWriter = aPoint; + ResetError(); + } void EndOfContainer(); diff --git a/src/app/WriteClient.cpp b/src/app/WriteClient.cpp index b8ddf5400fcb9e..da24d058f1c40a 100644 --- a/src/app/WriteClient.cpp +++ b/src/app/WriteClient.cpp @@ -240,7 +240,6 @@ CHIP_ERROR WriteClient::PutSinglePreencodedAttributeWritePayload(const chip::app { // If it failed with no memory, then we create a new chunk for it. mWriteRequestBuilder.GetWriteRequests().Rollback(backupWriter); - mWriteRequestBuilder.GetWriteRequests().ResetError(); ReturnErrorOnFailure(StartNewMessage()); err = TryPutSinglePreencodedAttributeWritePayload(attributePath, data); // Since we have created a new chunk for this element, the encode is expected to succeed. diff --git a/src/app/WriteClient.h b/src/app/WriteClient.h index af89a50f90b796..99c8682605c569 100644 --- a/src/app/WriteClient.h +++ b/src/app/WriteClient.h @@ -297,7 +297,6 @@ class WriteClient : public Messaging::ExchangeDelegate { // If it failed with no memory, then we create a new chunk for it. mWriteRequestBuilder.GetWriteRequests().Rollback(backupWriter); - mWriteRequestBuilder.GetWriteRequests().ResetError(); ReturnErrorOnFailure(StartNewMessage()); ReturnErrorOnFailure(TryEncodeSingleAttributeDataIB(attributePath, value)); } diff --git a/src/app/WriteHandler.cpp b/src/app/WriteHandler.cpp index d262dd522d5525..c0bc52b1f2ae71 100644 --- a/src/app/WriteHandler.cpp +++ b/src/app/WriteHandler.cpp @@ -330,7 +330,7 @@ CHIP_ERROR WriteHandler::ProcessAttributeDataIBs(TLV::TLVReader & aAttributeData MatterPreAttributeWriteCallback(dataAttributePath); TLV::TLVWriter backup; DataVersion version = 0; - mWriteResponseBuilder.Checkpoint(backup); + mWriteResponseBuilder.GetWriteResponses().Checkpoint(backup); err = element.GetDataVersion(&version); if (CHIP_NO_ERROR == err) { @@ -344,7 +344,7 @@ CHIP_ERROR WriteHandler::ProcessAttributeDataIBs(TLV::TLVReader & aAttributeData err = WriteSingleClusterData(subjectDescriptor, dataAttributePath, dataReader, this); if (err != CHIP_NO_ERROR) { - mWriteResponseBuilder.Rollback(backup); + mWriteResponseBuilder.GetWriteResponses().Rollback(backup); err = AddStatus(dataAttributePath, StatusIB(err)); } MatterPostAttributeWriteCallback(dataAttributePath); diff --git a/src/app/chip_data_model.cmake b/src/app/chip_data_model.cmake index e1c8a6e03f2e41..80ad1ded379b0c 100644 --- a/src/app/chip_data_model.cmake +++ b/src/app/chip_data_model.cmake @@ -138,7 +138,6 @@ function(chip_configure_data_model APP_TARGET) # ${CHIP_APP_BASE_DIR}/util/ClientMonitoringRegistrationTable.cpp ${CHIP_APP_BASE_DIR}/util/DataModelHandler.cpp ${CHIP_APP_BASE_DIR}/util/ember-compatibility-functions.cpp - ${CHIP_APP_BASE_DIR}/util/ember-print.cpp ${CHIP_APP_BASE_DIR}/util/error-mapping.cpp ${CHIP_APP_BASE_DIR}/util/generic-callback-stubs.cpp ${CHIP_APP_BASE_DIR}/util/message.cpp diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index 3176ce4e9b6005..48dfa7da9428b2 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -173,7 +173,6 @@ template("chip_data_model") { "${_app_root}/util/binding-table.cpp", "${_app_root}/util/binding-table.h", "${_app_root}/util/ember-compatibility-functions.cpp", - "${_app_root}/util/ember-print.cpp", "${_app_root}/util/error-mapping.cpp", "${_app_root}/util/generic-callback-stubs.cpp", "${_app_root}/util/message.cpp", diff --git a/src/app/clusters/account-login-server/account-login-server.cpp b/src/app/clusters/account-login-server/account-login-server.cpp index da1cafacbd51ad..b9a05b8bc65cc8 100644 --- a/src/app/clusters/account-login-server/account-login-server.cpp +++ b/src/app/clusters/account-login-server/account-login-server.cpp @@ -46,7 +46,7 @@ using chip::Protocols::InteractionModel::Status; static constexpr size_t kAccountLoginDeletageTableSize = EMBER_AF_ACCOUNT_LOGIN_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; - +static_assert(kAccountLoginDeletageTableSize <= kEmberInvalidEndpointIndex, "AccountLogin Delegate table size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -66,8 +66,9 @@ Delegate * GetDelegate(EndpointId endpoint) #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED ChipLogProgress(Zcl, "AccountLogin NOT returning ContentApp delegate for endpoint:%u", endpoint); - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, AccountLogin::Id); - return ((ep == 0xFFFF || ep >= EMBER_AF_ACCOUNT_LOGIN_CLUSTER_SERVER_ENDPOINT_COUNT) ? nullptr : gDelegateTable[ep]); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, AccountLogin::Id, EMBER_AF_ACCOUNT_LOGIN_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kAccountLoginDeletageTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -88,9 +89,10 @@ namespace AccountLogin { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, AccountLogin::Id); - // if endpoint is found and is not a dynamic endpoint - if (ep != 0xFFFF && ep < EMBER_AF_ACCOUNT_LOGIN_CLUSTER_SERVER_ENDPOINT_COUNT) + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, AccountLogin::Id, EMBER_AF_ACCOUNT_LOGIN_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found + if (ep < kAccountLoginDeletageTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp index 8232e5f51eb924..81dd97503e36af 100644 --- a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp +++ b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp @@ -207,6 +207,6 @@ bool emberAfAdministratorCommissioningClusterRevokeCommissioningCallback( void MatterAdministratorCommissioningPluginServerInitCallback() { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Initiating Admin Commissioning cluster."); + ChipLogProgress(Zcl, "Initiating Admin Commissioning cluster."); registerAttributeAccessOverride(&gAdminCommissioningAttrAccess); } diff --git a/src/app/clusters/application-basic-server/application-basic-server.cpp b/src/app/clusters/application-basic-server/application-basic-server.cpp index c71282933e3646..e2bf100aea2358 100644 --- a/src/app/clusters/application-basic-server/application-basic-server.cpp +++ b/src/app/clusters/application-basic-server/application-basic-server.cpp @@ -45,6 +45,7 @@ using namespace chip::AppPlatform; static constexpr size_t kApplicationBasicDelegateTableSize = EMBER_AF_APPLICATION_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kApplicationBasicDelegateTableSize <= kEmberInvalidEndpointIndex, "ApplicationBasic Delegate table size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -67,8 +68,9 @@ Delegate * GetDelegate(EndpointId endpoint) #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED ChipLogProgress(Zcl, "ApplicationBasic NOT returning ContentApp delegate for endpoint:%u", endpoint); - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::ApplicationBasic::Id); - return ((ep == 0xFFFF || ep >= EMBER_AF_APPLICATION_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT) ? nullptr : gDelegateTable[ep]); + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, chip::app::Clusters::ApplicationBasic::Id, + EMBER_AF_APPLICATION_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kApplicationBasicDelegateTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -89,9 +91,10 @@ namespace ApplicationBasic { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, ApplicationBasic::Id); - // if endpoint is found and is not a dynamic endpoint - if (ep != 0xFFFF && ep < EMBER_AF_APPLICATION_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT) + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, ApplicationBasic::Id, + EMBER_AF_APPLICATION_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found + if (ep < kApplicationBasicDelegateTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/application-launcher-server/application-launcher-server.cpp b/src/app/clusters/application-launcher-server/application-launcher-server.cpp index e3ed24e0ad39ea..982f1e8249548b 100644 --- a/src/app/clusters/application-launcher-server/application-launcher-server.cpp +++ b/src/app/clusters/application-launcher-server/application-launcher-server.cpp @@ -49,6 +49,7 @@ using namespace chip::Uint8; static constexpr size_t kApplicationLauncherDelegateTableSize = EMBER_AF_APPLICATION_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kApplicationLauncherDelegateTableSize <= kEmberInvalidEndpointIndex, "ApplicationLauncher Delegate table size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -74,8 +75,9 @@ Delegate * GetDelegate(EndpointId endpoint) #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED ChipLogProgress(Zcl, "ApplicationLauncher NOT returning ContentApp delegate for endpoint:%u", endpoint); - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, ApplicationLauncher::Id); - return ((ep == 0xFFFF || ep >= EMBER_AF_APPLICATION_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT) ? nullptr : gDelegateTable[ep]); + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, ApplicationLauncher::Id, + EMBER_AF_APPLICATION_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kApplicationLauncherDelegateTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -96,9 +98,10 @@ namespace ApplicationLauncher { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, ApplicationLauncher::Id); - // if endpoint is found and is not a dynamic endpoint - if (ep != 0xFFFF && ep < EMBER_AF_APPLICATION_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT) + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, ApplicationLauncher::Id, + EMBER_AF_APPLICATION_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found + if (ep < kApplicationLauncherDelegateTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/audio-output-server/audio-output-server.cpp b/src/app/clusters/audio-output-server/audio-output-server.cpp index 81b94192fbb2d7..d73f340547ce47 100644 --- a/src/app/clusters/audio-output-server/audio-output-server.cpp +++ b/src/app/clusters/audio-output-server/audio-output-server.cpp @@ -40,6 +40,7 @@ using chip::Protocols::InteractionModel::Status; static constexpr size_t kAudioOutputDelegateTableSize = EMBER_AF_AUDIO_OUTPUT_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kAudioOutputDelegateTableSize <= kEmberInvalidEndpointIndex, "AudioOutput Delegate table size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -52,8 +53,9 @@ Delegate * gDelegateTable[kAudioOutputDelegateTableSize] = { nullptr }; Delegate * GetDelegate(EndpointId endpoint) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::AudioOutput::Id); - return (ep == 0xFFFF ? nullptr : gDelegateTable[ep]); + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, chip::app::Clusters::AudioOutput::Id, + EMBER_AF_AUDIO_OUTPUT_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kAudioOutputDelegateTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -74,8 +76,9 @@ namespace AudioOutput { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::AudioOutput::Id); - if (ep != 0xFFFF) + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, chip::app::Clusters::AudioOutput::Id, + EMBER_AF_AUDIO_OUTPUT_CLUSTER_SERVER_ENDPOINT_COUNT); + if (ep < kAudioOutputDelegateTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/barrier-control-server/barrier-control-server.cpp b/src/app/clusters/barrier-control-server/barrier-control-server.cpp index cea4812b546f3d..a7531aee1bcf91 100644 --- a/src/app/clusters/barrier-control-server/barrier-control-server.cpp +++ b/src/app/clusters/barrier-control-server/barrier-control-server.cpp @@ -288,7 +288,7 @@ static void sendDefaultResponse(app::CommandHandler * commandObj, const app::Con { if (commandObj->AddStatus(commandPath, status) != CHIP_NO_ERROR) { - emberAfBarrierControlClusterPrintln("Failed to send default response"); + ChipLogProgress(Zcl, "Failed to send default response"); } } @@ -301,7 +301,7 @@ bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback( EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; - emberAfBarrierControlClusterPrintln("RX: GoToPercentCallback p=%d", percentOpen); + ChipLogProgress(Zcl, "RX: GoToPercentCallback p=%d", percentOpen); if (isRemoteLockoutOn(endpoint)) { @@ -319,8 +319,8 @@ bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback( state.currentPosition = getCurrentPosition(endpoint); state.targetPosition = percentOpen; state.delayMs = calculateDelayMs(endpoint, state.targetPosition, &state.increasing); - emberAfBarrierControlClusterPrintln("Scheduling barrier move from %d to %d with %" PRIu32 "ms delay", state.currentPosition, - state.targetPosition, state.delayMs); + ChipLogProgress(Zcl, "Scheduling barrier move from %d to %d with %" PRIu32 "ms delay", state.currentPosition, + state.targetPosition, state.delayMs); scheduleTimerCallbackMs(endpoint, state.delayMs); if (state.currentPosition < state.targetPosition) @@ -353,6 +353,6 @@ void MatterBarrierControlPluginServerInitCallback() {} void MatterBarrierControlClusterServerShutdownCallback(EndpointId endpoint) { - emberAfBarrierControlClusterPrintln("Shuting barrier control server cluster on endpoint %d", endpoint); + ChipLogProgress(Zcl, "Shuting barrier control server cluster on endpoint %d", endpoint); cancelEndpointTimerCallback(endpoint); } diff --git a/src/app/clusters/channel-server/channel-server.cpp b/src/app/clusters/channel-server/channel-server.cpp index 72c0f59b06a66d..eaf4958270b2a0 100644 --- a/src/app/clusters/channel-server/channel-server.cpp +++ b/src/app/clusters/channel-server/channel-server.cpp @@ -39,6 +39,7 @@ using chip::Protocols::InteractionModel::Status; static constexpr size_t kChannelDelegateTableSize = EMBER_AF_CHANNEL_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kChannelDelegateTableSize <= kEmberInvalidEndpointIndex, "Channel Delegate table size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -61,8 +62,8 @@ Delegate * GetDelegate(EndpointId endpoint) #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED ChipLogProgress(Zcl, "Channel NOT returning ContentApp delegate for endpoint:%u", endpoint); - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, Channel::Id); - return ((ep == 0xFFFF || ep >= EMBER_AF_CHANNEL_CLUSTER_SERVER_ENDPOINT_COUNT) ? nullptr : gDelegateTable[ep]); + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Channel::Id, EMBER_AF_CHANNEL_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kChannelDelegateTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -83,9 +84,9 @@ namespace Channel { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, Channel::Id); - // if endpoint is found and is not a dynamic endpoint - if (ep != 0xFFFF && ep < EMBER_AF_CHANNEL_CLUSTER_SERVER_ENDPOINT_COUNT) + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Channel::Id, EMBER_AF_CHANNEL_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found + if (ep < kChannelDelegateTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index e80e87b0ea9440..6a9e7db0e8161e 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -301,7 +301,8 @@ uint16_t ColorControlServer::computeTransitionTimeFromStateAndRate(ColorControlS */ EmberEventControl * ColorControlServer::getEventControl(EndpointId endpoint) { - uint16_t index = emberAfFindClusterServerEndpointIndex(endpoint, ColorControl::Id); + uint16_t index = + emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); EmberEventControl * event = nullptr; if (index < ArraySize(eventControls)) @@ -424,7 +425,8 @@ bool ColorControlServer::computeNewColor16uValue(ColorControlServer::Color16uTra */ ColorControlServer::ColorHueTransitionState * ColorControlServer::getColorHueTransitionState(EndpointId endpoint) { - uint16_t index = emberAfFindClusterServerEndpointIndex(endpoint, ColorControl::Id); + uint16_t index = + emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); ColorHueTransitionState * state = nullptr; if (index < ArraySize(colorHueTransitionStates)) @@ -442,7 +444,8 @@ ColorControlServer::ColorHueTransitionState * ColorControlServer::getColorHueTra */ ColorControlServer::Color16uTransitionState * ColorControlServer::getSaturationTransitionState(EndpointId endpoint) { - uint16_t index = emberAfFindClusterServerEndpointIndex(endpoint, ColorControl::Id); + uint16_t index = + emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); Color16uTransitionState * state = nullptr; if (index < ArraySize(colorSatTransitionStates)) @@ -1646,7 +1649,7 @@ void ColorControlServer::updateHueSatCommand(EndpointId endpoint) Attributes::EnhancedCurrentHue::Set(endpoint, colorHueTransitionState->currentEnhancedHue); Attributes::CurrentHue::Set(endpoint, static_cast(colorHueTransitionState->currentEnhancedHue >> 8)); - emberAfColorControlClusterPrintln("Enhanced Hue %d endpoint %d", colorHueTransitionState->currentEnhancedHue, endpoint); + ChipLogProgress(Zcl, "Enhanced Hue %d endpoint %d", colorHueTransitionState->currentEnhancedHue, endpoint); } } else @@ -1654,7 +1657,7 @@ void ColorControlServer::updateHueSatCommand(EndpointId endpoint) if (previousHue != colorHueTransitionState->currentHue) { Attributes::CurrentHue::Set(colorHueTransitionState->endpoint, colorHueTransitionState->currentHue); - emberAfColorControlClusterPrintln("Hue %d endpoint %d", colorHueTransitionState->currentHue, endpoint); + ChipLogProgress(Zcl, "Hue %d endpoint %d", colorHueTransitionState->currentHue, endpoint); } } @@ -1662,7 +1665,7 @@ void ColorControlServer::updateHueSatCommand(EndpointId endpoint) { Attributes::CurrentSaturation::Set(colorSaturationTransitionState->endpoint, (uint8_t) colorSaturationTransitionState->currentValue); - emberAfColorControlClusterPrintln("Saturation %d endpoint %d", colorSaturationTransitionState->currentValue, endpoint); + ChipLogProgress(Zcl, "Saturation %d endpoint %d", colorSaturationTransitionState->currentValue, endpoint); } computePwmFromHsv(endpoint); @@ -1680,7 +1683,8 @@ void ColorControlServer::updateHueSatCommand(EndpointId endpoint) */ ColorControlServer::Color16uTransitionState * ColorControlServer::getXTransitionState(EndpointId endpoint) { - uint16_t index = emberAfFindClusterServerEndpointIndex(endpoint, ColorControl::Id); + uint16_t index = + emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); Color16uTransitionState * state = nullptr; if (index < ArraySize(colorXtransitionStates)) @@ -1699,7 +1703,8 @@ ColorControlServer::Color16uTransitionState * ColorControlServer::getXTransition */ ColorControlServer::Color16uTransitionState * ColorControlServer::getYTransitionState(EndpointId endpoint) { - uint16_t index = emberAfFindClusterServerEndpointIndex(endpoint, ColorControl::Id); + uint16_t index = + emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); Color16uTransitionState * state = nullptr; if (index < ArraySize(colorYtransitionStates)) @@ -2009,8 +2014,7 @@ void ColorControlServer::updateXYCommand(EndpointId endpoint) Attributes::CurrentX::Set(endpoint, colorXTransitionState->currentValue); Attributes::CurrentY::Set(endpoint, colorYTransitionState->currentValue); - emberAfColorControlClusterPrintln("Color X %d Color Y %d", colorXTransitionState->currentValue, - colorYTransitionState->currentValue); + ChipLogProgress(Zcl, "Color X %d Color Y %d", colorXTransitionState->currentValue, colorYTransitionState->currentValue); computePwmFromXy(endpoint); } @@ -2026,7 +2030,8 @@ void ColorControlServer::updateXYCommand(EndpointId endpoint) */ ColorControlServer::Color16uTransitionState * ColorControlServer::getTempTransitionState(EndpointId endpoint) { - uint16_t index = emberAfFindClusterServerEndpointIndex(endpoint, ColorControl::Id); + uint16_t index = + emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); Color16uTransitionState * state = nullptr; if (index < ArraySize(colorTempTransitionStates)) @@ -2209,7 +2214,7 @@ void ColorControlServer::updateTempCommand(EndpointId endpoint) Attributes::ColorTemperatureMireds::Set(endpoint, colorTempTransitionState->currentValue); - emberAfColorControlClusterPrintln("Color Temperature %d", colorTempTransitionState->currentValue); + ChipLogProgress(Zcl, "Color Temperature %d", colorTempTransitionState->currentValue); computePwmFromTemp(endpoint); } @@ -2699,7 +2704,7 @@ void emberAfColorControlClusterServerInitCallback(EndpointId endpoint) void MatterColorControlClusterServerShutdownCallback(EndpointId endpoint) { - emberAfColorControlClusterPrintln("Shuting down color control server cluster on endpoint %d", endpoint); + ChipLogProgress(Zcl, "Shuting down color control server cluster on endpoint %d", endpoint); ColorControlServer::Instance().cancelEndpointTimerCallback(endpoint); } diff --git a/src/app/clusters/color-control-server/color-control-server.h b/src/app/clusters/color-control-server/color-control-server.h index e9a87182770fb8..5f73e6a37475e3 100644 --- a/src/app/clusters/color-control-server/color-control-server.h +++ b/src/app/clusters/color-control-server/color-control-server.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -237,22 +238,25 @@ class ColorControlServer * Attributes Declaration *********************************************************/ static ColorControlServer instance; + static constexpr size_t kColorControlClusterServerMaxEndpointCount = + EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; + static_assert(kColorControlClusterServerMaxEndpointCount <= kEmberInvalidEndpointIndex, "ColorControl endpoint count error"); #ifdef EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_HSV - ColorHueTransitionState colorHueTransitionStates[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; - Color16uTransitionState colorSatTransitionStates[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; + ColorHueTransitionState colorHueTransitionStates[kColorControlClusterServerMaxEndpointCount]; + Color16uTransitionState colorSatTransitionStates[kColorControlClusterServerMaxEndpointCount]; #endif #ifdef EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_XY - Color16uTransitionState colorXtransitionStates[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; - Color16uTransitionState colorYtransitionStates[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; + Color16uTransitionState colorXtransitionStates[kColorControlClusterServerMaxEndpointCount]; + Color16uTransitionState colorYtransitionStates[kColorControlClusterServerMaxEndpointCount]; #endif // EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_XY #ifdef EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP - Color16uTransitionState colorTempTransitionStates[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; + Color16uTransitionState colorTempTransitionStates[kColorControlClusterServerMaxEndpointCount]; #endif // EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP - EmberEventControl eventControls[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; + EmberEventControl eventControls[kColorControlClusterServerMaxEndpointCount]; }; /********************************************************** diff --git a/src/app/clusters/content-launch-server/content-launch-server.cpp b/src/app/clusters/content-launch-server/content-launch-server.cpp index f5a700ff8a972d..fc0321ecb296f9 100644 --- a/src/app/clusters/content-launch-server/content-launch-server.cpp +++ b/src/app/clusters/content-launch-server/content-launch-server.cpp @@ -44,6 +44,7 @@ using chip::Protocols::InteractionModel::Status; static constexpr size_t kContentLaunchDelegateTableSize = EMBER_AF_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kContentLaunchDelegateTableSize < kEmberInvalidEndpointIndex, "ContentLaunch Delegate table size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -66,8 +67,9 @@ Delegate * GetDelegate(EndpointId endpoint) #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED ChipLogProgress(Zcl, "Content Launcher NOT returning ContentApp delegate for endpoint:%u", endpoint); - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, ContentLauncher::Id); - return ((ep == 0xFFFF || ep >= EMBER_AF_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT) ? nullptr : gDelegateTable[ep]); + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, ContentLauncher::Id, + EMBER_AF_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kContentLaunchDelegateTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -88,9 +90,10 @@ namespace ContentLauncher { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, ContentLauncher::Id); - // if endpoint is found and is not a dynamic endpoint - if (ep != 0xFFFF && ep < EMBER_AF_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT) + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, ContentLauncher::Id, + EMBER_AF_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found + if (ep < kContentLaunchDelegateTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index ef9101a7807dd7..dbfd723ad8cfff 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -82,7 +82,7 @@ DoorLockServer & DoorLockServer::Instance() */ void DoorLockServer::InitServer(chip::EndpointId endpointId) { - emberAfDoorLockClusterPrintln("Door Lock cluster initialized at endpoint #%u", endpointId); + ChipLogProgress(Zcl, "Door Lock cluster initialized at endpoint #%u", endpointId); auto status = Attributes::LockState::SetNull(endpointId); if (EMBER_ZCL_STATUS_SUCCESS != status) @@ -214,8 +214,8 @@ bool DoorLockServer::HandleWrongCodeEntry(chip::EndpointId endpointId) { if (++endpointContext->wrongCodeEntryAttempts >= wrongCodeEntryLimit) { - emberAfDoorLockClusterPrintln("Too many wrong code entry attempts, engaging lockout [endpoint=%d,wrongCodeAttempts=%d]", - endpointId, endpointContext->wrongCodeEntryAttempts); + ChipLogProgress(Zcl, "Too many wrong code entry attempts, engaging lockout [endpoint=%d,wrongCodeAttempts=%d]", + endpointId, endpointContext->wrongCodeEntryAttempts); engageLockout(endpointId); } } @@ -264,7 +264,7 @@ bool DoorLockServer::engageLockout(chip::EndpointId endpointId) endpointContext->lockoutEndTimestamp = chip::System::SystemClock().GetMonotonicTimestamp() + chip::System::Clock::Seconds32(lockoutTimeout); - emberAfDoorLockClusterPrintln("Lockout engaged [endpointId=%d,lockoutTimeout=%d]", endpointId, lockoutTimeout); + ChipLogProgress(Zcl, "Lockout engaged [endpointId=%d,lockoutTimeout=%d]", endpointId, lockoutTimeout); SendLockAlarmEvent(endpointId, AlarmCodeEnum::kWrongCodeEntryLimit); @@ -346,11 +346,11 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb const chip::app::Clusters::DoorLock::Commands::SetUser::DecodableType & commandData) { auto & userIndex = commandData.userIndex; - emberAfDoorLockClusterPrintln("[SetUser] Incoming command [endpointId=%d,userIndex=%d]", commandPath.mEndpointId, userIndex); + ChipLogProgress(Zcl, "[SetUser] Incoming command [endpointId=%d,userIndex=%d]", commandPath.mEndpointId, userIndex); if (!SupportsUSR(commandPath.mEndpointId)) { - emberAfDoorLockClusterPrintln("[SetUser] User management is not supported [endpointId=%d]", commandPath.mEndpointId); + ChipLogProgress(Zcl, "[SetUser] User management is not supported [endpointId=%d]", commandPath.mEndpointId); sendClusterResponse(commandObj, commandPath, EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND); return; } @@ -382,8 +382,7 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb if (!userIndexValid(commandPath.mEndpointId, userIndex)) { - emberAfDoorLockClusterPrintln("[SetUser] User index out of bounds [endpointId=%d,userIndex=%d]", commandPath.mEndpointId, - userIndex); + ChipLogProgress(Zcl, "[SetUser] User index out of bounds [endpointId=%d,userIndex=%d]", commandPath.mEndpointId, userIndex); sendClusterResponse(commandObj, commandPath, EMBER_ZCL_STATUS_INVALID_COMMAND); return; } @@ -391,9 +390,8 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb // appclusters, 5.2.4.34: UserName has maximum DOOR_LOCK_MAX_USER_NAME_SIZE (10) characters excluding NUL terminator in it. if (!userName.IsNull() && userName.Value().size() > DOOR_LOCK_MAX_USER_NAME_SIZE) { - emberAfDoorLockClusterPrintln( - "[SetUser] Unable to set user: userName too long [endpointId=%d,userIndex=%d,userNameSize=%u]", commandPath.mEndpointId, - userIndex, static_cast(userName.Value().size())); + ChipLogProgress(Zcl, "[SetUser] Unable to set user: userName too long [endpointId=%d,userIndex=%d,userNameSize=%u]", + commandPath.mEndpointId, userIndex, static_cast(userName.Value().size())); sendClusterResponse(commandObj, commandPath, EMBER_ZCL_STATUS_INVALID_COMMAND); return; @@ -401,9 +399,9 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb if (!IsValidUserStatusForSet(userStatus)) { - emberAfDoorLockClusterPrintln( - "[SetUser] Unable to set the user: user status is out of range [endpointId=%d,userIndex=%d,userStatus=%u]", - commandPath.mEndpointId, userIndex, to_underlying(userStatus.Value())); + ChipLogProgress(Zcl, + "[SetUser] Unable to set the user: user status is out of range [endpointId=%d,userIndex=%d,userStatus=%u]", + commandPath.mEndpointId, userIndex, to_underlying(userStatus.Value())); sendClusterResponse(commandObj, commandPath, EMBER_ZCL_STATUS_INVALID_COMMAND); return; @@ -411,9 +409,8 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb if (userType == UserTypeEnum::kUnknownEnumValue) { - emberAfDoorLockClusterPrintln( - "[SetUser] Unable to set the user: user type is unknown [endpointId=%d,userIndex=%d,userType=%u]", - commandPath.mEndpointId, userIndex, to_underlying(userType.Value())); + ChipLogProgress(Zcl, "[SetUser] Unable to set the user: user type is unknown [endpointId=%d,userIndex=%d,userType=%u]", + commandPath.mEndpointId, userIndex, to_underlying(userType.Value())); sendClusterResponse(commandObj, commandPath, EMBER_ZCL_STATUS_INVALID_COMMAND); return; @@ -435,8 +432,8 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb // appclusters, 5.2.4.34: SetUser command allow only kAdd/kModify, we should respond with INVALID_COMMAND if we got kClear // or anything else status = EMBER_ZCL_STATUS_INVALID_COMMAND; - emberAfDoorLockClusterPrintln("[SetUser] Invalid operation type [endpointId=%d,operationType=%u]", commandPath.mEndpointId, - to_underlying(operationType)); + ChipLogProgress(Zcl, "[SetUser] Invalid operation type [endpointId=%d,operationType=%u]", commandPath.mEndpointId, + to_underlying(operationType)); break; } @@ -446,11 +443,11 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb void DoorLockServer::getUserCommandHandler(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, uint16_t userIndex) { - emberAfDoorLockClusterPrintln("[GetUser] Incoming command [endpointId=%d,userIndex=%d]", commandPath.mEndpointId, userIndex); + ChipLogProgress(Zcl, "[GetUser] Incoming command [endpointId=%d,userIndex=%d]", commandPath.mEndpointId, userIndex); if (!SupportsUSR(commandPath.mEndpointId)) { - emberAfDoorLockClusterPrintln("[GetUser] User management is not supported [endpointId=%d]", commandPath.mEndpointId); + ChipLogProgress(Zcl, "[GetUser] User management is not supported [endpointId=%d]", commandPath.mEndpointId); commandObj->AddStatus(commandPath, Status::UnsupportedCommand); return; } @@ -458,8 +455,8 @@ void DoorLockServer::getUserCommandHandler(chip::app::CommandHandler * commandOb uint16_t maxNumberOfUsers = 0; if (!userIndexValid(commandPath.mEndpointId, userIndex, maxNumberOfUsers)) { - emberAfDoorLockClusterPrintln("[GetUser] User index out of bounds [userIndex=%d,numberOfTotalUsersSupported=%d]", userIndex, - maxNumberOfUsers); + ChipLogProgress(Zcl, "[GetUser] User index out of bounds [userIndex=%d,numberOfTotalUsersSupported=%d]", userIndex, + maxNumberOfUsers); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } @@ -481,7 +478,7 @@ void DoorLockServer::getUserCommandHandler(chip::app::CommandHandler * commandOb EmberAfPluginDoorLockUserInfo user; if (!emberAfPluginDoorLockGetUser(commandPath.mEndpointId, userIndex, user)) { - emberAfDoorLockClusterPrintln("[GetUser] Could not get user info [userIndex=%d]", userIndex); + ChipLogProgress(Zcl, "[GetUser] Could not get user info [userIndex=%d]", userIndex); commandObj->AddStatus(commandPath, Status::Failure); return; } @@ -491,12 +488,12 @@ void DoorLockServer::getUserCommandHandler(chip::app::CommandHandler * commandOb // appclusters, 5.2.4.36: we should not set user-specific fields to non-null if the user status is set to Available if (UserStatusEnum::kAvailable != user.userStatus) { - emberAfDoorLockClusterPrintln("Found user in storage: " - "[userIndex=%d,userName=\"%.*s\",userStatus=%u,userType=%u" - ",credentialRule=%u,createdBy=%u,modifiedBy=%u]", - userIndex, static_cast(user.userName.size()), user.userName.data(), - to_underlying(user.userStatus), to_underlying(user.userType), - to_underlying(user.credentialRule), user.createdBy, user.lastModifiedBy); + ChipLogProgress(Zcl, + "Found user in storage: " + "[userIndex=%d,userName=\"%.*s\",userStatus=%u,userType=%u" + ",credentialRule=%u,createdBy=%u,modifiedBy=%u]", + userIndex, static_cast(user.userName.size()), user.userName.data(), to_underlying(user.userStatus), + to_underlying(user.userType), to_underlying(user.credentialRule), user.createdBy, user.lastModifiedBy); response.userName.SetNonNull(user.userName); if (0xFFFFFFFFU != user.userUniqueId) @@ -519,7 +516,7 @@ void DoorLockServer::getUserCommandHandler(chip::app::CommandHandler * commandOb } else { - emberAfDoorLockClusterPrintln("[GetUser] User not found [userIndex=%d]", userIndex); + ChipLogProgress(Zcl, "[GetUser] User not found [userIndex=%d]", userIndex); } commandObj->AddResponse(commandPath, response); @@ -528,11 +525,11 @@ void DoorLockServer::getUserCommandHandler(chip::app::CommandHandler * commandOb void DoorLockServer::clearUserCommandHandler(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, uint16_t userIndex) { - emberAfDoorLockClusterPrintln("[ClearUser] Incoming command [endpointId=%d,userIndex=%d]", commandPath.mEndpointId, userIndex); + ChipLogProgress(Zcl, "[ClearUser] Incoming command [endpointId=%d,userIndex=%d]", commandPath.mEndpointId, userIndex); if (!SupportsUSR(commandPath.mEndpointId)) { - emberAfDoorLockClusterPrintln("[ClearUser] User management is not supported [endpointId=%d]", commandPath.mEndpointId); + ChipLogProgress(Zcl, "[ClearUser] User management is not supported [endpointId=%d]", commandPath.mEndpointId); commandObj->AddStatus(commandPath, Status::UnsupportedCommand); return; } @@ -558,8 +555,8 @@ void DoorLockServer::clearUserCommandHandler(chip::app::CommandHandler * command uint16_t maxNumberOfUsers = 0; if (!userIndexValid(commandPath.mEndpointId, userIndex, maxNumberOfUsers) && userIndex != 0xFFFE) { - emberAfDoorLockClusterPrintln("[ClearUser] User index out of bounds [userIndex=%d,numberOfTotalUsersSupported=%d]", - userIndex, maxNumberOfUsers); + ChipLogProgress(Zcl, "[ClearUser] User index out of bounds [userIndex=%d,numberOfTotalUsersSupported=%d]", userIndex, + maxNumberOfUsers); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } @@ -576,7 +573,7 @@ void DoorLockServer::clearUserCommandHandler(chip::app::CommandHandler * command return; } - emberAfDoorLockClusterPrintln("[ClearUser] Removing all users from storage"); + ChipLogProgress(Zcl, "[ClearUser] Removing all users from storage"); for (uint16_t i = 1; i <= maxNumberOfUsers; ++i) { auto status = clearUser(commandPath.mEndpointId, fabricIdx, sourceNodeId, i, false); @@ -589,7 +586,7 @@ void DoorLockServer::clearUserCommandHandler(chip::app::CommandHandler * command return; } } - emberAfDoorLockClusterPrintln("[ClearUser] Removed all users from storage [users=%d]", maxNumberOfUsers); + ChipLogProgress(Zcl, "[ClearUser] Removed all users from storage [users=%d]", maxNumberOfUsers); sendRemoteLockUserChange(commandPath.mEndpointId, LockDataTypeEnum::kUserIndex, DataOperationTypeEnum::kClear, sourceNodeId, fabricIdx, 0xFFFE, 0xFFFE); @@ -601,7 +598,7 @@ void DoorLockServer::setCredentialCommandHandler( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::SetCredential::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("[SetCredential] Incoming command [endpointId=%d]", commandPath.mEndpointId); + ChipLogProgress(Zcl, "[SetCredential] Incoming command [endpointId=%d]", commandPath.mEndpointId); auto fabricIdx = getFabricIndex(commandObj); if (kUndefinedFabricIndex == fabricIdx) @@ -629,8 +626,8 @@ void DoorLockServer::setCredentialCommandHandler( if (!credentialTypeSupported(commandPath.mEndpointId, credentialType)) { - emberAfDoorLockClusterPrintln("[SetCredential] Credential type is not supported [endpointId=%d,credentialType=%u]", - commandPath.mEndpointId, to_underlying(credentialType)); + ChipLogProgress(Zcl, "[SetCredential] Credential type is not supported [endpointId=%d,credentialType=%u]", + commandPath.mEndpointId, to_underlying(credentialType)); commandObj->AddStatus(commandPath, Status::UnsupportedCommand); return; } @@ -643,9 +640,10 @@ void DoorLockServer::setCredentialCommandHandler( uint16_t maxNumberOfCredentials = 0; if (!credentialIndexValid(commandPath.mEndpointId, credentialType, credentialIndex, maxNumberOfCredentials)) { - emberAfDoorLockClusterPrintln("[SetCredential] Credential index is out of range [endpointId=%d,credentialType=%u" - ",credentialIndex=%d]", - commandPath.mEndpointId, to_underlying(credentialType), credentialIndex); + ChipLogProgress(Zcl, + "[SetCredential] Credential index is out of range [endpointId=%d,credentialType=%u" + ",credentialIndex=%d]", + commandPath.mEndpointId, to_underlying(credentialType), credentialIndex); sendSetCredentialResponse(commandObj, commandPath, DlStatus::kInvalidField, 0, nextAvailableCredentialSlot); return; } @@ -664,20 +662,21 @@ void DoorLockServer::setCredentialCommandHandler( EmberAfPluginDoorLockCredentialInfo currentCredential; if (!emberAfPluginDoorLockGetCredential(commandPath.mEndpointId, i, credentialType, currentCredential)) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to get the credential to exclude duplicated entry " - "[endpointId=%d,credentialType=%u,credentialIndex=%d]", - commandPath.mEndpointId, to_underlying(credentialType), i); + ChipLogProgress(Zcl, + "[SetCredential] Unable to get the credential to exclude duplicated entry " + "[endpointId=%d,credentialType=%u,credentialIndex=%d]", + commandPath.mEndpointId, to_underlying(credentialType), i); sendSetCredentialResponse(commandObj, commandPath, DlStatus::kFailure, 0, nextAvailableCredentialSlot); return; } if (DlCredentialStatus::kAvailable != currentCredential.status && currentCredential.credentialType == credentialType && currentCredential.credentialData.data_equal(credentialData)) { - emberAfDoorLockClusterPrintln( - "[SetCredential] Credential with the same data and type already exist " - "[endpointId=%d,credentialType=%u,dataLength=%u,existingCredentialIndex=%d,credentialIndex=%d]", - commandPath.mEndpointId, to_underlying(credentialType), static_cast(credentialData.size()), i, - credentialIndex); + ChipLogProgress(Zcl, + "[SetCredential] Credential with the same data and type already exist " + "[endpointId=%d,credentialType=%u,dataLength=%u,existingCredentialIndex=%d,credentialIndex=%d]", + commandPath.mEndpointId, to_underlying(credentialType), + static_cast(credentialData.size()), i, credentialIndex); sendSetCredentialResponse(commandObj, commandPath, DlStatus::kDuplicate, 0, nextAvailableCredentialSlot); return; } @@ -686,9 +685,8 @@ void DoorLockServer::setCredentialCommandHandler( EmberAfPluginDoorLockCredentialInfo existingCredential; if (!emberAfPluginDoorLockGetCredential(commandPath.mEndpointId, credentialIndex, credentialType, existingCredential)) { - emberAfDoorLockClusterPrintln( - "[SetCredential] Unable to check if credential exists: app error [endpointId=%d,credentialIndex=%d]", - commandPath.mEndpointId, credentialIndex); + ChipLogProgress(Zcl, "[SetCredential] Unable to check if credential exists: app error [endpointId=%d,credentialIndex=%d]", + commandPath.mEndpointId, credentialIndex); sendSetCredentialResponse(commandObj, commandPath, DlStatus::kFailure, 0, nextAvailableCredentialSlot); return; @@ -696,18 +694,20 @@ void DoorLockServer::setCredentialCommandHandler( if (!IsValidUserStatusForSet(userStatus)) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to set the credential: user status is out of range " - "[endpointId=%d,credentialIndex=%d,userStatus=%u]", - commandPath.mEndpointId, credentialIndex, to_underlying(userStatus.Value())); + ChipLogProgress(Zcl, + "[SetCredential] Unable to set the credential: user status is out of range " + "[endpointId=%d,credentialIndex=%d,userStatus=%u]", + commandPath.mEndpointId, credentialIndex, to_underlying(userStatus.Value())); sendSetCredentialResponse(commandObj, commandPath, DlStatus::kInvalidField, 0, nextAvailableCredentialSlot); return; } if (userType == UserTypeEnum::kUnknownEnumValue) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to set the credential: user type is unknown " - "[endpointId=%d,credentialIndex=%d,userType=%u]", - commandPath.mEndpointId, credentialIndex, to_underlying(userType.Value())); + ChipLogProgress(Zcl, + "[SetCredential] Unable to set the credential: user type is unknown " + "[endpointId=%d,credentialIndex=%d,userType=%u]", + commandPath.mEndpointId, credentialIndex, to_underlying(userType.Value())); sendSetCredentialResponse(commandObj, commandPath, DlStatus::kInvalidField, 0, nextAvailableCredentialSlot); return; } @@ -727,9 +727,10 @@ void DoorLockServer::setCredentialCommandHandler( // appclusters, 5.2.4.41.1: should send the INVALID_COMMAND in the response when the credential is in use if (DlCredentialStatus::kAvailable == existingCredential.status) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to modify the credential: credential slot is not occupied " - "[endpointId=%d,credentialIndex=%d]", - commandPath.mEndpointId, credentialIndex); + ChipLogProgress(Zcl, + "[SetCredential] Unable to modify the credential: credential slot is not occupied " + "[endpointId=%d,credentialIndex=%d]", + commandPath.mEndpointId, credentialIndex); sendSetCredentialResponse(commandObj, commandPath, DlStatus::kInvalidField, 0, nextAvailableCredentialSlot); return; @@ -740,9 +741,10 @@ void DoorLockServer::setCredentialCommandHandler( { if (!userStatus.IsNull() || userType != UserTypeEnum::kProgrammingUser) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to modify programming PIN: invalid argument " - "[endpointId=%d,credentialIndex=%d]", - commandPath.mEndpointId, credentialIndex); + ChipLogProgress(Zcl, + "[SetCredential] Unable to modify programming PIN: invalid argument " + "[endpointId=%d,credentialIndex=%d]", + commandPath.mEndpointId, credentialIndex); } status = modifyProgrammingPIN(commandPath.mEndpointId, fabricIdx, sourceNodeId, credentialIndex, credentialType, existingCredential, credentialData); @@ -766,13 +768,14 @@ void DoorLockServer::getCredentialStatusCommandHandler(chip::app::CommandHandler const chip::app::ConcreteCommandPath & commandPath, CredentialTypeEnum credentialType, uint16_t credentialIndex) { - emberAfDoorLockClusterPrintln("[GetCredentialStatus] Incoming command [endpointId=%d]", commandPath.mEndpointId); + ChipLogProgress(Zcl, "[GetCredentialStatus] Incoming command [endpointId=%d]", commandPath.mEndpointId); if (!credentialTypeSupported(commandPath.mEndpointId, credentialType)) { - emberAfDoorLockClusterPrintln("[GetCredentialStatus] Credential type is not supported [endpointId=%d,credentialType=%u" - "]", - commandPath.mEndpointId, to_underlying(credentialType)); + ChipLogProgress(Zcl, + "[GetCredentialStatus] Credential type is not supported [endpointId=%d,credentialType=%u" + "]", + commandPath.mEndpointId, to_underlying(credentialType)); commandObj->AddStatus(commandPath, Status::UnsupportedCommand); return; } @@ -787,10 +790,11 @@ void DoorLockServer::getCredentialStatusCommandHandler(chip::app::CommandHandler EmberAfPluginDoorLockCredentialInfo credentialInfo; if (!emberAfPluginDoorLockGetCredential(commandPath.mEndpointId, credentialIndex, credentialType, credentialInfo)) { - emberAfDoorLockClusterPrintln("[GetCredentialStatus] Unable to get the credential: app error " - "[endpointId=%d,credentialIndex=%d,credentialType=%u,creator=%u,modifier=%u]", - commandPath.mEndpointId, credentialIndex, to_underlying(credentialType), - credentialInfo.createdBy, credentialInfo.lastModifiedBy); + ChipLogProgress(Zcl, + "[GetCredentialStatus] Unable to get the credential: app error " + "[endpointId=%d,credentialIndex=%d,credentialType=%u,creator=%u,modifier=%u]", + commandPath.mEndpointId, credentialIndex, to_underlying(credentialType), credentialInfo.createdBy, + credentialInfo.lastModifiedBy); commandObj->AddStatus(commandPath, Status::Failure); return; } @@ -850,17 +854,18 @@ void DoorLockServer::sendGetCredentialResponse(chip::app::CommandHandler * comma } commandObj->AddResponse(commandPath, response); - emberAfDoorLockClusterPrintln("[GetCredentialStatus] Prepared credential status " - "[endpointId=%d,credentialType=%u,credentialIndex=%d,userIndex=%d,nextCredentialIndex=%d]", - commandPath.mEndpointId, to_underlying(credentialType), credentialIndex, userIndexWithCredential, - nextCredentialIndex); + ChipLogProgress(Zcl, + "[GetCredentialStatus] Prepared credential status " + "[endpointId=%d,credentialType=%u,credentialIndex=%d,userIndex=%d,nextCredentialIndex=%d]", + commandPath.mEndpointId, to_underlying(credentialType), credentialIndex, userIndexWithCredential, + nextCredentialIndex); } void DoorLockServer::clearCredentialCommandHandler( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::ClearCredential::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("[ClearCredential] Incoming command [endpointId=%d]", commandPath.mEndpointId); + ChipLogProgress(Zcl, "[ClearCredential] Incoming command [endpointId=%d]", commandPath.mEndpointId); auto modifier = getFabricIndex(commandObj); if (kUndefinedFabricIndex == modifier) @@ -879,7 +884,7 @@ void DoorLockServer::clearCredentialCommandHandler( const auto & credential = commandData.credential; if (credential.IsNull()) { - emberAfDoorLockClusterPrintln("[ClearCredential] Clearing all credentials [endpointId=%d]", commandPath.mEndpointId); + ChipLogProgress(Zcl, "[ClearCredential] Clearing all credentials [endpointId=%d]", commandPath.mEndpointId); commandObj->AddStatus(commandPath, clearCredentials(commandPath.mEndpointId, modifier, sourceNodeId)); return; } @@ -905,12 +910,12 @@ void DoorLockServer::setWeekDayScheduleCommandHandler(chip::app::CommandHandler auto endpointId = commandPath.mEndpointId; if (!SupportsWeekDaySchedules(endpointId)) { - emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[SetWeekDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } - emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Incoming command [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[SetWeekDaySchedule] Incoming command [endpointId=%d]", endpointId); auto fabricIdx = getFabricIndex(commandObj); if (kUndefinedFabricIndex == fabricIdx) @@ -930,8 +935,8 @@ void DoorLockServer::setWeekDayScheduleCommandHandler(chip::app::CommandHandler if (!weekDayIndexValid(endpointId, weekDayIndex) || !userIndexValid(endpointId, userIndex)) { - emberAfDoorLockClusterPrintln( - "[SetWeekDaySchedule] Unable to add schedule - index out of range [endpointId=%d,weekDayIndex=%d,userIndex=%d]", + ChipLogProgress( + Zcl, "[SetWeekDaySchedule] Unable to add schedule - index out of range [endpointId=%d,weekDayIndex=%d,userIndex=%d]", endpointId, weekDayIndex, userIndex); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; @@ -939,9 +944,10 @@ void DoorLockServer::setWeekDayScheduleCommandHandler(chip::app::CommandHandler if (!userExists(endpointId, userIndex)) { - emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Unable to add schedule - user does not exist " - "[endpointId=%d,weekDayIndex=%d,userIndex=%d]", - endpointId, weekDayIndex, userIndex); + ChipLogProgress(Zcl, + "[SetWeekDaySchedule] Unable to add schedule - user does not exist " + "[endpointId=%d,weekDayIndex=%d,userIndex=%d]", + endpointId, weekDayIndex, userIndex); commandObj->AddStatus(commandPath, Status::Failure); return; } @@ -958,9 +964,10 @@ void DoorLockServer::setWeekDayScheduleCommandHandler(chip::app::CommandHandler // TODO: Check that bits are within range if (setBitsInDaysMask == 0 || setBitsInDaysMask > 1) { - emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Unable to add schedule - daysMask is out of range " - "[endpointId=%d,weekDayIndex=%d,userIndex=%d,daysMask=%x]", - endpointId, weekDayIndex, userIndex, daysMask.Raw()); + ChipLogProgress(Zcl, + "[SetWeekDaySchedule] Unable to add schedule - daysMask is out of range " + "[endpointId=%d,weekDayIndex=%d,userIndex=%d,daysMask=%x]", + endpointId, weekDayIndex, userIndex, daysMask.Raw()); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } @@ -968,18 +975,20 @@ void DoorLockServer::setWeekDayScheduleCommandHandler(chip::app::CommandHandler if (startHour > DOOR_LOCK_SCHEDULE_MAX_HOUR || startMinute > DOOR_LOCK_SCHEDULE_MAX_MINUTE || endHour > DOOR_LOCK_SCHEDULE_MAX_HOUR || endMinute > DOOR_LOCK_SCHEDULE_MAX_MINUTE) { - emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Unable to add schedule - start time out of range " - "[endpointId=%d,weekDayIndex=%d,userIndex=%d,startTime=\"%d:%d\",endTime=\"%d:%d\"]", - endpointId, weekDayIndex, userIndex, startHour, startMinute, endHour, endMinute); + ChipLogProgress(Zcl, + "[SetWeekDaySchedule] Unable to add schedule - start time out of range " + "[endpointId=%d,weekDayIndex=%d,userIndex=%d,startTime=\"%d:%d\",endTime=\"%d:%d\"]", + endpointId, weekDayIndex, userIndex, startHour, startMinute, endHour, endMinute); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } if (startHour > endHour || (startHour == endHour && startMinute >= endMinute)) { - emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Unable to add schedule - invalid time " - "[endpointId=%d,weekDayIndex=%d,userIndex=%d,startTime=\"%d:%d\",endTime=\"%d:%d\"]", - endpointId, weekDayIndex, userIndex, startHour, startMinute, endHour, endMinute); + ChipLogProgress(Zcl, + "[SetWeekDaySchedule] Unable to add schedule - invalid time " + "[endpointId=%d,weekDayIndex=%d,userIndex=%d,startTime=\"%d:%d\",endTime=\"%d:%d\"]", + endpointId, weekDayIndex, userIndex, startHour, startMinute, endHour, endMinute); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } @@ -996,9 +1005,10 @@ void DoorLockServer::setWeekDayScheduleCommandHandler(chip::app::CommandHandler return; } - emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Successfully created new schedule " - "[endpointId=%d,weekDayIndex=%d,userIndex=%d,daysMask=%d,startTime=\"%d:%d\",endTime=\"%d:%d\"]", - endpointId, weekDayIndex, userIndex, daysMask.Raw(), startHour, startMinute, endHour, endMinute); + ChipLogProgress(Zcl, + "[SetWeekDaySchedule] Successfully created new schedule " + "[endpointId=%d,weekDayIndex=%d,userIndex=%d,daysMask=%d,startTime=\"%d:%d\",endTime=\"%d:%d\"]", + endpointId, weekDayIndex, userIndex, daysMask.Raw(), startHour, startMinute, endHour, endMinute); sendRemoteLockUserChange(endpointId, LockDataTypeEnum::kWeekDaySchedule, DataOperationTypeEnum::kAdd, sourceNodeId, fabricIdx, userIndex, static_cast(weekDayIndex)); @@ -1013,17 +1023,17 @@ void DoorLockServer::getWeekDayScheduleCommandHandler(chip::app::CommandHandler auto endpointId = commandPath.mEndpointId; if (!SupportsWeekDaySchedules(endpointId)) { - emberAfDoorLockClusterPrintln("[GetWeekDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[GetWeekDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } - emberAfDoorLockClusterPrintln("[GetWeekDaySchedule] Incoming command [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[GetWeekDaySchedule] Incoming command [endpointId=%d]", endpointId); if (!weekDayIndexValid(endpointId, weekDayIndex) || !userIndexValid(endpointId, userIndex)) { - emberAfDoorLockClusterPrintln( - "[GetWeekDaySchedule] Unable to get schedule - index out of range [endpointId=%d,weekDayIndex=%d,userIndex=%d]", + ChipLogProgress( + Zcl, "[GetWeekDaySchedule] Unable to get schedule - index out of range [endpointId=%d,weekDayIndex=%d,userIndex=%d]", endpointId, weekDayIndex, userIndex); sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, DlStatus::kInvalidField); return; @@ -1031,8 +1041,8 @@ void DoorLockServer::getWeekDayScheduleCommandHandler(chip::app::CommandHandler if (!userExists(endpointId, userIndex)) { - emberAfDoorLockClusterPrintln("[GetWeekDaySchedule] User does not exist [endpointId=%d,weekDayIndex=%d,userIndex=%d]", - endpointId, weekDayIndex, userIndex); + ChipLogProgress(Zcl, "[GetWeekDaySchedule] User does not exist [endpointId=%d,weekDayIndex=%d,userIndex=%d]", endpointId, + weekDayIndex, userIndex); sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, DlStatus::kFailure); return; } @@ -1056,12 +1066,12 @@ void DoorLockServer::clearWeekDayScheduleCommandHandler(chip::app::CommandHandle auto endpointId = commandPath.mEndpointId; if (!SupportsWeekDaySchedules(endpointId)) { - emberAfDoorLockClusterPrintln("[ClearWeekDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[ClearWeekDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } - emberAfDoorLockClusterPrintln("[ClearWeekDaySchedule] Incoming command [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[ClearWeekDaySchedule] Incoming command [endpointId=%d]", endpointId); auto fabricIdx = getFabricIndex(commandObj); if (kUndefinedFabricIndex == fabricIdx) @@ -1081,17 +1091,17 @@ void DoorLockServer::clearWeekDayScheduleCommandHandler(chip::app::CommandHandle if (!userIndexValid(endpointId, userIndex) || (!weekDayIndexValid(endpointId, weekDayIndex) && 0xFE != weekDayIndex)) { - emberAfDoorLockClusterPrintln( - "[ClearWeekDaySchedule] User or WeekDay index is out of range [endpointId=%d,weekDayIndex=%d,userIndex=%d]", endpointId, - weekDayIndex, userIndex); + ChipLogProgress(Zcl, + "[ClearWeekDaySchedule] User or WeekDay index is out of range [endpointId=%d,weekDayIndex=%d,userIndex=%d]", + endpointId, weekDayIndex, userIndex); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } if (!userExists(endpointId, userIndex)) { - emberAfDoorLockClusterPrintln("[ClearWeekDaySchedule] User does not exist [endpointId=%d,weekDayIndex=%d,userIndex=%d]", - endpointId, weekDayIndex, userIndex); + ChipLogProgress(Zcl, "[ClearWeekDaySchedule] User does not exist [endpointId=%d,weekDayIndex=%d,userIndex=%d]", endpointId, + weekDayIndex, userIndex); commandObj->AddStatus(commandPath, Status::Failure); return; } @@ -1099,22 +1109,21 @@ void DoorLockServer::clearWeekDayScheduleCommandHandler(chip::app::CommandHandle DlStatus clearStatus = DlStatus::kSuccess; if (0xFE == weekDayIndex) { - emberAfDoorLockClusterPrintln( - "[ClearWeekDaySchedule] Clearing all schedules for a single user [endpointId=%d,userIndex=%d]", endpointId, userIndex); + ChipLogProgress(Zcl, "[ClearWeekDaySchedule] Clearing all schedules for a single user [endpointId=%d,userIndex=%d]", + endpointId, userIndex); clearStatus = clearWeekDaySchedules(endpointId, userIndex); } else { - emberAfDoorLockClusterPrintln( - "[ClearWeekDaySchedule] Clearing a single schedule [endpointId=%d,weekDayIndex=%d,userIndex=%d]", endpointId, - weekDayIndex, userIndex); + ChipLogProgress(Zcl, "[ClearWeekDaySchedule] Clearing a single schedule [endpointId=%d,weekDayIndex=%d,userIndex=%d]", + endpointId, weekDayIndex, userIndex); clearStatus = clearWeekDaySchedule(endpointId, userIndex, weekDayIndex); } if (DlStatus::kSuccess != clearStatus) { - emberAfDoorLockClusterPrintln( - "[ClearWeekDaySchedule] Unable to clear the user schedules - app error [endpointId=%d,userIndex=%d,status=%u]", + ChipLogProgress( + Zcl, "[ClearWeekDaySchedule] Unable to clear the user schedules - app error [endpointId=%d,userIndex=%d,status=%u]", endpointId, userIndex, to_underlying(clearStatus)); commandObj->AddStatus(commandPath, Status::Failure); return; @@ -1133,12 +1142,12 @@ void DoorLockServer::setYearDayScheduleCommandHandler(chip::app::CommandHandler auto endpointId = commandPath.mEndpointId; if (!SupportsYearDaySchedules(endpointId)) { - emberAfDoorLockClusterPrintln("[SetYearDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[SetYearDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } - emberAfDoorLockClusterPrintln("[SetYearDaySchedule] incoming command [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[SetYearDaySchedule] incoming command [endpointId=%d]", endpointId); auto fabricIdx = getFabricIndex(commandObj); if (kUndefinedFabricIndex == fabricIdx) @@ -1158,8 +1167,8 @@ void DoorLockServer::setYearDayScheduleCommandHandler(chip::app::CommandHandler if (!yearDayIndexValid(endpointId, yearDayIndex) || !userIndexValid(endpointId, userIndex)) { - emberAfDoorLockClusterPrintln( - "[SetYearDaySchedule] Unable to add schedule - index out of range [endpointId=%d,yearDayIndex=%d,userIndex=%d]", + ChipLogProgress( + Zcl, "[SetYearDaySchedule] Unable to add schedule - index out of range [endpointId=%d,yearDayIndex=%d,userIndex=%d]", endpointId, yearDayIndex, userIndex); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; @@ -1167,19 +1176,20 @@ void DoorLockServer::setYearDayScheduleCommandHandler(chip::app::CommandHandler if (!userExists(endpointId, userIndex)) { - emberAfDoorLockClusterPrintln("[SetYearDaySchedule] Unable to add schedule - user does not exist " - "[endpointId=%d,yearDayIndex=%d,userIndex=%d]", - endpointId, yearDayIndex, userIndex); + ChipLogProgress(Zcl, + "[SetYearDaySchedule] Unable to add schedule - user does not exist " + "[endpointId=%d,yearDayIndex=%d,userIndex=%d]", + endpointId, yearDayIndex, userIndex); commandObj->AddStatus(commandPath, Status::Failure); return; } if (localEndTime <= localStartTime) { - emberAfDoorLockClusterPrintln("[SetYearDaySchedule] Unable to add schedule - schedule ends earlier than starts" - "[endpointId=%d,yearDayIndex=%d,userIndex=%d,localStarTime=%" PRIu32 ",localEndTime=%" PRIu32 - "]", - endpointId, yearDayIndex, userIndex, localStartTime, localEndTime); + ChipLogProgress(Zcl, + "[SetYearDaySchedule] Unable to add schedule - schedule ends earlier than starts" + "[endpointId=%d,yearDayIndex=%d,userIndex=%d,localStarTime=%" PRIu32 ",localEndTime=%" PRIu32 "]", + endpointId, yearDayIndex, userIndex, localStartTime, localEndTime); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } @@ -1196,9 +1206,10 @@ void DoorLockServer::setYearDayScheduleCommandHandler(chip::app::CommandHandler return; } - emberAfDoorLockClusterPrintln("[SetYearDaySchedule] Successfully created new schedule " - "[endpointId=%d,yearDayIndex=%d,userIndex=%d,localStartTime=%" PRIu32 ",endTime=%" PRIu32 "]", - endpointId, yearDayIndex, userIndex, localStartTime, localEndTime); + ChipLogProgress(Zcl, + "[SetYearDaySchedule] Successfully created new schedule " + "[endpointId=%d,yearDayIndex=%d,userIndex=%d,localStartTime=%" PRIu32 ",endTime=%" PRIu32 "]", + endpointId, yearDayIndex, userIndex, localStartTime, localEndTime); sendRemoteLockUserChange(endpointId, LockDataTypeEnum::kYearDaySchedule, DataOperationTypeEnum::kAdd, sourceNodeId, fabricIdx, userIndex, static_cast(yearDayIndex)); @@ -1213,16 +1224,16 @@ void DoorLockServer::getYearDayScheduleCommandHandler(chip::app::CommandHandler auto endpointId = commandPath.mEndpointId; if (!SupportsYearDaySchedules(endpointId)) { - emberAfDoorLockClusterPrintln("[GetYearDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[GetYearDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } - emberAfDoorLockClusterPrintln("[GetYearDaySchedule] incoming command [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[GetYearDaySchedule] incoming command [endpointId=%d]", endpointId); if (!yearDayIndexValid(endpointId, yearDayIndex) || !userIndexValid(endpointId, userIndex)) { - emberAfDoorLockClusterPrintln( - "[GetYearDaySchedule] Unable to get schedule - index out of range [endpointId=%d,yearDayIndex=%d,userIndex=%d]", + ChipLogProgress( + Zcl, "[GetYearDaySchedule] Unable to get schedule - index out of range [endpointId=%d,yearDayIndex=%d,userIndex=%d]", endpointId, yearDayIndex, userIndex); sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, DlStatus::kInvalidField); return; @@ -1230,8 +1241,8 @@ void DoorLockServer::getYearDayScheduleCommandHandler(chip::app::CommandHandler if (!userExists(endpointId, userIndex)) { - emberAfDoorLockClusterPrintln("[GetYearDaySchedule] User does not exist [endpointId=%d,yearDayIndex=%d,userIndex=%d]", - endpointId, yearDayIndex, userIndex); + ChipLogProgress(Zcl, "[GetYearDaySchedule] User does not exist [endpointId=%d,yearDayIndex=%d,userIndex=%d]", endpointId, + yearDayIndex, userIndex); sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, DlStatus::kFailure); return; } @@ -1255,11 +1266,11 @@ void DoorLockServer::clearYearDayScheduleCommandHandler(chip::app::CommandHandle auto endpointId = commandPath.mEndpointId; if (!SupportsYearDaySchedules(endpointId)) { - emberAfDoorLockClusterPrintln("[ClearYearDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[ClearYearDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } - emberAfDoorLockClusterPrintln("[ClearYearDaySchedule] incoming command [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[ClearYearDaySchedule] incoming command [endpointId=%d]", endpointId); auto fabricIdx = getFabricIndex(commandObj); if (kUndefinedFabricIndex == fabricIdx) @@ -1279,17 +1290,17 @@ void DoorLockServer::clearYearDayScheduleCommandHandler(chip::app::CommandHandle if (!userIndexValid(endpointId, userIndex) || (!yearDayIndexValid(endpointId, yearDayIndex) && 0xFE != yearDayIndex)) { - emberAfDoorLockClusterPrintln( - "[ClearYearDaySchedule] User or YearDay index is out of range [endpointId=%d,yearDayIndex=%d,userIndex=%d]", endpointId, - yearDayIndex, userIndex); + ChipLogProgress(Zcl, + "[ClearYearDaySchedule] User or YearDay index is out of range [endpointId=%d,yearDayIndex=%d,userIndex=%d]", + endpointId, yearDayIndex, userIndex); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } if (!userExists(endpointId, userIndex)) { - emberAfDoorLockClusterPrintln("[ClearYearDaySchedule] User does not exist [endpointId=%d,yearDayIndex=%d,userIndex=%d]", - endpointId, yearDayIndex, userIndex); + ChipLogProgress(Zcl, "[ClearYearDaySchedule] User does not exist [endpointId=%d,yearDayIndex=%d,userIndex=%d]", endpointId, + yearDayIndex, userIndex); commandObj->AddStatus(commandPath, Status::Failure); return; } @@ -1297,22 +1308,21 @@ void DoorLockServer::clearYearDayScheduleCommandHandler(chip::app::CommandHandle DlStatus clearStatus = DlStatus::kSuccess; if (0xFE == yearDayIndex) { - emberAfDoorLockClusterPrintln( - "[ClearYearDaySchedule] Clearing all schedules for a single user [endpointId=%d,userIndex=%d]", endpointId, userIndex); + ChipLogProgress(Zcl, "[ClearYearDaySchedule] Clearing all schedules for a single user [endpointId=%d,userIndex=%d]", + endpointId, userIndex); clearStatus = clearYearDaySchedules(endpointId, userIndex); } else { - emberAfDoorLockClusterPrintln( - "[ClearYearDaySchedule] Clearing a single schedule [endpointId=%d,yearDayIndex=%d,userIndex=%d]", endpointId, - yearDayIndex, userIndex); + ChipLogProgress(Zcl, "[ClearYearDaySchedule] Clearing a single schedule [endpointId=%d,yearDayIndex=%d,userIndex=%d]", + endpointId, yearDayIndex, userIndex); clearStatus = clearYearDaySchedule(endpointId, userIndex, yearDayIndex); } if (DlStatus::kSuccess != clearStatus) { - emberAfDoorLockClusterPrintln( - "[ClearYearDaySchedule] Unable to clear the user schedules - app error [endpointId=%d,userIndex=%d,status=%u]", + ChipLogProgress( + Zcl, "[ClearYearDaySchedule] Unable to clear the user schedules - app error [endpointId=%d,userIndex=%d,status=%u]", endpointId, userIndex, to_underlying(clearStatus)); commandObj->AddStatus(commandPath, Status::Failure); return; @@ -1337,9 +1347,8 @@ chip::BitFlags DoorLockServer::GetFeatures(chip::EndpointId endpointId) bool DoorLockServer::OnFabricRemoved(chip::EndpointId endpointId, chip::FabricIndex fabricIndex) { - emberAfDoorLockClusterPrintln( - "[OnFabricRemoved] Handling a fabric removal from the door lock server [endpointId=%d,fabricIndex=%d]", endpointId, - fabricIndex); + ChipLogProgress(Zcl, "[OnFabricRemoved] Handling a fabric removal from the door lock server [endpointId=%d,fabricIndex=%d]", + endpointId, fabricIndex); // Iterate over all the users and clean up the deleted fabric if (!clearFabricFromUsers(endpointId, fabricIndex)) @@ -1504,10 +1513,10 @@ DlStatus DoorLockServer::credentialLengthWithinRange(chip::EndpointId endpointId if (credentialData.size() < minLen || credentialData.size() > maxLen) { - emberAfDoorLockClusterPrintln("Credential data size is out of range " - "[endpointId=%d,credentialType=%u,minLength=%u,maxLength=%u,length=%u]", - endpointId, to_underlying(type), minLen, maxLen, - static_cast(credentialData.size())); + ChipLogProgress(Zcl, + "Credential data size is out of range " + "[endpointId=%d,credentialType=%u,minLength=%u,maxLength=%u,length=%u]", + endpointId, to_underlying(type), minLen, maxLen, static_cast(credentialData.size())); return DlStatus::kInvalidField; } @@ -1793,8 +1802,7 @@ EmberAfStatus DoorLockServer::createUser(chip::EndpointId endpointId, chip::Fabr // appclusters, 5.2.4.34: to modify user its status should be set to Available. If it is we should return OCCUPIED. if (UserStatusEnum::kAvailable != user.userStatus) { - emberAfDoorLockClusterPrintln("[createUser] Unable to overwrite existing user [endpointId=%d,userIndex=%d]", endpointId, - userIndex); + ChipLogProgress(Zcl, "[createUser] Unable to overwrite existing user [endpointId=%d,userIndex=%d]", endpointId, userIndex); return static_cast(DlStatus::kOccupied); } @@ -1814,23 +1822,23 @@ EmberAfStatus DoorLockServer::createUser(chip::EndpointId endpointId, chip::Fabr if (!emberAfPluginDoorLockSetUser(endpointId, userIndex, creatorFabricIdx, creatorFabricIdx, newUserName, newUserUniqueId, newUserStatus, newUserType, newCredentialRule, newCredentials, newTotalCredentials)) { - emberAfDoorLockClusterPrintln("[createUser] Unable to create user: app error " - "[endpointId=%d,creatorFabricId=%d,userIndex=%d,userName=\"%.*s\",userUniqueId=0x%" PRIx32 - ",userStatus=%u," - "userType=%u,credentialRule=%u,totalCredentials=%u]", - endpointId, creatorFabricIdx, userIndex, static_cast(newUserName.size()), - newUserName.data(), newUserUniqueId, to_underlying(newUserStatus), to_underlying(newUserType), - to_underlying(newCredentialRule), static_cast(newTotalCredentials)); + ChipLogProgress(Zcl, + "[createUser] Unable to create user: app error " + "[endpointId=%d,creatorFabricId=%d,userIndex=%d,userName=\"%.*s\",userUniqueId=0x%" PRIx32 ",userStatus=%u," + "userType=%u,credentialRule=%u,totalCredentials=%u]", + endpointId, creatorFabricIdx, userIndex, static_cast(newUserName.size()), newUserName.data(), + newUserUniqueId, to_underlying(newUserStatus), to_underlying(newUserType), to_underlying(newCredentialRule), + static_cast(newTotalCredentials)); return EMBER_ZCL_STATUS_FAILURE; } - emberAfDoorLockClusterPrintln("[createUser] User created " - "[endpointId=%d,creatorFabricId=%d,userIndex=%d,userName=\"%.*s\",userUniqueId=0x%" PRIx32 - ",userStatus=%u," - "userType=%u,credentialRule=%u,totalCredentials=%u]", - endpointId, creatorFabricIdx, userIndex, static_cast(newUserName.size()), newUserName.data(), - newUserUniqueId, to_underlying(newUserStatus), to_underlying(newUserType), - to_underlying(newCredentialRule), static_cast(newTotalCredentials)); + ChipLogProgress(Zcl, + "[createUser] User created " + "[endpointId=%d,creatorFabricId=%d,userIndex=%d,userName=\"%.*s\",userUniqueId=0x%" PRIx32 ",userStatus=%u," + "userType=%u,credentialRule=%u,totalCredentials=%u]", + endpointId, creatorFabricIdx, userIndex, static_cast(newUserName.size()), newUserName.data(), + newUserUniqueId, to_underlying(newUserStatus), to_underlying(newUserType), to_underlying(newCredentialRule), + static_cast(newTotalCredentials)); sendRemoteLockUserChange(endpointId, LockDataTypeEnum::kUserIndex, DataOperationTypeEnum::kAdd, sourceNodeId, creatorFabricIdx, userIndex, userIndex); @@ -1855,26 +1863,27 @@ EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::Fabr // appclusters, 5.2.4.34: to modify user its status should NOT be set to Available. If it is we should return INVALID_COMMAND. if (UserStatusEnum::kAvailable == user.userStatus) { - emberAfDoorLockClusterPrintln("[modifyUser] Unable to modify non-existing user [endpointId=%d,userIndex=%d]", endpointId, - userIndex); + ChipLogProgress(Zcl, "[modifyUser] Unable to modify non-existing user [endpointId=%d,userIndex=%d]", endpointId, userIndex); return EMBER_ZCL_STATUS_INVALID_COMMAND; } // appclusters, 5.2.4.34: UserName SHALL be null if modifying a user record that was not created by the accessing fabric if (user.createdBy != modifierFabricIndex && !userName.IsNull()) { - emberAfDoorLockClusterPrintln("[modifyUser] Unable to modify name of user created by different fabric " - "[endpointId=%d,userIndex=%d,creatorIdx=%d,modifierIdx=%d]", - endpointId, userIndex, user.createdBy, modifierFabricIndex); + ChipLogProgress(Zcl, + "[modifyUser] Unable to modify name of user created by different fabric " + "[endpointId=%d,userIndex=%d,creatorIdx=%d,modifierIdx=%d]", + endpointId, userIndex, user.createdBy, modifierFabricIndex); return EMBER_ZCL_STATUS_INVALID_COMMAND; } // appclusters, 5.2.4.34: UserUniqueID SHALL be null if modifying the user record that was not created by the accessing fabric. if (user.createdBy != modifierFabricIndex && !userUniqueId.IsNull()) { - emberAfDoorLockClusterPrintln("[modifyUser] Unable to modify UUID of user created by different fabric " - "[endpointId=%d,userIndex=%d,creatorIdx=%d,modifierIdx=%d]", - endpointId, userIndex, user.createdBy, modifierFabricIndex); + ChipLogProgress(Zcl, + "[modifyUser] Unable to modify UUID of user created by different fabric " + "[endpointId=%d,userIndex=%d,creatorIdx=%d,modifierIdx=%d]", + endpointId, userIndex, user.createdBy, modifierFabricIndex); return EMBER_ZCL_STATUS_INVALID_COMMAND; } @@ -1897,12 +1906,12 @@ EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::Fabr return EMBER_ZCL_STATUS_FAILURE; } - emberAfDoorLockClusterPrintln("[modifyUser] User modified " - "[endpointId=%d,modifierFabric=%d,userIndex=%d,userName=\"%.*s\",userUniqueId=0x%" PRIx32 - ",userStatus=%u,userType=%u,credentialRule=%u]", - endpointId, modifierFabricIndex, userIndex, static_cast(newUserName.size()), - newUserName.data(), newUserUniqueId, to_underlying(newUserStatus), to_underlying(newUserType), - to_underlying(newCredentialRule)); + ChipLogProgress(Zcl, + "[modifyUser] User modified " + "[endpointId=%d,modifierFabric=%d,userIndex=%d,userName=\"%.*s\",userUniqueId=0x%" PRIx32 + ",userStatus=%u,userType=%u,credentialRule=%u]", + endpointId, modifierFabricIndex, userIndex, static_cast(newUserName.size()), newUserName.data(), + newUserUniqueId, to_underlying(newUserStatus), to_underlying(newUserType), to_underlying(newCredentialRule)); sendRemoteLockUserChange(endpointId, LockDataTypeEnum::kUserIndex, DataOperationTypeEnum::kModify, sourceNodeId, modifierFabricIndex, userIndex, userIndex); @@ -1928,8 +1937,8 @@ Status DoorLockServer::clearUser(chip::EndpointId endpointId, chip::FabricIndex // appclusters, 5.2.4.37: all the credentials associated with user should be cleared when clearing the user for (const auto & credential : user.credentials) { - emberAfDoorLockClusterPrintln( - "[ClearUser] Clearing associated credential [endpointId=%d,userIndex=%d,credentialType=%u,credentialIndex=%d]", + ChipLogProgress( + Zcl, "[ClearUser] Clearing associated credential [endpointId=%d,userIndex=%d,credentialType=%u,credentialIndex=%d]", endpointId, userIndex, to_underlying(credential.credentialType), credential.credentialIndex); if (!emberAfPluginDoorLockSetCredential(endpointId, credential.credentialIndex, kUndefinedFabricIndex, @@ -2025,9 +2034,10 @@ DlStatus DoorLockServer::createNewCredentialAndUser(chip::EndpointId endpointId, uint16_t availableUserIndex = 0; if (!findUnoccupiedUserSlot(endpointId, availableUserIndex)) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to create new user for credential: no available user slots " - "[endpointId=%d,credentialIndex=%d]", - endpointId, credential.credentialIndex); + ChipLogProgress(Zcl, + "[SetCredential] Unable to create new user for credential: no available user slots " + "[endpointId=%d,credentialIndex=%d]", + endpointId, credential.credentialIndex); return DlStatus::kOccupied; } @@ -2036,26 +2046,29 @@ DlStatus DoorLockServer::createNewCredentialAndUser(chip::EndpointId endpointId, userStatus, userType, Nullable(), Nullable(credential)); if (EMBER_ZCL_STATUS_SUCCESS != status) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to create new user for credential: internal error " - "[endpointId=%d,credentialIndex=%d,userIndex=%d,status=%d]", - endpointId, credential.credentialIndex, availableUserIndex, status); + ChipLogProgress(Zcl, + "[SetCredential] Unable to create new user for credential: internal error " + "[endpointId=%d,credentialIndex=%d,userIndex=%d,status=%d]", + endpointId, credential.credentialIndex, availableUserIndex, status); return DlStatus::kFailure; } if (!emberAfPluginDoorLockSetCredential(endpointId, credential.credentialIndex, creatorFabricIdx, creatorFabricIdx, DlCredentialStatus::kOccupied, credential.credentialType, credentialData)) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to set the credential: app error " - "[endpointId=%d,credentialIndex=%d,credentialType=%u,dataLength=%u]", - endpointId, credential.credentialIndex, to_underlying(credential.credentialType), - static_cast(credentialData.size())); + ChipLogProgress(Zcl, + "[SetCredential] Unable to set the credential: app error " + "[endpointId=%d,credentialIndex=%d,credentialType=%u,dataLength=%u]", + endpointId, credential.credentialIndex, to_underlying(credential.credentialType), + static_cast(credentialData.size())); return DlStatus::kFailure; } - emberAfDoorLockClusterPrintln("[SetCredential] Credential and user were created " - "[endpointId=%d,credentialIndex=%d,credentialType=%u,dataLength=%u,userIndex=%d]", - endpointId, credential.credentialIndex, to_underlying(credential.credentialType), - static_cast(credentialData.size()), availableUserIndex); + ChipLogProgress(Zcl, + "[SetCredential] Credential and user were created " + "[endpointId=%d,credentialIndex=%d,credentialType=%u,dataLength=%u,userIndex=%d]", + endpointId, credential.credentialIndex, to_underlying(credential.credentialType), + static_cast(credentialData.size()), availableUserIndex); createdUserIndex = availableUserIndex; return DlStatus::kSuccess; @@ -2067,17 +2080,18 @@ DlStatus DoorLockServer::createNewCredentialAndAddItToUser(chip::EndpointId endp { if (!userIndexValid(endpointId, userIndex)) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to add new credential to user: user out of bounds " - "[endpointId=%d,credentialIndex=%d,userIndex=%d]", - endpointId, credential.credentialIndex, userIndex); + ChipLogProgress(Zcl, + "[SetCredential] Unable to add new credential to user: user out of bounds " + "[endpointId=%d,credentialIndex=%d,userIndex=%d]", + endpointId, credential.credentialIndex, userIndex); return DlStatus::kInvalidField; } EmberAfPluginDoorLockUserInfo user; if (!emberAfPluginDoorLockGetUser(endpointId, userIndex, user)) { - emberAfDoorLockClusterPrintln( - "[SetCredential] Unable to check if credential exists: app error [endpointId=%d,credentialIndex=%d,userIndex=%d]", + ChipLogProgress( + Zcl, "[SetCredential] Unable to check if credential exists: app error [endpointId=%d,credentialIndex=%d,userIndex=%d]", endpointId, credential.credentialIndex, userIndex); return DlStatus::kFailure; @@ -2086,9 +2100,10 @@ DlStatus DoorLockServer::createNewCredentialAndAddItToUser(chip::EndpointId endp // Not in the spec, but common sense: I don't think we need to modify the credential if user slot is not occupied if (user.userStatus == UserStatusEnum::kAvailable) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to add credential to user: user slot is empty " - "[endpointId=%d,credentialIndex=%d,userIndex=%d]", - endpointId, credential.credentialIndex, userIndex); + ChipLogProgress(Zcl, + "[SetCredential] Unable to add credential to user: user slot is empty " + "[endpointId=%d,credentialIndex=%d,userIndex=%d]", + endpointId, credential.credentialIndex, userIndex); return DlStatus::kInvalidField; } @@ -2096,19 +2111,21 @@ DlStatus DoorLockServer::createNewCredentialAndAddItToUser(chip::EndpointId endp auto status = addCredentialToUser(endpointId, modifierFabricIdx, userIndex, credential); if (DlStatus::kSuccess != status) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to add credential to a user: internal error " - "[endpointId=%d,credentialIndex=%d,userIndex=%d,status=%u]", - endpointId, credential.credentialIndex, userIndex, to_underlying(status)); + ChipLogProgress(Zcl, + "[SetCredential] Unable to add credential to a user: internal error " + "[endpointId=%d,credentialIndex=%d,userIndex=%d,status=%u]", + endpointId, credential.credentialIndex, userIndex, to_underlying(status)); return status; } if (!emberAfPluginDoorLockSetCredential(endpointId, credential.credentialIndex, modifierFabricIdx, modifierFabricIdx, DlCredentialStatus::kOccupied, credential.credentialType, credentialData)) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to set the credential: app error " - "[endpointId=%d,credentialIndex=%d,credentialType=%u,dataLength=%u]", - endpointId, credential.credentialIndex, to_underlying(credential.credentialType), - static_cast(credentialData.size())); + ChipLogProgress(Zcl, + "[SetCredential] Unable to set the credential: app error " + "[endpointId=%d,credentialIndex=%d,credentialType=%u,dataLength=%u]", + endpointId, credential.credentialIndex, to_underlying(credential.credentialType), + static_cast(credentialData.size())); return DlStatus::kFailure; } @@ -2122,8 +2139,8 @@ DlStatus DoorLockServer::addCredentialToUser(chip::EndpointId endpointId, chip:: EmberAfPluginDoorLockUserInfo user; if (!emberAfPluginDoorLockGetUser(endpointId, userIndex, user)) { - emberAfDoorLockClusterPrintln("[AddCredentialToUser] Unable to get the user from app [endpointId=%d,userIndex=%d]", - endpointId, userIndex); + ChipLogProgress(Zcl, "[AddCredentialToUser] Unable to get the user from app [endpointId=%d,userIndex=%d]", endpointId, + userIndex); return DlStatus::kFailure; } @@ -2135,7 +2152,8 @@ DlStatus DoorLockServer::addCredentialToUser(chip::EndpointId endpointId, chip:: if (user.credentials.data()[i].credentialIndex == credential.credentialIndex && user.credentials.data()[i].credentialType == credential.credentialType) { - emberAfDoorLockClusterPrintln( + ChipLogProgress( + Zcl, "[AddCredentialToUser] Unable to add credential to user: credential with this index is already associated " "with user [endpointId=%d,userIndex=%d,credentialType=%d,credentialIndex=%d]", endpointId, userIndex, to_underlying(credential.credentialType), credential.credentialIndex); @@ -2156,9 +2174,10 @@ DlStatus DoorLockServer::addCredentialToUser(chip::EndpointId endpointId, chip:: // appclusters: spec defines up to NumberOfCredentialsSupportedPerUser credentials per user if (user.credentials.size() + 1 > maxCredentialsPerUser) { - emberAfDoorLockClusterPrintln("[AddCredentialToUser] Unable to add credentials to user: too many credentials " - "[endpointId=%d,userIndex=%d,userTotalCredentials=%u]", - endpointId, userIndex, static_cast(user.credentials.size())); + ChipLogProgress(Zcl, + "[AddCredentialToUser] Unable to add credentials to user: too many credentials " + "[endpointId=%d,userIndex=%d,userTotalCredentials=%u]", + endpointId, userIndex, static_cast(user.credentials.size())); return DlStatus::kResourceExhausted; } @@ -2179,18 +2198,19 @@ DlStatus DoorLockServer::addCredentialToUser(chip::EndpointId endpointId, chip:: user.userStatus, user.userType, user.credentialRule, newCredentials.Get(), user.credentials.size() + 1)) { - emberAfDoorLockClusterPrintln( - "[AddCredentialToUser] Unable to add credential to user: credential with this index is already associated " - "with user [endpointId=%d,userIndex=%d,credentialType=%d,credentialIndex=%d,userTotalCredentials=%u]", - endpointId, userIndex, to_underlying(credential.credentialType), credential.credentialIndex, - static_cast(user.credentials.size())); + ChipLogProgress(Zcl, + "[AddCredentialToUser] Unable to add credential to user: credential with this index is already associated " + "with user [endpointId=%d,userIndex=%d,credentialType=%d,credentialIndex=%d,userTotalCredentials=%u]", + endpointId, userIndex, to_underlying(credential.credentialType), credential.credentialIndex, + static_cast(user.credentials.size())); return DlStatus::kFailure; } - emberAfDoorLockClusterPrintln("[AddCredentialToUser] Credential added to user " - "[endpointId=%d,userIndex=%d,credentialType=%d,credentialIndex=%d,userTotalCredentials=%u]", - endpointId, userIndex, to_underlying(credential.credentialType), credential.credentialIndex, - static_cast(user.credentials.size() + 1)); + ChipLogProgress(Zcl, + "[AddCredentialToUser] Credential added to user " + "[endpointId=%d,userIndex=%d,credentialType=%d,credentialIndex=%d,userTotalCredentials=%u]", + endpointId, userIndex, to_underlying(credential.credentialType), credential.credentialIndex, + static_cast(user.credentials.size() + 1)); return DlStatus::kSuccess; } @@ -2202,8 +2222,8 @@ DlStatus DoorLockServer::modifyCredentialForUser(chip::EndpointId endpointId, ch EmberAfPluginDoorLockUserInfo user; if (!emberAfPluginDoorLockGetUser(endpointId, userIndex, user)) { - emberAfDoorLockClusterPrintln("[ModifyUserCredential] Unable to get the user from app [endpointId=%d,userIndex=%d]", - endpointId, userIndex); + ChipLogProgress(Zcl, "[ModifyUserCredential] Unable to get the user from app [endpointId=%d,userIndex=%d]", endpointId, + userIndex); return DlStatus::kFailure; } @@ -2225,7 +2245,8 @@ DlStatus DoorLockServer::modifyCredentialForUser(chip::EndpointId endpointId, ch memcpy(newCredentials.Get(), user.credentials.data(), sizeof(CredentialStruct) * user.credentials.size()); newCredentials[i] = credential; - emberAfDoorLockClusterPrintln( + ChipLogProgress( + Zcl, "[ModifyUserCredential] Unable to add credential to user: credential with this index is already associated " "[endpointId=%d,userIndex=%d,credentialType=%d,credentialIndex=%d]", endpointId, userIndex, to_underlying(credential.credentialType), credential.credentialIndex); @@ -2234,7 +2255,8 @@ DlStatus DoorLockServer::modifyCredentialForUser(chip::EndpointId endpointId, ch user.userUniqueId, user.userStatus, user.userType, user.credentialRule, newCredentials.Get(), user.credentials.size())) { - emberAfDoorLockClusterPrintln( + ChipLogProgress( + Zcl, "[ModifyUserCredential] Unable to modify user credential: credential with this index is already associated " "with user [endpointId=%d,userIndex=%d,credentialType=%d,credentialIndex=%d,userTotalCredentials=%u]", endpointId, userIndex, to_underlying(credential.credentialType), credential.credentialIndex, @@ -2242,21 +2264,21 @@ DlStatus DoorLockServer::modifyCredentialForUser(chip::EndpointId endpointId, ch return DlStatus::kFailure; } - emberAfDoorLockClusterPrintln( - "[ModifyUserCredential] User credential modified " - "[endpointId=%d,userIndex=%d,credentialType=%d,credentialIndex=%d,userTotalCredentials=%u]", - endpointId, userIndex, to_underlying(credential.credentialType), credential.credentialIndex, - static_cast(user.credentials.size())); + ChipLogProgress(Zcl, + "[ModifyUserCredential] User credential modified " + "[endpointId=%d,userIndex=%d,credentialType=%d,credentialIndex=%d,userTotalCredentials=%u]", + endpointId, userIndex, to_underlying(credential.credentialType), credential.credentialIndex, + static_cast(user.credentials.size())); return DlStatus::kSuccess; } } // appclusters, 5.2.4.40: if user is not associated with credential index we should return INVALID_COMMAND - emberAfDoorLockClusterPrintln( - "[ModifyUserCredential] Unable to modify user credential: user is not associated with credential index " - "[endpointId=%d,userIndex=%d,credentialIndex=%d]", - endpointId, userIndex, credential.credentialIndex); + ChipLogProgress(Zcl, + "[ModifyUserCredential] Unable to modify user credential: user is not associated with credential index " + "[endpointId=%d,userIndex=%d,credentialIndex=%d]", + endpointId, userIndex, credential.credentialIndex); return DlStatus::kInvalidField; } @@ -2271,8 +2293,8 @@ DlStatus DoorLockServer::createCredential(chip::EndpointId endpointId, chip::Fab // appclusters, 5.2.4.41.1: should send the OCCUPIED in the response when the credential is in use if (DlCredentialStatus::kAvailable != existingCredential.status) { - emberAfDoorLockClusterPrintln( - "[SetCredential] Unable to set the credential: credential slot is occupied [endpointId=%d,credentialIndex=%d]", + ChipLogProgress( + Zcl, "[SetCredential] Unable to set the credential: credential slot is occupied [endpointId=%d,credentialIndex=%d]", endpointId, credentialIndex); return DlStatus::kOccupied; @@ -2280,9 +2302,10 @@ DlStatus DoorLockServer::createCredential(chip::EndpointId endpointId, chip::Fab if (!userType.IsNull() && UserTypeEnum::kProgrammingUser == userType.Value()) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to set the credential: user type is invalid " - "[endpointId=%d,credentialIndex=%d,userType=%u]", - endpointId, credentialIndex, to_underlying(userType.Value())); + ChipLogProgress(Zcl, + "[SetCredential] Unable to set the credential: user type is invalid " + "[endpointId=%d,credentialIndex=%d,userType=%u]", + endpointId, credentialIndex, to_underlying(userType.Value())); return DlStatus::kInvalidField; } @@ -2292,8 +2315,8 @@ DlStatus DoorLockServer::createCredential(chip::EndpointId endpointId, chip::Fab DlStatus status = DlStatus::kSuccess; if (userIndex.IsNull()) { - emberAfDoorLockClusterPrintln("[SetCredential] UserIndex is not set, creating new user [endpointId=%d,credentialIndex=%d]", - endpointId, credentialIndex); + ChipLogProgress(Zcl, "[SetCredential] UserIndex is not set, creating new user [endpointId=%d,credentialIndex=%d]", + endpointId, credentialIndex); status = createNewCredentialAndUser(endpointId, creatorFabricIdx, sourceNodeId, userStatus, userType, credential, credentialData, createdUserIndex); @@ -2305,9 +2328,10 @@ DlStatus DoorLockServer::createCredential(chip::EndpointId endpointId, chip::Fab // be null. if (!userStatus.IsNull() || !userType.IsNull()) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to add credential: invalid arguments " - "[endpointId=%d,credentialIndex=%d,credentialType=%u]", - endpointId, credentialIndex, to_underlying(credentialType)); + ChipLogProgress(Zcl, + "[SetCredential] Unable to add credential: invalid arguments " + "[endpointId=%d,credentialIndex=%d,credentialType=%u]", + endpointId, credentialIndex, to_underlying(credentialType)); return DlStatus::kInvalidField; } status = createNewCredentialAndAddItToUser(endpointId, creatorFabricIdx, userIndex.Value(), credential, credentialData); @@ -2331,15 +2355,15 @@ DlStatus DoorLockServer::modifyProgrammingPIN(chip::EndpointId endpointId, chip: { if (CredentialTypeEnum::kProgrammingPIN != credentialType || 0 != credentialIndex) { - emberAfDoorLockClusterPrintln( - "[SetCredential] Unable to modify programming PIN: invalid argument [endpointId=%d,credentialIndex=%d]", endpointId, - credentialIndex); + ChipLogProgress(Zcl, + "[SetCredential] Unable to modify programming PIN: invalid argument [endpointId=%d,credentialIndex=%d]", + endpointId, credentialIndex); return DlStatus::kInvalidField; } - emberAfDoorLockClusterPrintln("[SetCredential] Modifying the programming PIN [endpointId=%d,credentialIndex=%d]", endpointId, - credentialIndex); + ChipLogProgress(Zcl, "[SetCredential] Modifying the programming PIN [endpointId=%d,credentialIndex=%d]", endpointId, + credentialIndex); uint16_t relatedUserIndex = 0; if (!findUserIndexByCredential(endpointId, CredentialTypeEnum::kProgrammingPIN, 0, relatedUserIndex)) @@ -2352,17 +2376,18 @@ DlStatus DoorLockServer::modifyProgrammingPIN(chip::EndpointId endpointId, chip: if (!emberAfPluginDoorLockSetCredential(endpointId, credentialIndex, existingCredential.createdBy, modifierFabricIndex, existingCredential.status, existingCredential.credentialType, credentialData)) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to modify the credential: app error " - "[endpointId=%d,credentialIndex=%d,credentialType=%u,credentialDataSize=%u]", - endpointId, credentialIndex, to_underlying(credentialType), - static_cast(credentialData.size())); + ChipLogProgress(Zcl, + "[SetCredential] Unable to modify the credential: app error " + "[endpointId=%d,credentialIndex=%d,credentialType=%u,credentialDataSize=%u]", + endpointId, credentialIndex, to_underlying(credentialType), + static_cast(credentialData.size())); return DlStatus::kFailure; } - emberAfDoorLockClusterPrintln("[SetCredential] Successfully modified the credential " - "[endpointId=%d,credentialIndex=%d,credentialType=%u,credentialDataSize=%u]", - endpointId, credentialIndex, to_underlying(credentialType), - static_cast(credentialData.size())); + ChipLogProgress(Zcl, + "[SetCredential] Successfully modified the credential " + "[endpointId=%d,credentialIndex=%d,credentialType=%u,credentialDataSize=%u]", + endpointId, credentialIndex, to_underlying(credentialType), static_cast(credentialData.size())); sendRemoteLockUserChange(endpointId, credentialTypeToLockDataType(credentialType), DataOperationTypeEnum::kModify, sourceNodeId, modifierFabricIndex, relatedUserIndex, credentialIndex); @@ -2380,9 +2405,10 @@ DlStatus DoorLockServer::modifyCredential(chip::EndpointId endpointId, chip::Fab // appclusters, 5.2.4.40: when modifying a credential, userStatus and userType shall both be NULL. if (!userStatus.IsNull() || !userType.IsNull()) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to modify the credential: invalid arguments " - "[endpointId=%d,credentialIndex=%d,credentialType=%u]", - endpointId, credentialIndex, to_underlying(credentialType)); + ChipLogProgress(Zcl, + "[SetCredential] Unable to modify the credential: invalid arguments " + "[endpointId=%d,credentialIndex=%d,credentialType=%u]", + endpointId, credentialIndex, to_underlying(credentialType)); return DlStatus::kInvalidField; } @@ -2394,18 +2420,20 @@ DlStatus DoorLockServer::modifyCredential(chip::EndpointId endpointId, chip::Fab if (!emberAfPluginDoorLockSetCredential(endpointId, credentialIndex, existingCredential.createdBy, modifierFabricIndex, existingCredential.status, existingCredential.credentialType, credentialData)) { - emberAfDoorLockClusterPrintln("[SetCredential] Unable to modify the credential: app error " - "[endpointId=%d,credentialIndex=%d,credentialType=%u,credentialDataSize=%u]", - endpointId, credentialIndex, to_underlying(credentialType), - static_cast(credentialData.size())); + ChipLogProgress(Zcl, + "[SetCredential] Unable to modify the credential: app error " + "[endpointId=%d,credentialIndex=%d,credentialType=%u,credentialDataSize=%u]", + endpointId, credentialIndex, to_underlying(credentialType), + static_cast(credentialData.size())); return DlStatus::kFailure; } - emberAfDoorLockClusterPrintln("[SetCredential] Successfully modified the credential " - "[endpointId=%d,credentialIndex=%d,credentialType=%u,credentialDataSize=%u]", - endpointId, credentialIndex, to_underlying(credentialType), - static_cast(credentialData.size())); + ChipLogProgress(Zcl, + "[SetCredential] Successfully modified the credential " + "[endpointId=%d,credentialIndex=%d,credentialType=%u,credentialDataSize=%u]", + endpointId, credentialIndex, to_underlying(credentialType), + static_cast(credentialData.size())); sendRemoteLockUserChange(endpointId, credentialTypeToLockDataType(credentialType), DataOperationTypeEnum::kModify, sourceNodeId, modifierFabricIndex, userIndex, credentialIndex); @@ -2689,17 +2717,19 @@ Status DoorLockServer::clearCredential(chip::EndpointId endpointId, chip::Fabric { if (CredentialTypeEnum::kProgrammingPIN == credentialType) { - emberAfDoorLockClusterPrintln("[clearCredential] Cannot clear programming PIN credentials " - "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d]", - endpointId, to_underlying(credentialType), credentialIndex, modifier); + ChipLogProgress(Zcl, + "[clearCredential] Cannot clear programming PIN credentials " + "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d]", + endpointId, to_underlying(credentialType), credentialIndex, modifier); return Status::InvalidCommand; } if (!credentialIndexValid(endpointId, credentialType, credentialIndex)) { - emberAfDoorLockClusterPrintln("[clearCredential] Cannot clear credential - index out of bounds " - "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d]", - endpointId, to_underlying(credentialType), credentialIndex, modifier); + ChipLogProgress(Zcl, + "[clearCredential] Cannot clear credential - index out of bounds " + "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d]", + endpointId, to_underlying(credentialType), credentialIndex, modifier); return Status::InvalidCommand; } @@ -2716,18 +2746,20 @@ Status DoorLockServer::clearCredential(chip::EndpointId endpointId, chip::Fabric if (DlCredentialStatus::kAvailable == credential.status) { - emberAfDoorLockClusterPrintln("[clearCredential] Ignored attempt to clear unoccupied credential slot " - "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d]", - endpointId, to_underlying(credentialType), credentialIndex, modifier); + ChipLogProgress(Zcl, + "[clearCredential] Ignored attempt to clear unoccupied credential slot " + "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d]", + endpointId, to_underlying(credentialType), credentialIndex, modifier); return Status::Success; } if (credentialType != credential.credentialType) { - emberAfDoorLockClusterPrintln("[clearCredential] Ignored attempt to clear credential of different type " - "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d,actualCredentialType=%u]", - endpointId, to_underlying(credentialType), credentialIndex, modifier, - to_underlying(credential.credentialType)); + ChipLogProgress(Zcl, + "[clearCredential] Ignored attempt to clear credential of different type " + "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d,actualCredentialType=%u]", + endpointId, to_underlying(credentialType), credentialIndex, modifier, + to_underlying(credential.credentialType)); return Status::Success; } @@ -2754,9 +2786,10 @@ Status DoorLockServer::clearCredential(chip::EndpointId endpointId, chip::Fabric } if (1 == relatedUser.credentials.size()) { - emberAfDoorLockClusterPrintln("[clearCredential] Clearing related user - no credentials left " - "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d,userIndex=%d]", - endpointId, to_underlying(credentialType), credentialIndex, modifier, relatedUserIndex); + ChipLogProgress(Zcl, + "[clearCredential] Clearing related user - no credentials left " + "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d,userIndex=%d]", + endpointId, to_underlying(credentialType), credentialIndex, modifier, relatedUserIndex); auto clearStatus = clearUser(endpointId, modifier, sourceNodeId, relatedUserIndex, relatedUser, true); if (Status::Success != clearStatus) { @@ -2768,9 +2801,10 @@ Status DoorLockServer::clearCredential(chip::EndpointId endpointId, chip::Fabric return Status::Failure; } - emberAfDoorLockClusterPrintln("[clearCredential] Successfully clear credential and related user " - "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d,userIndex=%d]", - endpointId, to_underlying(credentialType), credentialIndex, modifier, relatedUserIndex); + ChipLogProgress(Zcl, + "[clearCredential] Successfully clear credential and related user " + "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d,userIndex=%d]", + endpointId, to_underlying(credentialType), credentialIndex, modifier, relatedUserIndex); return Status::Success; } @@ -2841,11 +2875,11 @@ Status DoorLockServer::clearCredential(chip::EndpointId endpointId, chip::Fabric return Status::Failure; } - emberAfDoorLockClusterPrintln( - "[clearCredential] Successfully clear credential and related user " - "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d,userIndex=%d,newCredentialsCount=%u]", - endpointId, to_underlying(credentialType), credentialIndex, modifier, relatedUserIndex, - static_cast(newCredentialsCount)); + ChipLogProgress(Zcl, + "[clearCredential] Successfully clear credential and related user " + "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d,userIndex=%d,newCredentialsCount=%u]", + endpointId, to_underlying(credentialType), credentialIndex, modifier, relatedUserIndex, + static_cast(newCredentialsCount)); if (sendUserChangeEvent) { @@ -2868,7 +2902,7 @@ Status DoorLockServer::clearCredentials(chip::EndpointId endpointId, chip::Fabri return status; } - emberAfDoorLockClusterPrintln("[clearCredentials] All PIN credentials were cleared [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[clearCredentials] All PIN credentials were cleared [endpointId=%d]", endpointId); } if (SupportsRFID(endpointId)) @@ -2880,7 +2914,7 @@ Status DoorLockServer::clearCredentials(chip::EndpointId endpointId, chip::Fabri to_underlying(status)); return status; } - emberAfDoorLockClusterPrintln("[clearCredentials] All RFID credentials were cleared [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[clearCredentials] All RFID credentials were cleared [endpointId=%d]", endpointId); } if (SupportsFingers(endpointId)) @@ -2901,7 +2935,7 @@ Status DoorLockServer::clearCredentials(chip::EndpointId endpointId, chip::Fabri return status; } - emberAfDoorLockClusterPrintln("[clearCredentials] All Finger credentials were cleared [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[clearCredentials] All Finger credentials were cleared [endpointId=%d]", endpointId); } if (SupportsFace(endpointId)) @@ -2913,7 +2947,7 @@ Status DoorLockServer::clearCredentials(chip::EndpointId endpointId, chip::Fabri to_underlying(status)); return status; } - emberAfDoorLockClusterPrintln("[clearCredentials] All face credentials were cleared [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[clearCredentials] All face credentials were cleared [endpointId=%d]", endpointId); } return Status::Success; @@ -3087,10 +3121,10 @@ bool DoorLockServer::sendRemoteLockUserChange(chip::EndpointId endpointId, LockD endpointId); return false; } - emberAfDoorLockClusterPrintln("[RemoteLockUserChange] Sent lock user change event " - "[endpointId=%d,eventNumber=%" PRIu64 ",dataType=%u,operation=%u,nodeId=%" PRIu64 - ",fabricIndex=%d]", - endpointId, eventNumber, to_underlying(dataType), to_underlying(operation), nodeId, fabricIndex); + ChipLogProgress(Zcl, + "[RemoteLockUserChange] Sent lock user change event " + "[endpointId=%d,eventNumber=%" PRIu64 ",dataType=%u,operation=%u,nodeId=%" PRIu64 ",fabricIndex=%d]", + endpointId, eventNumber, to_underlying(dataType), to_underlying(operation), nodeId, fabricIndex); return true; } @@ -3132,37 +3166,37 @@ void DoorLockServer::setHolidayScheduleCommandHandler(chip::app::CommandHandler auto endpointId = commandPath.mEndpointId; if (!SupportsHolidaySchedules(endpointId)) { - emberAfDoorLockClusterPrintln("[SetHolidaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[SetHolidaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } - emberAfDoorLockClusterPrintln("[SetHolidaySchedule] incoming command [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[SetHolidaySchedule] incoming command [endpointId=%d]", endpointId); if (!holidayIndexValid(endpointId, holidayIndex)) { - emberAfDoorLockClusterPrintln( - "[SetHolidaySchedule] Unable to add schedule - index out of range [endpointId=%d,scheduleIndex=%d]", endpointId, - holidayIndex); + ChipLogProgress(Zcl, "[SetHolidaySchedule] Unable to add schedule - index out of range [endpointId=%d,scheduleIndex=%d]", + endpointId, holidayIndex); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } if (localEndTime <= localStartTime) { - emberAfDoorLockClusterPrintln("[SetHolidaySchedule] Unable to add schedule - schedule ends earlier than starts" - "[endpointId=%d,scheduleIndex=%d,localStarTime=%" PRIu32 ",localEndTime=%" PRIu32 "]", - endpointId, holidayIndex, localStartTime, localEndTime); + ChipLogProgress(Zcl, + "[SetHolidaySchedule] Unable to add schedule - schedule ends earlier than starts" + "[endpointId=%d,scheduleIndex=%d,localStarTime=%" PRIu32 ",localEndTime=%" PRIu32 "]", + endpointId, holidayIndex, localStartTime, localEndTime); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } if (operatingMode == OperatingModeEnum::kUnknownEnumValue) { - emberAfDoorLockClusterPrintln("[SetHolidaySchedule] Unable to add schedule - operating mode is unknown" - "[endpointId=%d,scheduleIndex=%d,localStarTime=%" PRIu32 ",localEndTime=%" PRIu32 - ", operatingMode=%d]", - endpointId, holidayIndex, localStartTime, localEndTime, to_underlying(operatingMode)); + ChipLogProgress(Zcl, + "[SetHolidaySchedule] Unable to add schedule - operating mode is unknown" + "[endpointId=%d,scheduleIndex=%d,localStarTime=%" PRIu32 ",localEndTime=%" PRIu32 ", operatingMode=%d]", + endpointId, holidayIndex, localStartTime, localEndTime, to_underlying(operatingMode)); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } @@ -3177,10 +3211,10 @@ void DoorLockServer::setHolidayScheduleCommandHandler(chip::app::CommandHandler return; } - emberAfDoorLockClusterPrintln("[SetHolidaySchedule] Successfully created new schedule " - "[endpointId=%d,scheduleIndex=%d,localStartTime=%" PRIu32 ",endTime=%" PRIu32 - ",operatingMode=%d]", - endpointId, holidayIndex, localStartTime, localEndTime, to_underlying(operatingMode)); + ChipLogProgress(Zcl, + "[SetHolidaySchedule] Successfully created new schedule " + "[endpointId=%d,scheduleIndex=%d,localStartTime=%" PRIu32 ",endTime=%" PRIu32 ",operatingMode=%d]", + endpointId, holidayIndex, localStartTime, localEndTime, to_underlying(operatingMode)); commandObj->AddStatus(commandPath, Status::Success); } @@ -3191,19 +3225,17 @@ void DoorLockServer::getHolidayScheduleCommandHandler(chip::app::CommandHandler auto endpointId = commandPath.mEndpointId; if (!SupportsHolidaySchedules(endpointId)) { - emberAfDoorLockClusterPrintln("[GetHolidaySchedule] Ignore command (not supported) [endpointId=%d,scheduleIndex=%d]", - endpointId, holidayIndex); + ChipLogProgress(Zcl, "[GetHolidaySchedule] Ignore command (not supported) [endpointId=%d,scheduleIndex=%d]", endpointId, + holidayIndex); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } - emberAfDoorLockClusterPrintln("[GetHolidaySchedule] incoming command [endpointId=%d,scheduleIndex=%d]", endpointId, - holidayIndex); + ChipLogProgress(Zcl, "[GetHolidaySchedule] incoming command [endpointId=%d,scheduleIndex=%d]", endpointId, holidayIndex); if (!holidayIndexValid(endpointId, holidayIndex)) { - emberAfDoorLockClusterPrintln( - "[GetYearDaySchedule] Unable to get schedule - index out of range [endpointId=%d,scheduleIndex=%d]", endpointId, - holidayIndex); + ChipLogProgress(Zcl, "[GetYearDaySchedule] Unable to get schedule - index out of range [endpointId=%d,scheduleIndex=%d]", + endpointId, holidayIndex); sendHolidayScheduleResponse(commandObj, commandPath, holidayIndex, DlStatus::kInvalidField); return; } @@ -3225,17 +3257,16 @@ void DoorLockServer::clearHolidayScheduleCommandHandler(chip::app::CommandHandle auto endpointId = commandPath.mEndpointId; if (!SupportsHolidaySchedules(endpointId)) { - emberAfDoorLockClusterPrintln("[ClearHolidaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + ChipLogProgress(Zcl, "[ClearHolidaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } - emberAfDoorLockClusterPrintln("[ClearHolidaySchedule] incoming command [endpointId=%d,scheduleIndex=%d]", endpointId, - holidayIndex); + ChipLogProgress(Zcl, "[ClearHolidaySchedule] incoming command [endpointId=%d,scheduleIndex=%d]", endpointId, holidayIndex); if (!holidayIndexValid(endpointId, holidayIndex) && 0xFE != holidayIndex) { - emberAfDoorLockClusterPrintln("[ClearHolidaySchedule] Holiday index is out of range [endpointId=%d,scheduleIndex=%d]", - endpointId, holidayIndex); + ChipLogProgress(Zcl, "[ClearHolidaySchedule] Holiday index is out of range [endpointId=%d,scheduleIndex=%d]", endpointId, + holidayIndex); commandObj->AddStatus(commandPath, Status::InvalidCommand); return; } @@ -3243,22 +3274,22 @@ void DoorLockServer::clearHolidayScheduleCommandHandler(chip::app::CommandHandle DlStatus clearStatus = DlStatus::kSuccess; if (0xFE == holidayIndex) { - emberAfDoorLockClusterPrintln( - "[ClearHolidaySchedule] Clearing all holiday schedules for a single user [endpointId=%d,scheduleIndex=%d]", endpointId, - holidayIndex); + ChipLogProgress(Zcl, + "[ClearHolidaySchedule] Clearing all holiday schedules for a single user [endpointId=%d,scheduleIndex=%d]", + endpointId, holidayIndex); clearStatus = clearHolidaySchedules(endpointId); } else { - emberAfDoorLockClusterPrintln("[ClearHolidaySchedule] Clearing a single schedule [endpointId=%d,scheduleIndex=%d]", - endpointId, holidayIndex); + ChipLogProgress(Zcl, "[ClearHolidaySchedule] Clearing a single schedule [endpointId=%d,scheduleIndex=%d]", endpointId, + holidayIndex); clearStatus = clearHolidaySchedule(endpointId, holidayIndex); } if (DlStatus::kSuccess != clearStatus) { - emberAfDoorLockClusterPrintln( - "[ClearHolidaySchedule] Unable to clear the user schedules - app error [endpointId=%d,scheduleIndex=%d,status=%u]", + ChipLogProgress( + Zcl, "[ClearHolidaySchedule] Unable to clear the user schedules - app error [endpointId=%d,scheduleIndex=%d,status=%u]", endpointId, holidayIndex, to_underlying(clearStatus)); commandObj->AddStatus(commandPath, Status::Failure); return; @@ -3295,8 +3326,8 @@ CHIP_ERROR DoorLockServer::sendClusterResponse(chip::app::CommandHandler * comma EmberAfDoorLockEndpointContext * DoorLockServer::getContext(chip::EndpointId endpointId) { - auto index = emberAfFindClusterServerEndpointIndex(endpointId, ::Id); - if (index != 0xFFFF) + auto index = emberAfGetClusterServerEndpointIndex(endpointId, ::Id, EMBER_AF_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT); + if (index < kDoorLockClusterServerMaxEndpointCount) { return &mEndpointCtx[index]; } @@ -3332,9 +3363,9 @@ bool DoorLockServer::HandleRemoteLockOperation(chip::app::CommandHandler * comma VerifyOrExit(nullptr != endpointContext, ChipLogError(Zcl, "Failed to get endpoint index for cluster [endpoint=%d]", endpoint)); if (endpointContext->lockoutEndTimestamp >= currentTime) { - emberAfDoorLockClusterPrintln( - "Rejecting remote lock operation -- lockout is in action [endpoint=%d,lockoutEnd=%u,currentTime=%u]", endpoint, - static_cast(endpointContext->lockoutEndTimestamp.count()), static_cast(currentTime.count())); + ChipLogProgress(Zcl, "Rejecting remote lock operation -- lockout is in action [endpoint=%d,lockoutEnd=%u,currentTime=%u]", + endpoint, static_cast(endpointContext->lockoutEndTimestamp.count()), + static_cast(currentTime.count())); sendEvent = false; goto exit; } @@ -3345,9 +3376,9 @@ bool DoorLockServer::HandleRemoteLockOperation(chip::app::CommandHandler * comma // If the PINCode field is provided, the door lock SHALL verify PINCode before granting access regardless of the value // of RequirePINForRemoteOperation attribute. VerifyOrExit(SupportsPIN(endpoint) && SupportsUSR(endpoint), - emberAfDoorLockClusterPrintln( - "PIN code is supplied while USR/PIN features are disabled. Exiting [endpoint=%d, lock_op=%d]", endpoint, - chip::to_underlying(opType))); + ChipLogProgress(Zcl, + "PIN code is supplied while USR/PIN features are disabled. Exiting [endpoint=%d, lock_op=%d]", + endpoint, chip::to_underlying(opType))); // Look up the user index and credential index -- it should be used in the Lock Operation event EmberAfPluginDoorLockUserInfo user; @@ -3360,8 +3391,8 @@ bool DoorLockServer::HandleRemoteLockOperation(chip::app::CommandHandler * comma } else { - emberAfDoorLockClusterPrintln("Rejecting lock operation: unknown PIN provided [endpoint=%d, lock_op=%d]", endpoint, - to_underlying(opType)); + ChipLogProgress(Zcl, "Rejecting lock operation: unknown PIN provided [endpoint=%d, lock_op=%d]", endpoint, + to_underlying(opType)); reason = OperationErrorEnum::kInvalidCredential; goto exit; } @@ -3369,9 +3400,9 @@ bool DoorLockServer::HandleRemoteLockOperation(chip::app::CommandHandler * comma // If the user status is OccupiedDisabled we should deny the access and send out the appropriate event VerifyOrExit(user.userStatus != UserStatusEnum::kOccupiedDisabled, { reason = OperationErrorEnum::kDisabledUserDenied; - emberAfDoorLockClusterPrintln( - "Unable to perform remote lock operation: user is disabled [endpoint=%d, lock_op=%d, userIndex=%d]", endpoint, - to_underlying(opType), userIdx); + ChipLogProgress(Zcl, + "Unable to perform remote lock operation: user is disabled [endpoint=%d, lock_op=%d, userIndex=%d]", + endpoint, to_underlying(opType), userIdx); }); } else @@ -3392,7 +3423,7 @@ bool DoorLockServer::HandleRemoteLockOperation(chip::app::CommandHandler * comma // If the PIN is required but not provided we should exit VerifyOrExit(!requirePin, { reason = OperationErrorEnum::kInvalidCredential; - emberAfDoorLockClusterPrintln("Checking credentials failed: PIN is not provided when it is required"); + ChipLogProgress(Zcl, "Checking credentials failed: PIN is not provided when it is required"); }); } @@ -3543,7 +3574,7 @@ bool emberAfDoorLockClusterLockDoorCallback(chip::app::CommandHandler * commandO const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::LockDoor::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("Received command: LockDoor"); + ChipLogProgress(Zcl, "Received command: LockDoor"); DoorLockServer::Instance().HandleRemoteLockOperation(commandObj, commandPath, LockOperationTypeEnum::kLock, emberAfPluginDoorLockOnDoorLockCommand, commandData.PINCode); return true; @@ -3553,7 +3584,7 @@ bool emberAfDoorLockClusterUnlockDoorCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::UnlockDoor::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("Received command: UnlockDoor"); + ChipLogProgress(Zcl, "Received command: UnlockDoor"); LockOperationTypeEnum lockOp = LockOperationTypeEnum::kUnlock; @@ -3582,7 +3613,7 @@ bool emberAfDoorLockClusterUnlockWithTimeoutCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("Received command: UnlockWithTimeout"); + ChipLogProgress(Zcl, "Received command: UnlockWithTimeout"); LockOperationTypeEnum lockOp = LockOperationTypeEnum::kUnlock; @@ -3611,7 +3642,7 @@ bool emberAfDoorLockClusterUnboltDoorCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::UnboltDoor::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("Received command: UnboltDoor"); + ChipLogProgress(Zcl, "Received command: UnboltDoor"); if (DoorLockServer::Instance().HandleRemoteLockOperation(commandObj, commandPath, LockOperationTypeEnum::kUnlock, emberAfPluginDoorLockOnDoorUnboltCommand, commandData.PINCode)) @@ -3878,7 +3909,7 @@ void emberAfPluginDoorLockServerRelockEventHandler() {} void MatterDoorLockPluginServerInitCallback() { - emberAfDoorLockClusterPrintln("Door Lock server initialized"); + ChipLogProgress(Zcl, "Door Lock server initialized"); Server::GetInstance().GetFabricTable().AddFabricDelegate(&gFabricDelegate); } @@ -3886,7 +3917,7 @@ void MatterDoorLockClusterServerAttributeChangedCallback(const app::ConcreteAttr void MatterDoorLockClusterServerShutdownCallback(EndpointId endpoint) { - emberAfDoorLockClusterPrintln("Shuting door lock server cluster on endpoint %d", endpoint); + ChipLogProgress(Zcl, "Shuting door lock server cluster on endpoint %d", endpoint); DeviceLayer::SystemLayer().CancelTimer(DoorLockServer::DoorLockOnAutoRelockCallback, reinterpret_cast(static_cast(endpoint))); @@ -3904,13 +3935,13 @@ void DoorLockServer::DoorLockOnAutoRelockCallback(System::Layer *, void * callba if (Attributes::LockState::Get(endpointId, lockState) != EMBER_ZCL_STATUS_SUCCESS || lockState.IsNull() || lockState.Value() != DlLockState::kLocked) { - emberAfDoorLockClusterPrintln("Door Auto relock timer expired. %s", "Locking..."); + ChipLogProgress(Zcl, "Door Auto relock timer expired. %s", "Locking..."); DoorLockServer::Instance().SetLockState(endpointId, DlLockState::kLocked, OperationSourceEnum::kAuto); emberAfPluginDoorLockOnAutoRelock(endpointId); } else { - emberAfDoorLockClusterPrintln("Door Auto relock timer expired. %s", "Already locked."); + ChipLogProgress(Zcl, "Door Auto relock timer expired. %s", "Already locked."); } } diff --git a/src/app/clusters/door-lock-server/door-lock-server.h b/src/app/clusters/door-lock-server/door-lock-server.h index 05d1d5ee7e56bd..bb2ce23571ba8b 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #ifndef DOOR_LOCK_SERVER_ENDPOINT @@ -559,7 +560,11 @@ class DoorLockServer chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::DecodableType & commandData); - std::array mEndpointCtx; + static constexpr size_t kDoorLockClusterServerMaxEndpointCount = + EMBER_AF_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; + static_assert(kDoorLockClusterServerMaxEndpointCount <= kEmberInvalidEndpointIndex, "DoorLock Endpoint count error"); + + std::array mEndpointCtx; static DoorLockServer instance; }; diff --git a/src/app/clusters/keypad-input-server/keypad-input-server.cpp b/src/app/clusters/keypad-input-server/keypad-input-server.cpp index 9790e2f5a6b6ab..9bcbfee6baae39 100644 --- a/src/app/clusters/keypad-input-server/keypad-input-server.cpp +++ b/src/app/clusters/keypad-input-server/keypad-input-server.cpp @@ -47,6 +47,7 @@ using chip::Protocols::InteractionModel::Status; static constexpr size_t kKeypadInputDelegateTableSize = EMBER_AF_KEYPAD_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kKeypadInputDelegateTableSize < kEmberInvalidEndpointIndex, "KeypadInput Delegate table size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -69,8 +70,9 @@ Delegate * GetDelegate(EndpointId endpoint) #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED ChipLogProgress(Zcl, "KeypadInput NOT returning ContentApp delegate for endpoint:%u", endpoint); - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, KeypadInput::Id); - return ((ep == 0xFFFF || ep >= EMBER_AF_KEYPAD_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT) ? nullptr : gDelegateTable[ep]); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, KeypadInput::Id, EMBER_AF_KEYPAD_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kKeypadInputDelegateTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -91,9 +93,10 @@ namespace KeypadInput { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, KeypadInput::Id); - // if endpoint is found and is not a dynamic endpoint - if (ep != 0xFFFF && ep < EMBER_AF_KEYPAD_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT) + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, KeypadInput::Id, EMBER_AF_KEYPAD_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found + if (ep < kKeypadInputDelegateTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index 66533df0a88e0e..45dd512cce55c5 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -73,6 +73,7 @@ static bool areStartUpLevelControlServerAttributesNonVolatile(EndpointId endpoin static constexpr size_t kLevelControlStateTableSize = EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kLevelControlStateTableSize <= kEmberInvalidEndpointIndex, "LevelControl state table size error"); struct CallbackScheduleState { @@ -194,8 +195,9 @@ static void cancelEndpointTimerCallback(EndpointId endpoint) static EmberAfLevelControlState * getState(EndpointId endpoint) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, LevelControl::Id); - return (ep == 0xFFFF ? nullptr : &stateTable[ep]); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, LevelControl::Id, EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kLevelControlStateTableSize ? nullptr : &stateTable[ep]); } #if !defined(IGNORE_LEVEL_CONTROL_CLUSTER_OPTIONS) && defined(EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP) @@ -205,7 +207,7 @@ static void reallyUpdateCoupledColorTemp(EndpointId endpoint) EmberAfStatus status = Attributes::Options::Get(endpoint, &options); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("Unable to read Options attribute: 0x%X", status); + ChipLogProgress(Zcl, "Unable to read Options attribute: 0x%X", status); return; } @@ -238,13 +240,13 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) if (status != EMBER_ZCL_STATUS_SUCCESS || currentLevel.IsNull()) { - emberAfLevelControlClusterPrintln("ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", status); state->callbackSchedule.runTime = System::Clock::Milliseconds32(0); writeRemainingTime(endpoint, 0); return; } - emberAfLevelControlClusterPrint("Event: move from %d", currentLevel.Value()); + ChipLogProgress(Zcl, "Event: move from %d", currentLevel.Value()); // adjust by the proper amount, either up or down if (state->transitionTimeMs == 0) @@ -265,13 +267,13 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) currentLevel.SetNonNull(static_cast(currentLevel.Value() - 1)); } - emberAfLevelControlClusterPrint(" to %d ", currentLevel.Value()); - emberAfLevelControlClusterPrintln("(diff %c1)", state->increasing ? '+' : '-'); + ChipLogProgress(Zcl, " to %d ", currentLevel.Value()); + ChipLogProgress(Zcl, "(diff %c1)", state->increasing ? '+' : '-'); status = Attributes::CurrentLevel::Set(endpoint, currentLevel); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("ERR: writing current level %x", status); + ChipLogProgress(Zcl, "ERR: writing current level %x", status); state->callbackSchedule.runTime = System::Clock::Milliseconds32(0); writeRemainingTime(endpoint, 0); return; @@ -302,7 +304,7 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) status = Attributes::CurrentLevel::Set(endpoint, storedLevel8u); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("ERR: writing current level %x", status); + ChipLogProgress(Zcl, "ERR: writing current level %x", status); } else { @@ -345,7 +347,7 @@ static void writeRemainingTime(EndpointId endpoint, uint16_t remainingTimeMs) EmberStatus status = LevelControl::Attributes::RemainingTime::Set(endpoint, remainingTimeDs); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("ERR: writing remaining time %x", status); + ChipLogProgress(Zcl, "ERR: writing remaining time %x", status); } } #endif // IGNORE_LEVEL_CONTROL_CLUSTER_LEVEL_CONTROL_REMAINING_TIME @@ -356,7 +358,7 @@ static void setOnOffValue(EndpointId endpoint, bool onOff) #ifdef EMBER_AF_PLUGIN_ON_OFF if (emberAfContainsServer(endpoint, OnOff::Id)) { - emberAfLevelControlClusterPrintln("Setting on/off to %s due to level change", onOff ? "ON" : "OFF"); + ChipLogProgress(Zcl, "Setting on/off to %s due to level change", onOff ? "ON" : "OFF"); OnOffServer::Instance().setOnOffValue(endpoint, (onOff ? OnOff::Commands::On::Id : OnOff::Commands::Off::Id), true); } #endif // EMBER_AF_PLUGIN_ON_OFF @@ -392,7 +394,7 @@ static bool shouldExecuteIfOff(EndpointId endpoint, CommandId commandId, EmberAfStatus status = Attributes::Options::Get(endpoint, &options); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("Unable to read Options attribute: 0x%X", status); + ChipLogProgress(Zcl, "Unable to read Options attribute: 0x%X", status); // If we can't read the attribute, then we should just assume that it has its // default value. } @@ -401,7 +403,7 @@ static bool shouldExecuteIfOff(EndpointId endpoint, CommandId commandId, status = OnOff::Attributes::OnOff::Get(endpoint, &on); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("Unable to read OnOff attribute: 0x%X", status); + ChipLogProgress(Zcl, "Unable to read OnOff attribute: 0x%X", status); return true; } // The device is on - hence ExecuteIfOff does not matter @@ -466,13 +468,13 @@ Status MoveToLevel(EndpointId endpointId, const Commands::MoveToLevel::Decodable if (transitionTime.IsNull()) { - emberAfLevelControlClusterPrintln("%s MOVE_TO_LEVEL %x null %x %x", "RX level-control:", level, optionsMask.Raw(), - optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s MOVE_TO_LEVEL %x null %x %x", "RX level-control:", level, optionsMask.Raw(), + optionsOverride.Raw()); } else { - emberAfLevelControlClusterPrintln("%s MOVE_TO_LEVEL %x %2x %x %x", "RX level-control:", level, transitionTime.Value(), - optionsMask.Raw(), optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s MOVE_TO_LEVEL %x %2x %x %x", "RX level-control:", level, transitionTime.Value(), optionsMask.Raw(), + optionsOverride.Raw()); } return moveToLevelHandler(endpointId, Commands::MoveToLevel::Id, level, transitionTime, @@ -493,13 +495,13 @@ bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(app::CommandHandler if (transitionTime.IsNull()) { - emberAfLevelControlClusterPrintln("%s MOVE_TO_LEVEL_WITH_ON_OFF %x null %x %x", "RX level-control:", level, - optionsMask.Raw(), optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s MOVE_TO_LEVEL_WITH_ON_OFF %x null %x %x", "RX level-control:", level, optionsMask.Raw(), + optionsOverride.Raw()); } else { - emberAfLevelControlClusterPrintln("%s MOVE_TO_LEVEL_WITH_ON_OFF %x %2x %x %x", "RX level-control:", level, - transitionTime.Value(), optionsMask.Raw(), optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s MOVE_TO_LEVEL_WITH_ON_OFF %x %2x %x %x", "RX level-control:", level, transitionTime.Value(), + optionsMask.Raw(), optionsOverride.Raw()); } Status status = moveToLevelHandler(commandPath.mEndpointId, Commands::MoveToLevelWithOnOff::Id, level, transitionTime, @@ -522,13 +524,12 @@ bool emberAfLevelControlClusterMoveCallback(app::CommandHandler * commandObj, co if (rate.IsNull()) { - emberAfLevelControlClusterPrintln("%s MOVE %x null %x %x", "RX level-control:", moveMode, optionsMask.Raw(), - optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s MOVE %x null %x %x", "RX level-control:", moveMode, optionsMask.Raw(), optionsOverride.Raw()); } else { - emberAfLevelControlClusterPrintln("%s MOVE %x %u %x %x", "RX level-control:", moveMode, rate.Value(), optionsMask.Raw(), - optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s MOVE %x %u %x %x", "RX level-control:", moveMode, rate.Value(), optionsMask.Raw(), + optionsOverride.Raw()); } moveHandler(commandObj, commandPath, moveMode, rate, Optional>(optionsMask), @@ -546,13 +547,13 @@ bool emberAfLevelControlClusterMoveWithOnOffCallback(app::CommandHandler * comma if (rate.IsNull()) { - emberAfLevelControlClusterPrintln("%s MOVE_WITH_ON_OFF %x null %x %x", "RX level-control:", moveMode, optionsMask.Raw(), - optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s MOVE_WITH_ON_OFF %x null %x %x", "RX level-control:", moveMode, optionsMask.Raw(), + optionsOverride.Raw()); } else { - emberAfLevelControlClusterPrintln("%s MOVE_WITH_ON_OFF %u %2x %x %x", "RX level-control:", moveMode, rate.Value(), - optionsMask.Raw(), optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s MOVE_WITH_ON_OFF %u %2x %x %x", "RX level-control:", moveMode, rate.Value(), optionsMask.Raw(), + optionsOverride.Raw()); } moveHandler(commandObj, commandPath, moveMode, rate, Optional>(optionsMask), @@ -571,13 +572,13 @@ bool emberAfLevelControlClusterStepCallback(app::CommandHandler * commandObj, co if (transitionTime.IsNull()) { - emberAfLevelControlClusterPrintln("%s STEP %x %x null %x %x", "RX level-control:", stepMode, stepSize, optionsMask.Raw(), - optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s STEP %x %x null %x %x", "RX level-control:", stepMode, stepSize, optionsMask.Raw(), + optionsOverride.Raw()); } else { - emberAfLevelControlClusterPrintln("%s STEP %x %x %2x %x %x", "RX level-control:", stepMode, stepSize, - transitionTime.Value(), optionsMask.Raw(), optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s STEP %x %x %2x %x %x", "RX level-control:", stepMode, stepSize, transitionTime.Value(), + optionsMask.Raw(), optionsOverride.Raw()); } stepHandler(commandObj, commandPath, stepMode, stepSize, transitionTime, Optional>(optionsMask), @@ -596,13 +597,13 @@ bool emberAfLevelControlClusterStepWithOnOffCallback(app::CommandHandler * comma if (transitionTime.IsNull()) { - emberAfLevelControlClusterPrintln("%s STEP_WITH_ON_OFF %x %x null %x %x", "RX level-control:", stepMode, stepSize, - optionsMask.Raw(), optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s STEP_WITH_ON_OFF %x %x null %x %x", "RX level-control:", stepMode, stepSize, optionsMask.Raw(), + optionsOverride.Raw()); } else { - emberAfLevelControlClusterPrintln("%s STEP_WITH_ON_OFF %x %x %2x %x %x", "RX level-control:", stepMode, stepSize, - transitionTime.Value(), optionsMask.Raw(), optionsOverride.Raw()); + ChipLogProgress(Zcl, "%s STEP_WITH_ON_OFF %x %x %2x %x %x", "RX level-control:", stepMode, stepSize, transitionTime.Value(), + optionsMask.Raw(), optionsOverride.Raw()); } stepHandler(commandObj, commandPath, stepMode, stepSize, transitionTime, Optional>(optionsMask), @@ -616,7 +617,7 @@ bool emberAfLevelControlClusterStopCallback(app::CommandHandler * commandObj, co auto & optionsMask = commandData.optionsMask; auto & optionsOverride = commandData.optionsOverride; - emberAfLevelControlClusterPrintln("%s STOP", "RX level-control:"); + ChipLogProgress(Zcl, "%s STOP", "RX level-control:"); stopHandler(commandObj, commandPath, Optional>(optionsMask), Optional>(optionsOverride)); return true; @@ -627,7 +628,7 @@ bool emberAfLevelControlClusterStopWithOnOffCallback(app::CommandHandler * comma { auto & optionsMask = commandData.optionsMask; auto & optionsOverride = commandData.optionsOverride; - emberAfLevelControlClusterPrintln("%s STOP_WITH_ON_OFF", "RX level-control:"); + ChipLogProgress(Zcl, "%s STOP_WITH_ON_OFF", "RX level-control:"); stopHandler(commandObj, commandPath, Optional>(optionsMask), Optional>(optionsOverride)); return true; @@ -663,13 +664,13 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8 EmberAfStatus status = Attributes::CurrentLevel::Get(endpoint, currentLevel); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", status); return app::ToInteractionModelStatus(status); } if (currentLevel.IsNull()) { - emberAfLevelControlClusterPrintln("ERR: Current Level is null"); + ChipLogProgress(Zcl, "ERR: Current Level is null"); return Status::Failure; } @@ -728,7 +729,7 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8 status = Attributes::OnOffTransitionTime::Get(endpoint, &onOffTransitionTime); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("ERR: reading on/off transition time %x", status); + ChipLogProgress(Zcl, "ERR: reading on/off transition time %x", status); return app::ToInteractionModelStatus(status); } @@ -756,7 +757,7 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8 #else // Transition is not supported so always use fastest transition time and ignore // both the provided transition time as well as OnOffTransitionTime. - emberAfLevelControlClusterPrintln("Device does not support transition, ignoring transition time"); + ChipLogProgress(Zcl, "Device does not support transition, ignoring transition time"); state->transitionTimeMs = FASTEST_TRANSITION_TIME_MS; #endif // IGNORE_LEVEL_CONTROL_CLUSTER_TRANSITION @@ -814,13 +815,13 @@ static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCom status = app::ToInteractionModelStatus(Attributes::CurrentLevel::Get(endpoint, currentLevel)); if (status != Status::Success) { - emberAfLevelControlClusterPrintln("ERR: reading current level %x", to_underlying(status)); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); goto send_default_response; } if (currentLevel.IsNull()) { - emberAfLevelControlClusterPrintln("ERR: Current Level is null"); + ChipLogProgress(Zcl, "ERR: Current Level is null"); status = Status::Failure; goto send_default_response; @@ -873,7 +874,7 @@ static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCom status = app::ToInteractionModelStatus(Attributes::DefaultMoveRate::Get(endpoint, defaultMoveRate)); if (status != Status::Success || defaultMoveRate.IsNull()) { - emberAfLevelControlClusterPrintln("ERR: reading default move rate %x", to_underlying(status)); + ChipLogProgress(Zcl, "ERR: reading default move rate %x", to_underlying(status)); state->eventDurationMs = FASTEST_TRANSITION_TIME_MS; } else @@ -894,7 +895,7 @@ static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCom #else // Transition/rate is not supported so always use fastest transition time and ignore // both the provided transition time as well as OnOffTransitionTime. - emberAfLevelControlClusterPrintln("Device does not support transition, ignoring rate"); + ChipLogProgress(Zcl, "Device does not support transition, ignoring rate"); state->eventDurationMs = FASTEST_TRANSITION_TIME_MS; #endif // IGNORE_LEVEL_CONTROL_CLUSTER_TRANSITION @@ -945,13 +946,13 @@ static void stepHandler(app::CommandHandler * commandObj, const app::ConcreteCom status = app::ToInteractionModelStatus(Attributes::CurrentLevel::Get(endpoint, currentLevel)); if (status != Status::Success) { - emberAfLevelControlClusterPrintln("ERR: reading current level %x", to_underlying(status)); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); goto send_default_response; } if (currentLevel.IsNull()) { - emberAfLevelControlClusterPrintln("ERR: Current Level is null"); + ChipLogProgress(Zcl, "ERR: Current Level is null"); status = Status::Failure; goto send_default_response; @@ -1032,7 +1033,7 @@ static void stepHandler(app::CommandHandler * commandObj, const app::ConcreteCom #else // Transition is not supported so always use fastest transition time and ignore // both the provided transition time as well as OnOffTransitionTime. - emberAfLevelControlClusterPrintln("Device does not support transition, ignoring transition time"); + ChipLogProgress(Zcl, "Device does not support transition, ignoring transition time"); state->transitionTimeMs = FASTEST_TRANSITION_TIME_MS; #endif // IGNORE_LEVEL_CONTROL_CLUSTER_TRANSITION @@ -1100,7 +1101,7 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new EmberAfLevelControlState * state = getState(endpoint); if (state == nullptr) { - emberAfLevelControlClusterPrintln("ERR: Level control cluster not available on ep%d", endpoint); + ChipLogProgress(Zcl, "ERR: Level control cluster not available on ep%d", endpoint); return; } @@ -1110,13 +1111,13 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new status = Attributes::CurrentLevel::Get(endpoint, temporaryCurrentLevelCache); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", status); return; } if (temporaryCurrentLevelCache.IsNull()) { - emberAfLevelControlClusterPrintln("ERR: Current Level is null"); + ChipLogProgress(Zcl, "ERR: Current Level is null"); return; } @@ -1126,7 +1127,7 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new status = Attributes::OnLevel::Get(endpoint, resolvedLevel); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("ERR: reading on level %x", status); + ChipLogProgress(Zcl, "ERR: reading on level %x", status); return; } @@ -1155,7 +1156,7 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new status = Attributes::OnOffTransitionTime::Get(endpoint, ¤tOnOffTransitionTime); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", status); return; } transitionTime.SetNonNull(currentOnOffTransitionTime); @@ -1175,7 +1176,7 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new status = Attributes::CurrentLevel::Set(endpoint, minimumLevelAllowedForTheDevice); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfLevelControlClusterPrintln("ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", status); return; } @@ -1211,7 +1212,7 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint) if (state == nullptr) { - emberAfLevelControlClusterPrintln("ERR: Level control cluster not available on ep%d", endpoint); + ChipLogProgress(Zcl, "ERR: Level control cluster not available on ep%d", endpoint); return; } @@ -1308,7 +1309,7 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint) void MatterLevelControlClusterServerShutdownCallback(EndpointId endpoint) { - emberAfLevelControlClusterPrintln("Shuting down level control server cluster on endpoint %d", endpoint); + ChipLogProgress(Zcl, "Shuting down level control server cluster on endpoint %d", endpoint); cancelEndpointTimerCallback(endpoint); } diff --git a/src/app/clusters/low-power-server/low-power-server.cpp b/src/app/clusters/low-power-server/low-power-server.cpp index 66b618c6b50636..5881d2e56fc322 100644 --- a/src/app/clusters/low-power-server/low-power-server.cpp +++ b/src/app/clusters/low-power-server/low-power-server.cpp @@ -33,10 +33,12 @@ #include using namespace chip; +using namespace chip::app::Clusters; using namespace chip::app::Clusters::LowPower; static constexpr size_t kLowPowerDelegateTableSize = EMBER_AF_LOW_POWER_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kLowPowerDelegateTableSize <= kEmberInvalidEndpointIndex, "LowPower Delegate table size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -49,8 +51,9 @@ Delegate * gDelegateTable[kLowPowerDelegateTableSize] = { nullptr }; Delegate * GetDelegate(EndpointId endpoint) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::LowPower::Id); - return (ep == 0xFFFF ? nullptr : gDelegateTable[ep]); + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, chip::app::Clusters::LowPower::Id, + EMBER_AF_LOW_POWER_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kLowPowerDelegateTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -71,8 +74,9 @@ namespace LowPower { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::LowPower::Id); - if (ep != 0xFFFF) + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, chip::app::Clusters::LowPower::Id, + EMBER_AF_LOW_POWER_CLUSTER_SERVER_ENDPOINT_COUNT); + if (ep < kLowPowerDelegateTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/media-input-server/media-input-server.cpp b/src/app/clusters/media-input-server/media-input-server.cpp index 7c19ec264f12a7..71e6223b5ce2aa 100644 --- a/src/app/clusters/media-input-server/media-input-server.cpp +++ b/src/app/clusters/media-input-server/media-input-server.cpp @@ -40,6 +40,7 @@ using Protocols::InteractionModel::Status; static constexpr size_t kMediaInputDelegateTableSize = EMBER_AF_MEDIA_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kMediaInputDelegateTableSize <= kEmberInvalidEndpointIndex, "MediaInput Delegate tablle size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -52,8 +53,9 @@ Delegate * gDelegateTable[kMediaInputDelegateTableSize] = { nullptr }; Delegate * GetDelegate(EndpointId endpoint) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::MediaInput::Id); - return (ep == 0xFFFF ? nullptr : gDelegateTable[ep]); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, MediaInput::Id, EMBER_AF_MEDIA_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kMediaInputDelegateTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -74,8 +76,9 @@ namespace MediaInput { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::MediaInput::Id); - if (ep != 0xFFFF) + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, MediaInput::Id, EMBER_AF_MEDIA_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT); + if (ep < kMediaInputDelegateTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/media-playback-server/media-playback-server.cpp b/src/app/clusters/media-playback-server/media-playback-server.cpp index 979bf49116b34b..443880cc12e40b 100644 --- a/src/app/clusters/media-playback-server/media-playback-server.cpp +++ b/src/app/clusters/media-playback-server/media-playback-server.cpp @@ -47,6 +47,7 @@ using chip::Protocols::InteractionModel::Status; static constexpr size_t kMediaPlaybackDelegateTableSize = EMBER_AF_MEDIA_PLAYBACK_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kMediaPlaybackDelegateTableSize <= kEmberInvalidEndpointIndex, "kMediaPlayback Delegate table size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -69,8 +70,9 @@ Delegate * GetDelegate(EndpointId endpoint) #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED ChipLogError(Zcl, "MediaPlayback NOT returning ContentApp delegate for endpoint:%u", endpoint); - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, MediaPlayback::Id); - return ((ep == 0xFFFF || ep >= EMBER_AF_MEDIA_PLAYBACK_CLUSTER_SERVER_ENDPOINT_COUNT) ? nullptr : gDelegateTable[ep]); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, MediaPlayback::Id, EMBER_AF_MEDIA_PLAYBACK_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kMediaPlaybackDelegateTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -91,9 +93,10 @@ namespace MediaPlayback { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, MediaPlayback::Id); - // if endpoint is found and is not a dynamic endpoint - if (ep != 0xFFFF && ep < EMBER_AF_MEDIA_PLAYBACK_CLUSTER_SERVER_ENDPOINT_COUNT) + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, MediaPlayback::Id, EMBER_AF_MEDIA_PLAYBACK_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found + if (ep < kMediaPlaybackDelegateTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/mode-select-server/mode-select-server.cpp b/src/app/clusters/mode-select-server/mode-select-server.cpp index 794662e7b7c1e8..2c9d88c1872737 100644 --- a/src/app/clusters/mode-select-server/mode-select-server.cpp +++ b/src/app/clusters/mode-select-server/mode-select-server.cpp @@ -98,7 +98,7 @@ CHIP_ERROR ModeSelectAttrAccess::Read(const ConcreteReadAttributePath & aPath, A bool emberAfModeSelectClusterChangeToModeCallback(CommandHandler * commandHandler, const ConcreteCommandPath & commandPath, const ModeSelect::Commands::ChangeToMode::DecodableType & commandData) { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "ModeSelect: Entering emberAfModeSelectClusterChangeToModeCallback"); + ChipLogProgress(Zcl, "ModeSelect: Entering emberAfModeSelectClusterChangeToModeCallback"); EndpointId endpointId = commandPath.mEndpointId; uint8_t newMode = commandData.newMode; // Check that the newMode matches one of the supported options @@ -107,13 +107,13 @@ bool emberAfModeSelectClusterChangeToModeCallback(CommandHandler * commandHandle ModeSelect::getSupportedModesManager()->getModeOptionByMode(endpointId, newMode, &modeOptionPtr); if (Status::Success != checkSupportedModeStatus) { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "ModeSelect: Failed to find the option with mode %u", newMode); + ChipLogProgress(Zcl, "ModeSelect: Failed to find the option with mode %u", newMode); commandHandler->AddStatus(commandPath, checkSupportedModeStatus); return true; } ModeSelect::Attributes::CurrentMode::Set(endpointId, newMode); - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "ModeSelect: ChangeToMode successful"); + ChipLogProgress(Zcl, "ModeSelect: ChangeToMode successful"); commandHandler->AddStatus(commandPath, Status::Success); return true; } @@ -155,7 +155,7 @@ void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) { if (onOffValueForStartUp && !onMode.IsNull()) { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "ModeSelect: CurrentMode is overwritten by OnMode"); + ChipLogProgress(Zcl, "ModeSelect: CurrentMode is overwritten by OnMode"); return; } } @@ -173,7 +173,7 @@ void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) } if (bootReason == BootReasonType::kSoftwareUpdateCompleted) { - ChipLogDetail(Zcl, "ModeSelect: CurrentMode is ignored for OTA reboot"); + ChipLogProgress(Zcl, "ModeSelect: CurrentMode is ignored for OTA reboot"); return; } @@ -190,16 +190,14 @@ void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) } else { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "ModeSelect: Successfully initialized CurrentMode to %u", - startUpMode.Value()); + ChipLogProgress(Zcl, "ModeSelect: Successfully initialized CurrentMode to %u", startUpMode.Value()); } } } } else { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, - "ModeSelect: Skipped initializing CurrentMode by StartUpMode because one of them is volatile"); + ChipLogProgress(Zcl, "ModeSelect: Skipped initializing CurrentMode by StartUpMode because one of them is volatile"); } } diff --git a/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp b/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp index b42949eadbb298..a64c749ae3070b 100644 --- a/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp +++ b/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp @@ -75,11 +75,11 @@ void halOccupancyStateChangedCallback(EndpointId endpoint, HalOccupancyState occ if (occupancyState & HAL_OCCUPANCY_STATE_OCCUPIED) { mappedOccupancyState.Set(OccupancyBitmap::kOccupied); - emberAfOccupancySensingClusterPrintln("Occupancy detected"); + ChipLogProgress(Zcl, "Occupancy detected"); } else { - emberAfOccupancySensingClusterPrintln("Occupancy no longer detected"); + ChipLogProgress(Zcl, "Occupancy no longer detected"); } Attributes::Occupancy::Set(endpoint, occupancyState); diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index b13489f7308792..78be247dd256ed 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -94,7 +94,7 @@ void OnOffServer::cancelEndpointTimerCallback(EndpointId endpoint) void MatterOnOffClusterServerShutdownCallback(EndpointId endpoint) { - emberAfOnOffClusterPrintln("Shuting down on/off server cluster on endpoint %d", endpoint); + ChipLogProgress(Zcl, "Shuting down on/off server cluster on endpoint %d", endpoint); OnOffServer::Instance().cancelEndpointTimerCallback(endpoint); } @@ -122,10 +122,10 @@ EmberAfStatus OnOffServer::getOnOffValue(chip::EndpointId endpoint, bool * curre EmberAfStatus status = Attributes::OnOff::Get(endpoint, currentOnOffValue); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfOnOffClusterPrintln("ERR: reading on/off %x", status); + ChipLogProgress(Zcl, "ERR: reading on/off %x", status); } - emberAfOnOffClusterPrintln("On/Off ep%d value: %d", endpoint, *currentOnOffValue); + ChipLogProgress(Zcl, "On/Off ep%d value: %d", endpoint, *currentOnOffValue); return status; } @@ -160,21 +160,21 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman status = Attributes::OnOff::Get(endpoint, ¤tValue); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfOnOffClusterPrintln("ERR: reading on/off %x", status); + ChipLogProgress(Zcl, "ERR: reading on/off %x", status); return status; } // if the value is already what we want to set it to then do nothing if ((!currentValue && command == Commands::Off::Id) || (currentValue && command == Commands::On::Id)) { - emberAfOnOffClusterPrintln("Endpoint %x On/off already set to new value", endpoint); + ChipLogProgress(Zcl, "Endpoint %x On/off already set to new value", endpoint); return EMBER_ZCL_STATUS_SUCCESS; } // we either got a toggle, or an on when off, or an off when on, // so we need to swap the value newValue = !currentValue; - emberAfOnOffClusterPrintln("Toggle ep%x on/off from state %x to %x", endpoint, currentValue, newValue); + ChipLogProgress(Zcl, "Toggle ep%x on/off from state %x to %x", endpoint, currentValue, newValue); // the sequence of updating on/off attribute and kick off level change effect should // be depend on whether we are turning on or off. If we are turning on the light, we @@ -190,7 +190,7 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman if (onTime == 0) { - emberAfOnOffClusterPrintln("On Command - OffWaitTime : 0"); + ChipLogProgress(Zcl, "On Command - OffWaitTime : 0"); Attributes::OffWaitTime::Set(endpoint, 0); // Stop timer on the endpoint @@ -198,7 +198,7 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman if (event != nullptr) { cancelEndpointTimerCallback(event); - emberAfOnOffClusterPrintln("On/Toggle Command - Stop Timer"); + ChipLogProgress(Zcl, "On/Toggle Command - Stop Timer"); } } @@ -209,7 +209,7 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman status = Attributes::OnOff::Set(endpoint, newValue); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfOnOffClusterPrintln("ERR: writing on/off %x", status); + ChipLogProgress(Zcl, "ERR: writing on/off %x", status); return status; } @@ -229,7 +229,7 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman ModeSelect::Attributes::OnMode::TypeInfo::Type onMode; if (ModeSelect::Attributes::OnMode::Get(endpoint, onMode) == EMBER_ZCL_STATUS_SUCCESS && !onMode.IsNull()) { - emberAfOnOffClusterPrintln("Changing Current Mode to %x", onMode.Value()); + ChipLogProgress(Zcl, "Changing Current Mode to %x", onMode.Value()); status = ModeSelect::Attributes::CurrentMode::Set(endpoint, onMode.Value()); } } @@ -251,13 +251,13 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman status = Attributes::OnOff::Set(endpoint, newValue); if (status != EMBER_ZCL_STATUS_SUCCESS) { - emberAfOnOffClusterPrintln("ERR: writing on/off %x", status); + ChipLogProgress(Zcl, "ERR: writing on/off %x", status); return status; } if (SupportsLightingApplications(endpoint)) { - emberAfOnOffClusterPrintln("Off completed. reset OnTime to 0"); + ChipLogProgress(Zcl, "Off completed. reset OnTime to 0"); Attributes::OnTime::Set(endpoint, 0); // Reset onTime } } @@ -315,7 +315,7 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) ModeSelect::Attributes::OnMode::TypeInfo::Type onMode; if (ModeSelect::Attributes::OnMode::Get(endpoint, onMode) == EMBER_ZCL_STATUS_SUCCESS && !onMode.IsNull()) { - emberAfOnOffClusterPrintln("Changing Current Mode to %x", onMode.Value()); + ChipLogProgress(Zcl, "Changing Current Mode to %x", onMode.Value()); status = ModeSelect::Attributes::CurrentMode::Set(endpoint, onMode.Value()); } } @@ -555,7 +555,7 @@ bool OnOffServer::OnWithTimedOffCommand(app::CommandHandler * commandObj, const currentOffWaitTime = offWaitTime; } - emberAfOnOffClusterPrintln("On Time: %d | off wait Time: %d", currentOnTime, currentOffWaitTime); + ChipLogProgress(Zcl, "On Time: %d | off wait Time: %d", currentOnTime, currentOffWaitTime); if (currentOnTime < MAX_TIME_VALUE && currentOffWaitTime < MAX_TIME_VALUE) { @@ -575,7 +575,7 @@ bool OnOffServer::OnWithTimedOffCommand(app::CommandHandler * commandObj, const */ void OnOffServer::updateOnOffTimeCommand(chip::EndpointId endpoint) { - emberAfOnOffClusterPrintln("Timer callback - Entering callbackc"); + ChipLogProgress(Zcl, "Timer callback - Entering callbackc"); bool isOn = false; OnOff::Attributes::OnOff::Get(endpoint, &isOn); @@ -588,7 +588,7 @@ void OnOffServer::updateOnOffTimeCommand(chip::EndpointId endpoint) // Update onTime values uint16_t onTime = MIN_TIME_VALUE; OnOff::Attributes::OnTime::Get(endpoint, &onTime); - emberAfOnOffClusterPrintln("Timer callback - On Time: %d", onTime); + ChipLogProgress(Zcl, "Timer callback - On Time: %d", onTime); if (onTime > 0) { @@ -598,7 +598,7 @@ void OnOffServer::updateOnOffTimeCommand(chip::EndpointId endpoint) if (onTime == 0) { - emberAfOnOffClusterPrintln("Timer callback - Turning off OnOff"); + ChipLogProgress(Zcl, "Timer callback - Turning off OnOff"); OnOff::Attributes::OffWaitTime::Set(endpoint, 0); setOnOffValue(endpoint, Commands::Off::Id, false); @@ -616,7 +616,7 @@ void OnOffServer::updateOnOffTimeCommand(chip::EndpointId endpoint) OnOff::Attributes::OffWaitTime::Set(endpoint, offWaitTime); } - emberAfOnOffClusterPrintln("Timer Callback - wait Off Time: %d", offWaitTime); + ChipLogProgress(Zcl, "Timer Callback - wait Off Time: %d", offWaitTime); // Validate if necessary to restart timer if (offWaitTime > 0) @@ -626,7 +626,7 @@ void OnOffServer::updateOnOffTimeCommand(chip::EndpointId endpoint) } else { - emberAfOnOffClusterPrintln("Timer Callback - wait Off Time cycle finished"); + ChipLogProgress(Zcl, "Timer Callback - wait Off Time cycle finished"); // Stop timer on the endpoint cancelEndpointTimerCallback(getEventControl(endpoint)); diff --git a/src/app/clusters/pump-configuration-and-control-server/pump-configuration-and-control-server.cpp b/src/app/clusters/pump-configuration-and-control-server/pump-configuration-and-control-server.cpp index cb369f6b2f23fd..4d9a88d3f8216c 100644 --- a/src/app/clusters/pump-configuration-and-control-server/pump-configuration-and-control-server.cpp +++ b/src/app/clusters/pump-configuration-and-control-server/pump-configuration-and-control-server.cpp @@ -246,14 +246,14 @@ bool HasFeature(EndpointId endpoint, Feature feature) void emberAfPumpConfigurationAndControlClusterServerInitCallback(EndpointId endpoint) { - emberAfDebugPrintln("Initialize PCC Server Cluster [EP:%d]", endpoint); + ChipLogProgress(Zcl, "Initialize PCC Server Cluster [EP:%d]", endpoint); } chip::Protocols::InteractionModel::Status MatterPumpConfigurationAndControlClusterServerPreAttributeChangedCallback( const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value) { - emberAfDebugPrintln("PCC Server Cluster Attribute Pre-changed [EP:%d, ID:0x%x]", attributePath.mEndpointId, - (unsigned int) attributePath.mAttributeId); + ChipLogProgress(Zcl, "PCC Server Cluster Attribute Pre-changed [EP:%d, ID:0x%x]", attributePath.mEndpointId, + (unsigned int) attributePath.mAttributeId); Protocols::InteractionModel::Status status = Protocols::InteractionModel::Status::Success; @@ -353,8 +353,8 @@ chip::Protocols::InteractionModel::Status MatterPumpConfigurationAndControlClust void MatterPumpConfigurationAndControlClusterServerAttributeChangedCallback(const app::ConcreteAttributePath & attributePath) { - emberAfDebugPrintln("PCC Server Cluster Attribute changed [EP:%d, ID:0x%x]", attributePath.mEndpointId, - (unsigned int) attributePath.mAttributeId); + ChipLogProgress(Zcl, "PCC Server Cluster Attribute changed [EP:%d, ID:0x%x]", attributePath.mEndpointId, + (unsigned int) attributePath.mAttributeId); switch (attributePath.mAttributeId) { @@ -363,7 +363,7 @@ void MatterPumpConfigurationAndControlClusterServerAttributeChangedCallback(cons setEffectiveModes(attributePath.mEndpointId); break; default: - emberAfDebugPrintln("PCC Server: unhandled attribute ID"); + ChipLogProgress(Zcl, "PCC Server: unhandled attribute ID"); } } diff --git a/src/app/clusters/target-navigator-server/target-navigator-server.cpp b/src/app/clusters/target-navigator-server/target-navigator-server.cpp index 0d71e6665006d3..d1146d9e3bd209 100644 --- a/src/app/clusters/target-navigator-server/target-navigator-server.cpp +++ b/src/app/clusters/target-navigator-server/target-navigator-server.cpp @@ -46,6 +46,7 @@ using chip::Protocols::InteractionModel::Status; static constexpr size_t kTargetNavigatorDelegateTableSize = EMBER_AF_TARGET_NAVIGATOR_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kTargetNavigatorDelegateTableSize <= kEmberInvalidEndpointIndex, "TargetNavigator Delegate table size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -68,8 +69,9 @@ Delegate * GetDelegate(EndpointId endpoint) #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED ChipLogProgress(Zcl, "TargetNavigator NOT returning ContentApp delegate for endpoint:%u", endpoint); - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, TargetNavigator::Id); - return ((ep == 0xFFFF || ep >= EMBER_AF_TARGET_NAVIGATOR_CLUSTER_SERVER_ENDPOINT_COUNT) ? nullptr : gDelegateTable[ep]); + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, TargetNavigator::Id, + EMBER_AF_TARGET_NAVIGATOR_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kTargetNavigatorDelegateTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -90,9 +92,10 @@ namespace TargetNavigator { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, TargetNavigator::Id); - // if endpoint is found and is not a dynamic endpoint - if (ep != 0xFFFF && ep < EMBER_AF_TARGET_NAVIGATOR_CLUSTER_SERVER_ENDPOINT_COUNT) + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, TargetNavigator::Id, + EMBER_AF_TARGET_NAVIGATOR_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found + if (ep < kTargetNavigatorDelegateTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/wake-on-lan-server/wake-on-lan-server.cpp b/src/app/clusters/wake-on-lan-server/wake-on-lan-server.cpp index 78878d0baf7af8..15b514c9e3f247 100644 --- a/src/app/clusters/wake-on-lan-server/wake-on-lan-server.cpp +++ b/src/app/clusters/wake-on-lan-server/wake-on-lan-server.cpp @@ -39,6 +39,7 @@ using namespace chip::app::Clusters::WakeOnLan; static constexpr size_t kWakeOnLanDelegateTableSize = EMBER_AF_WAKE_ON_LAN_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kWakeOnLanDelegateTableSize <= kEmberInvalidEndpointIndex, "WakeOnLan Delegate table size error"); // ----------------------------------------------------------------------------- // Delegate Implementation @@ -51,8 +52,8 @@ Delegate * gDelegateTable[kWakeOnLanDelegateTableSize] = { nullptr }; Delegate * GetDelegate(EndpointId endpoint) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::WakeOnLan::Id); - return (ep == 0xFFFF ? nullptr : gDelegateTable[ep]); + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, WakeOnLan::Id, EMBER_AF_WAKE_ON_LAN_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kWakeOnLanDelegateTableSize ? nullptr : gDelegateTable[ep]); } bool isDelegateNull(Delegate * delegate, EndpointId endpoint) @@ -73,8 +74,8 @@ namespace WakeOnLan { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::WakeOnLan::Id); - if (ep != 0xFFFF) + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, WakeOnLan::Id, EMBER_AF_WAKE_ON_LAN_CLUSTER_SERVER_ENDPOINT_COUNT); + if (ep < kWakeOnLanDelegateTableSize) { gDelegateTable[ep] = delegate; } diff --git a/src/app/clusters/window-covering-server/window-covering-server.cpp b/src/app/clusters/window-covering-server/window-covering-server.cpp index 32515eeff0e8b5..2bdd972cd634f7 100644 --- a/src/app/clusters/window-covering-server/window-covering-server.cpp +++ b/src/app/clusters/window-covering-server/window-covering-server.cpp @@ -48,14 +48,15 @@ namespace { constexpr size_t kWindowCoveringDelegateTableSize = EMBER_AF_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kWindowCoveringDelegateTableSize <= kEmberInvalidEndpointIndex, "WindowCovering Delegate table size error"); Delegate * gDelegateTable[kWindowCoveringDelegateTableSize] = { nullptr }; Delegate * GetDelegate(EndpointId endpoint) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, WindowCovering::Id); - return ((ep == kInvalidEndpointId || ep >= EMBER_AF_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT) ? nullptr - : gDelegateTable[ep]); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, WindowCovering::Id, EMBER_AF_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kWindowCoveringDelegateTableSize ? nullptr : gDelegateTable[ep]); } /* @@ -151,14 +152,13 @@ Type TypeGet(chip::EndpointId endpoint) void ConfigStatusPrint(const chip::BitMask & configStatus) { - emberAfWindowCoveringClusterPrint("ConfigStatus 0x%02X Operational=%u OnlineReserved=%u", configStatus.Raw(), - configStatus.Has(ConfigStatus::kOperational), - configStatus.Has(ConfigStatus::kOnlineReserved)); + ChipLogProgress(Zcl, "ConfigStatus 0x%02X Operational=%u OnlineReserved=%u", configStatus.Raw(), + configStatus.Has(ConfigStatus::kOperational), configStatus.Has(ConfigStatus::kOnlineReserved)); - emberAfWindowCoveringClusterPrint( - "Lift(PA=%u Encoder=%u Reversed=%u) Tilt(PA=%u Encoder=%u)", configStatus.Has(ConfigStatus::kLiftPositionAware), - configStatus.Has(ConfigStatus::kLiftEncoderControlled), configStatus.Has(ConfigStatus::kLiftMovementReversed), - configStatus.Has(ConfigStatus::kTiltPositionAware), configStatus.Has(ConfigStatus::kTiltEncoderControlled)); + ChipLogProgress(Zcl, "Lift(PA=%u Encoder=%u Reversed=%u) Tilt(PA=%u Encoder=%u)", + configStatus.Has(ConfigStatus::kLiftPositionAware), configStatus.Has(ConfigStatus::kLiftEncoderControlled), + configStatus.Has(ConfigStatus::kLiftMovementReversed), configStatus.Has(ConfigStatus::kTiltPositionAware), + configStatus.Has(ConfigStatus::kTiltEncoderControlled)); } void ConfigStatusSet(chip::EndpointId endpoint, const chip::BitMask & configStatus) @@ -192,9 +192,9 @@ void ConfigStatusUpdateFeatures(chip::EndpointId endpoint) void OperationalStatusPrint(const chip::BitMask & opStatus) { - emberAfWindowCoveringClusterPrint("OperationalStatus raw=0x%02X global=%u lift=%u tilt=%u", opStatus.Raw(), - opStatus.GetField(OperationalStatus::kGlobal), opStatus.GetField(OperationalStatus::kLift), - opStatus.GetField(OperationalStatus::kTilt)); + ChipLogProgress(Zcl, "OperationalStatus raw=0x%02X global=%u lift=%u tilt=%u", opStatus.Raw(), + opStatus.GetField(OperationalStatus::kGlobal), opStatus.GetField(OperationalStatus::kLift), + opStatus.GetField(OperationalStatus::kTilt)); } chip::BitMask OperationalStatusGet(chip::EndpointId endpoint) @@ -263,9 +263,9 @@ EndProductType EndProductTypeGet(chip::EndpointId endpoint) void ModePrint(const chip::BitMask & mode) { - emberAfWindowCoveringClusterPrint("Mode 0x%02X MotorDirReversed=%u LedFeedback=%u Maintenance=%u Calibration=%u", mode.Raw(), - mode.Has(Mode::kMotorDirectionReversed), mode.Has(Mode::kLedFeedback), - mode.Has(Mode::kMaintenanceMode), mode.Has(Mode::kCalibrationMode)); + ChipLogProgress(Zcl, "Mode 0x%02X MotorDirReversed=%u LedFeedback=%u Maintenance=%u Calibration=%u", mode.Raw(), + mode.Has(Mode::kMotorDirectionReversed), mode.Has(Mode::kLedFeedback), mode.Has(Mode::kMaintenanceMode), + mode.Has(Mode::kCalibrationMode)); } void ModeSet(chip::EndpointId endpoint, chip::BitMask & newMode) @@ -390,13 +390,13 @@ void LiftPositionSet(chip::EndpointId endpoint, NPercent100ths percent100ths) { percent.SetNull(); rawpos.SetNull(); - emberAfWindowCoveringClusterPrint("Lift[%u] Position Set to Null", endpoint); + ChipLogProgress(Zcl, "Lift[%u] Position Set to Null", endpoint); } else { percent.SetNonNull(static_cast(percent100ths.Value() / 100)); rawpos.SetNonNull(Percent100thsToLift(endpoint, percent100ths.Value())); - emberAfWindowCoveringClusterPrint("Lift[%u] Position Set: %u", endpoint, percent100ths.Value()); + ChipLogProgress(Zcl, "Lift[%u] Position Set: %u", endpoint, percent100ths.Value()); } Attributes::CurrentPositionLift::Set(endpoint, rawpos); Attributes::CurrentPositionLiftPercentage::Set(endpoint, percent); @@ -436,13 +436,13 @@ void TiltPositionSet(chip::EndpointId endpoint, NPercent100ths percent100ths) { percent.SetNull(); rawpos.SetNull(); - emberAfWindowCoveringClusterPrint("Tilt[%u] Position Set to Null", endpoint); + ChipLogProgress(Zcl, "Tilt[%u] Position Set to Null", endpoint); } else { percent.SetNonNull(static_cast(percent100ths.Value() / 100)); rawpos.SetNonNull(Percent100thsToTilt(endpoint, percent100ths.Value())); - emberAfWindowCoveringClusterPrint("Tilt[%u] Position Set: %u", endpoint, percent100ths.Value()); + ChipLogProgress(Zcl, "Tilt[%u] Position Set: %u", endpoint, percent100ths.Value()); } Attributes::CurrentPositionTilt::Set(endpoint, rawpos); Attributes::CurrentPositionTiltPercentage::Set(endpoint, percent); @@ -514,7 +514,7 @@ void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeI BitMask configStatus; NPercent100ths current, target; - emberAfWindowCoveringClusterPrint("WC POST ATTRIBUTE=%u", (unsigned int) attributeId); + ChipLogProgress(Zcl, "WC POST ATTRIBUTE=%u", (unsigned int) attributeId); OperationalState opLift = OperationalStateGet(endpoint, OperationalStatus::kLift); OperationalState opTilt = OperationalStateGet(endpoint, OperationalStatus::kTilt); @@ -527,7 +527,7 @@ void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeI Attributes::CurrentPositionLiftPercent100ths::Get(endpoint, current); if ((OperationalState::Stall != opLift) && (current == target)) { - emberAfWindowCoveringClusterPrint("Lift stop"); + ChipLogProgress(Zcl, "Lift stop"); OperationalStateSet(endpoint, OperationalStatus::kLift, OperationalState::Stall); } break; @@ -536,7 +536,7 @@ void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeI Attributes::CurrentPositionTiltPercent100ths::Get(endpoint, current); if ((OperationalState::Stall != opTilt) && (current == target)) { - emberAfWindowCoveringClusterPrint("Tilt stop"); + ChipLogProgress(Zcl, "Tilt stop"); OperationalStateSet(endpoint, OperationalStatus::kTilt, OperationalState::Stall); } break; @@ -595,16 +595,17 @@ Status GetMotionLockStatus(chip::EndpointId endpoint) void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, WindowCovering::Id); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, WindowCovering::Id, EMBER_AF_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT); - // if endpoint is found and is not a dynamic endpoint - if (ep != 0xFFFF && ep < EMBER_AF_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT) + // if endpoint is found + if (ep < kWindowCoveringDelegateTableSize) { gDelegateTable[ep] = delegate; } else { - emberAfWindowCoveringClusterPrint("Failed to set WindowCovering delegate for endpoint:%u", endpoint); + ChipLogProgress(Zcl, "Failed to set WindowCovering delegate for endpoint:%u", endpoint); } } @@ -625,12 +626,12 @@ bool emberAfWindowCoveringClusterUpOrOpenCallback(app::CommandHandler * commandO { EndpointId endpoint = commandPath.mEndpointId; - emberAfWindowCoveringClusterPrint("UpOrOpen command received"); + ChipLogProgress(Zcl, "UpOrOpen command received"); Status status = GetMotionLockStatus(endpoint); if (Status::Success != status) { - emberAfWindowCoveringClusterPrint("Err device locked"); + ChipLogProgress(Zcl, "Err device locked"); commandObj->AddStatus(commandPath, status); return true; } @@ -659,7 +660,7 @@ bool emberAfWindowCoveringClusterUpOrOpenCallback(app::CommandHandler * commandO } else { - emberAfWindowCoveringClusterPrint("WindowCovering has no delegate set for endpoint:%u", endpoint); + ChipLogProgress(Zcl, "WindowCovering has no delegate set for endpoint:%u", endpoint); } commandObj->AddStatus(commandPath, Status::Success); @@ -675,12 +676,12 @@ bool emberAfWindowCoveringClusterDownOrCloseCallback(app::CommandHandler * comma { EndpointId endpoint = commandPath.mEndpointId; - emberAfWindowCoveringClusterPrint("DownOrClose command received"); + ChipLogProgress(Zcl, "DownOrClose command received"); Status status = GetMotionLockStatus(endpoint); if (Status::Success != status) { - emberAfWindowCoveringClusterPrint("Err device locked"); + ChipLogProgress(Zcl, "Err device locked"); commandObj->AddStatus(commandPath, status); return true; } @@ -710,7 +711,7 @@ bool emberAfWindowCoveringClusterDownOrCloseCallback(app::CommandHandler * comma } else { - emberAfWindowCoveringClusterPrint("WindowCovering has no delegate set for endpoint:%u", endpoint); + ChipLogProgress(Zcl, "WindowCovering has no delegate set for endpoint:%u", endpoint); } return true; @@ -725,12 +726,12 @@ bool emberAfWindowCoveringClusterStopMotionCallback(app::CommandHandler * comman app::DataModel::Nullable current; chip::EndpointId endpoint = commandPath.mEndpointId; - emberAfWindowCoveringClusterPrint("StopMotion command received"); + ChipLogProgress(Zcl, "StopMotion command received"); Status status = GetMotionLockStatus(endpoint); if (Status::Success != status) { - emberAfWindowCoveringClusterPrint("Err device locked"); + ChipLogProgress(Zcl, "Err device locked"); commandObj->AddStatus(commandPath, status); return true; } @@ -752,7 +753,7 @@ bool emberAfWindowCoveringClusterStopMotionCallback(app::CommandHandler * comman } else { - emberAfWindowCoveringClusterPrint("WindowCovering has no delegate set for endpoint:%u", endpoint); + ChipLogProgress(Zcl, "WindowCovering has no delegate set for endpoint:%u", endpoint); } if (changeTarget) @@ -784,12 +785,12 @@ bool emberAfWindowCoveringClusterGoToLiftValueCallback(app::CommandHandler * com EndpointId endpoint = commandPath.mEndpointId; - emberAfWindowCoveringClusterPrint("GoToLiftValue %u command received", liftValue); + ChipLogProgress(Zcl, "GoToLiftValue %u command received", liftValue); Status status = GetMotionLockStatus(endpoint); if (Status::Success != status) { - emberAfWindowCoveringClusterPrint("Err device locked"); + ChipLogProgress(Zcl, "Err device locked"); commandObj->AddStatus(commandPath, status); return true; } @@ -804,13 +805,13 @@ bool emberAfWindowCoveringClusterGoToLiftValueCallback(app::CommandHandler * com } else { - emberAfWindowCoveringClusterPrint("WindowCovering has no delegate set for endpoint:%u", endpoint); + ChipLogProgress(Zcl, "WindowCovering has no delegate set for endpoint:%u", endpoint); } commandObj->AddStatus(commandPath, Status::Success); } else { - emberAfWindowCoveringClusterPrint("Err Device is not PA LF"); + ChipLogProgress(Zcl, "Err Device is not PA LF"); commandObj->AddStatus(commandPath, Status::Failure); } return true; @@ -826,12 +827,12 @@ bool emberAfWindowCoveringClusterGoToLiftPercentageCallback(app::CommandHandler Percent100ths percent100ths = commandData.liftPercent100thsValue; EndpointId endpoint = commandPath.mEndpointId; - emberAfWindowCoveringClusterPrint("GoToLiftPercentage %u command received", percent100ths); + ChipLogProgress(Zcl, "GoToLiftPercentage %u command received", percent100ths); Status status = GetMotionLockStatus(endpoint); if (Status::Success != status) { - emberAfWindowCoveringClusterPrint("Err device locked"); + ChipLogProgress(Zcl, "Err device locked"); commandObj->AddStatus(commandPath, status); return true; } @@ -848,7 +849,7 @@ bool emberAfWindowCoveringClusterGoToLiftPercentageCallback(app::CommandHandler } else { - emberAfWindowCoveringClusterPrint("WindowCovering has no delegate set for endpoint:%u", endpoint); + ChipLogProgress(Zcl, "WindowCovering has no delegate set for endpoint:%u", endpoint); } commandObj->AddStatus(commandPath, Status::Success); } @@ -859,7 +860,7 @@ bool emberAfWindowCoveringClusterGoToLiftPercentageCallback(app::CommandHandler } else { - emberAfWindowCoveringClusterPrint("Err Device is not PA LF"); + ChipLogProgress(Zcl, "Err Device is not PA LF"); commandObj->AddStatus(commandPath, Status::Failure); } return true; @@ -876,12 +877,12 @@ bool emberAfWindowCoveringClusterGoToTiltValueCallback(app::CommandHandler * com EndpointId endpoint = commandPath.mEndpointId; - emberAfWindowCoveringClusterPrint("GoToTiltValue %u command received", tiltValue); + ChipLogProgress(Zcl, "GoToTiltValue %u command received", tiltValue); Status status = GetMotionLockStatus(endpoint); if (Status::Success != status) { - emberAfWindowCoveringClusterPrint("Err device locked"); + ChipLogProgress(Zcl, "Err device locked"); commandObj->AddStatus(commandPath, status); return true; } @@ -896,13 +897,13 @@ bool emberAfWindowCoveringClusterGoToTiltValueCallback(app::CommandHandler * com } else { - emberAfWindowCoveringClusterPrint("WindowCovering has no delegate set for endpoint:%u", endpoint); + ChipLogProgress(Zcl, "WindowCovering has no delegate set for endpoint:%u", endpoint); } commandObj->AddStatus(commandPath, Status::Success); } else { - emberAfWindowCoveringClusterPrint("Err Device is not PA TL"); + ChipLogProgress(Zcl, "Err Device is not PA TL"); commandObj->AddStatus(commandPath, Status::Failure); } return true; @@ -918,12 +919,12 @@ bool emberAfWindowCoveringClusterGoToTiltPercentageCallback(app::CommandHandler Percent100ths percent100ths = commandData.tiltPercent100thsValue; EndpointId endpoint = commandPath.mEndpointId; - emberAfWindowCoveringClusterPrint("GoToTiltPercentage %u command received", percent100ths); + ChipLogProgress(Zcl, "GoToTiltPercentage %u command received", percent100ths); Status status = GetMotionLockStatus(endpoint); if (Status::Success != status) { - emberAfWindowCoveringClusterPrint("Err device locked"); + ChipLogProgress(Zcl, "Err device locked"); commandObj->AddStatus(commandPath, status); return true; } @@ -940,7 +941,7 @@ bool emberAfWindowCoveringClusterGoToTiltPercentageCallback(app::CommandHandler } else { - emberAfWindowCoveringClusterPrint("WindowCovering has no delegate set for endpoint:%u", endpoint); + ChipLogProgress(Zcl, "WindowCovering has no delegate set for endpoint:%u", endpoint); } commandObj->AddStatus(commandPath, Status::Success); } @@ -951,7 +952,7 @@ bool emberAfWindowCoveringClusterGoToTiltPercentageCallback(app::CommandHandler } else { - emberAfWindowCoveringClusterPrint("Err Device is not PA TL"); + ChipLogProgress(Zcl, "Err Device is not PA TL"); commandObj->AddStatus(commandPath, Status::Failure); } return true; diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index 909d3a8022445b..b5ccf4566a7351 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -84,6 +84,11 @@ Engine::RetrieveClusterData(const SubjectDescriptor & aSubjectDescriptor, bool a return CHIP_NO_ERROR; } +static bool IsOutOfWriterSpaceError(CHIP_ERROR err) +{ + return err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL; +} + CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Builder & aReportDataBuilder, ReadHandler * apReadHandler, bool * apHasMoreChunks, bool * apHasEncodedData) @@ -185,13 +190,17 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu "Error retrieving data from clusterId: " ChipLogFormatMEI ", err = %" CHIP_ERROR_FORMAT, ChipLogValueMEI(pathForRetrieval.mClusterId), err.Format()); - // If error is not CHIP_ERROR_BUFFER_TOO_SMALL and is not CHIP_ERROR_NO_MEMORY, rollback and encode status. + // If error is not an "out of writer space" error, rollback and encode status. // Otherwise, if partial data allowed, save the encode state. // Otherwise roll back. If we have already encoded some chunks, we are done; otherwise encode status. - if (encodeState.AllowPartialData() && ((err == CHIP_ERROR_BUFFER_TOO_SMALL) || (err == CHIP_ERROR_NO_MEMORY))) + if (encodeState.AllowPartialData() && IsOutOfWriterSpaceError(err)) { // Encoding is aborted but partial data is allowed, then we don't rollback and save the state for next chunk. + // The expectation is that RetrieveClusterData has already reset attributeReportIBs to a good state (rolled + // back any partially-written AttributeReportIB instances, reset its error status). Since AllowPartialData() + // is true, we may not have encoded a complete attribute value, but we did, if we encoded anything, encode a + // set of complete AttributeReportIB instances that represent part of the attribute value. apReadHandler->SetAttributeEncodeState(encodeState); } else @@ -201,13 +210,14 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu attributeReportIBs.Rollback(attributeBackup); apReadHandler->SetAttributeEncodeState(AttributeValueEncoder::AttributeEncodeState()); - if (err != CHIP_ERROR_NO_MEMORY && err != CHIP_ERROR_BUFFER_TOO_SMALL) + if (!IsOutOfWriterSpaceError(err)) { // Try to encode our error as a status response. err = attributeReportIBs.EncodeAttributeStatus(pathForRetrieval, StatusIB(err)); if (err != CHIP_NO_ERROR) { - // OK, just roll back again and give up. + // OK, just roll back again and give up; if we still ran out of space we + // will send this status response in the next chunk. attributeReportIBs.Rollback(attributeBackup); } } @@ -241,15 +251,9 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu // These are are guaranteed to not fail since we've already reserved memory for the remaining 'close out' TLV operations in this // function and its callers. // - if ((err == CHIP_ERROR_BUFFER_TOO_SMALL) || (err == CHIP_ERROR_NO_MEMORY)) + if (IsOutOfWriterSpaceError(err)) { ChipLogDetail(DataManagement, " We cannot put more chunks into this report. Enable chunking."); - - // - // Reset the error tracked within the builder. Otherwise, any further attempts to write - // data through the builder will be blocked by that error. - // - attributeReportIBs.ResetError(); err = CHIP_NO_ERROR; } @@ -276,7 +280,6 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu if (!attributeDataWritten && err == CHIP_NO_ERROR) { aReportDataBuilder.Rollback(backup); - aReportDataBuilder.ResetError(); } // hasMoreChunks + no data encoded is a flag that we have encountered some trouble when processing the attribute. @@ -379,7 +382,7 @@ CHIP_ERROR Engine::BuildSingleReportDataEventReports(ReportDataMessage::Builder err = CHIP_NO_ERROR; hasMoreChunks = false; } - else if ((err == CHIP_ERROR_BUFFER_TOO_SMALL) || (err == CHIP_ERROR_NO_MEMORY)) + else if (IsOutOfWriterSpaceError(err)) { // when first cluster event is too big to fit in the packet, ignore that cluster event. // However, we may have encoded some attributes before, we don't skip it in that case. @@ -423,11 +426,9 @@ CHIP_ERROR Engine::BuildSingleReportDataEventReports(ReportDataMessage::Builder } // Maybe encoding the attributes has already used up all space. - if ((err == CHIP_NO_ERROR || err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL) && - !(hasEncodedStatus || (eventCount != 0))) + if ((err == CHIP_NO_ERROR || IsOutOfWriterSpaceError(err)) && !(hasEncodedStatus || (eventCount != 0))) { aReportDataBuilder.Rollback(backup); - aReportDataBuilder.ResetError(); err = CHIP_NO_ERROR; } diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index ce355c08838a81..75a4262716f5a8 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -405,7 +405,7 @@ void Server::CheckServerReadyEvent() // are ready, and emit the 'server ready' event if so. if (mIsDnssdReady) { - ChipLogError(AppServer, "Server initialization complete"); + ChipLogProgress(AppServer, "Server initialization complete"); ChipDeviceEvent event = { .Type = DeviceEventType::kServerReady }; PlatformMgr().PostEventOrDie(&event); diff --git a/src/app/tests/TestClusterStateCache.cpp b/src/app/tests/TestClusterStateCache.cpp index 5c05959d0c452c..b6f9af88ab1a2e 100644 --- a/src/app/tests/TestClusterStateCache.cpp +++ b/src/app/tests/TestClusterStateCache.cpp @@ -19,14 +19,17 @@ #include "app-common/zap-generated/ids/Attributes.h" #include "app-common/zap-generated/ids/Clusters.h" #include "lib/core/TLVTags.h" +#include "lib/core/TLVWriter.h" #include "protocols/interaction_model/Constants.h" #include "system/SystemPacketBuffer.h" #include "system/TLVPacketBufferBackingStore.h" #include #include +#include #include #include #include +#include #include #include #include @@ -540,8 +543,75 @@ void RunAndValidateSequence(AttributeInstructionListType list) ForwardedDataCallbackValidator dataCallbackValidator; CacheValidator client(list, dataCallbackValidator); ClusterStateCache cache(client); + + // In order for the cache to track our data versions, we need to claim to it + // that we are dealing with a wildcard path. And we need to do that before + // it has seen any reports. + AttributePathParams wildcardPath; + const Span pathSpan(&wildcardPath, 1); + { + // Just need a buffer big enough that we can start the list. We don't + // care about the actual data versions here. + uint8_t buf[20]; + TLV::TLVWriter writer; + writer.Init(buf); + DataVersionFilterIBs::Builder builder; + CHIP_ERROR err = builder.Init(&writer); + NL_TEST_ASSERT(gSuite, err == CHIP_NO_ERROR); + bool encodedDataVersionList = false; + err = cache.GetBufferedCallback().OnUpdateDataVersionFilterList(builder, pathSpan, encodedDataVersionList); + + // We had nothing to encode so far. + NL_TEST_ASSERT(gSuite, err == CHIP_NO_ERROR); + NL_TEST_ASSERT(gSuite, !encodedDataVersionList); + } + DataSeriesGenerator generator(&cache.GetBufferedCallback(), list); generator.Generate(dataCallbackValidator); + + // Now verify that we would do the right thing when encoding our data + // versions. + + size_t bufferSize = 1; + do + { + Platform::ScopedMemoryBuffer buf; + if (!buf.Calloc(bufferSize)) + { + NL_TEST_ASSERT(gSuite, false); + break; + } + + TLV::TLVWriter writer; + writer.Init(buf.Get(), bufferSize); + + DataVersionFilterIBs::Builder builder; + CHIP_ERROR err = builder.Init(&writer); + NL_TEST_ASSERT(gSuite, err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL); + if (err == CHIP_NO_ERROR) + { + // We had enough space to start the list. Now try encoding the data + // version filters. + bool encodedDataVersionList = false; + err = cache.GetBufferedCallback().OnUpdateDataVersionFilterList(builder, pathSpan, encodedDataVersionList); + + // We should be rolling back properly if we run out of space. + NL_TEST_ASSERT(gSuite, err == CHIP_NO_ERROR); + NL_TEST_ASSERT(gSuite, builder.GetError() == CHIP_NO_ERROR); + + if (writer.GetRemainingFreeLength() > 40) + { + // We have lots of empty space left, so we did not end up + // needing to roll back; no point testing larger buffer sizes. + // + // Note: we may still have encodedDataVersionList false here, if + // there were no non-status attribute values cached. + break; + } + } + + ++bufferSize; + } while (true); } /* diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index a26afe936c7c8f..179a21d48923dc 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -7718,3 +7718,38 @@ PICS: # - label: "Does the DUT(server) support the SetTimeZoneResponse command?" id: TIMESYNC.S.C03.Tx + + ##################################################################################### + # Air Quality Cluster Test Plan + - label: "Does the device implement the Air Quality cluster as a server?" + id: AIRQUAL.S + + - label: "Does the device implement the Air Quality cluster as a client?" + id: AIRQUAL.C + + # + # server / attributes + # + - label: "Does the device implement the AirQuality attribute?" + id: AIRQUAL.S.A0000 + + # + # server / features + # + - label: "Does the device support the Fair feature?" + id: AIRQUAL.S.F00 + + - label: "Does the device support the Moderate feature?" + id: AIRQUAL.S.F01 + + - label: "Does the device support the VeryPoor feature?" + id: AIRQUAL.S.F02 + + - label: "Does the device support the ExtremelyPoor feature?" + id: AIRQUAL.S.F03 + + # + # server / manual + # + - label: "Changes air quality significantly" + id: AIRQUAL.M.AirQualityChange diff --git a/src/app/tests/suites/certification/Test_TC_AIRQUAL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_AIRQUAL_1_1.yaml new file mode 100644 index 00000000000000..5552e06cc47f74 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_AIRQUAL_1_1.yaml @@ -0,0 +1,125 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 164.1.1. [TC-AIRQUAL-1.1] Global Attributes with DUT as Server + +PICS: + - AIRQUAL.S + +config: + nodeId: 0x12344321 + cluster: "Air Quality" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: + "!AIRQUAL.S.F00 && !AIRQUAL.S.F01 && !AIRQUAL.S.F02 && !AIRQUAL.S.F03" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given AIRQUAL.S.F00(Fair) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: AIRQUAL.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given AIRQUAL.S.F01(Moderate) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: AIRQUAL.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given AIRQUAL.S.F02(VeryPoor) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: AIRQUAL.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4] + + - label: + "Given AIRQUAL.S.F03(ExtremelyPoor) ensure featuremap has the correct + bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: AIRQUAL.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_AIRQUAL_2_1.yaml b/src/app/tests/suites/certification/Test_TC_AIRQUAL_2_1.yaml new file mode 100644 index 00000000000000..3f5c638317bb52 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_AIRQUAL_2_1.yaml @@ -0,0 +1,42 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 3.2.1. [TC-AIRQUAL-2.1] Attributes with server as DUT + +PICS: + - AIRQUAL.S + +config: + nodeId: 0x12344321 + cluster: "Air Quality" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the AirQuality attribute." + PICS: AIRQUAL.S.A0000 + command: "readAttribute" + attribute: "AirQuality" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 6 diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index f61c7d0b99d8db..b8919a98b1c958 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2099,3 +2099,14 @@ TIMESYNC.S.C04.Rsp=1 TIMESYNC.S.C05.Rsp=1 TIMESYNC.S.C03.Tx=1 TIMESYNC.C=0 + +# Air Quality +AIRQUAL.C=0 +AIRQUAL.S=1 +AIRQUAL.S.F00=1 +AIRQUAL.S.F01=1 +AIRQUAL.S.F02=1 +AIRQUAL.S.F03=1 +AIRQUAL.S.A0000=1 +PICS_USER_PROMPT=0 +AIRQUAL.M.AirQualityChange=0 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index e2384ecbb50ab7..1d588af8f3050c 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -273,9 +273,11 @@ "Test_TC_G_2_1" ], "Scenes": ["Test_TC_S_1_1"], + "AirQuality": ["Test_TC_AIRQUAL_1_1", "Test_TC_AIRQUAL_2_1"], "collection": [ "AccessControl", "AccessControlEnforcement", + "AirQuality", "BooleanState", "BridgedDeviceBasicInformation", "Actions", diff --git a/src/app/util/af.h b/src/app/util/af.h index 465f9f86cc0c2d..76bf8b4da08855 100644 --- a/src/app/util/af.h +++ b/src/app/util/af.h @@ -35,9 +35,6 @@ #include -#include -#include - #include #include #include diff --git a/src/app/util/attribute-table.cpp b/src/app/util/attribute-table.cpp index da60ecd8f34d45..89806abba798a3 100644 --- a/src/app/util/attribute-table.cpp +++ b/src/app/util/attribute-table.cpp @@ -74,84 +74,6 @@ EmberAfStatus emberAfReadAttribute(EndpointId endpoint, ClusterId cluster, Attri return emAfReadAttribute(endpoint, cluster, attributeID, dataPtr, readLength, nullptr); } -static void emberAfAttributeDecodeAndPrintCluster(ClusterId cluster) -{ -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ATTRIBUTES) - uint16_t index = emberAfFindClusterNameIndex(cluster); - if (index != 0xFFFF) - { - emberAfAttributesPrintln("(%p)", zclClusterNames[index].name); - } - emberAfAttributesFlush(); -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ATTRIBUTES) -} - -void emberAfPrintAttributeTable() -{ - uint8_t data[ATTRIBUTE_LARGEST]; - decltype(emberAfEndpointCount()) endpointIndex; - decltype(EmberAfEndpointType::clusterCount) clusterIndex; - uint16_t attributeIndex; - EmberAfStatus status; - for (endpointIndex = 0; endpointIndex < emberAfEndpointCount(); endpointIndex++) - { - EmberAfDefinedEndpoint * ep = &(emAfEndpoints[endpointIndex]); - emberAfAttributesPrintln("ENDPOINT %x", ep->endpoint); - emberAfAttributesPrintln("clus / attr / mfg /type(len)/ rw / storage / data (raw)"); - emberAfAttributesFlush(); - for (clusterIndex = 0; clusterIndex < ep->endpointType->clusterCount; clusterIndex++) - { - const EmberAfCluster * cluster = &(ep->endpointType->cluster[clusterIndex]); - - for (attributeIndex = 0; attributeIndex < cluster->attributeCount; attributeIndex++) - { - const EmberAfAttributeMetadata * metaData = &(cluster->attributes[attributeIndex]); - - // Depending on user config, this loop can take a very long time to - // run and watchdog reset will kick in. As a workaround, we'll - // manually reset the watchdog. - // halResetWatchdog(); - - emberAfAttributesPrint(ChipLogFormatMEI " / " ChipLogFormatMEI " / ", ChipLogValueMEI(cluster->clusterId), - ChipLogValueMEI(metaData->attributeId)); - emberAfAttributesPrint("----"); - emberAfAttributesPrint( - " / %x (%x) / %p / %p / ", metaData->attributeType, emberAfAttributeSize(metaData), - (metaData->IsReadOnly() ? "RO" : "RW"), - (metaData->IsAutomaticallyPersisted() ? " nonvolatile " : (metaData->IsExternal() ? " extern " : " RAM "))); - emberAfAttributesFlush(); - status = - emAfReadAttribute(ep->endpoint, cluster->clusterId, metaData->attributeId, data, ATTRIBUTE_LARGEST, nullptr); - if (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) - { - emberAfAttributesPrintln("Unsupported"); - } - else - { - uint16_t length; - if (emberAfIsStringAttributeType(metaData->attributeType)) - { - length = static_cast(emberAfStringLength(data) + 1); - } - else if (emberAfIsLongStringAttributeType(metaData->attributeType)) - { - length = static_cast(emberAfLongStringLength(data) + 2); - } - else - { - length = emberAfAttributeSize(metaData); - } - UNUSED_VAR(length); - emberAfAttributesPrintBuffer(data, length, true); - emberAfAttributesFlush(); - emberAfAttributeDecodeAndPrintCluster(cluster->clusterId); - } - } - } - emberAfAttributesFlush(); - } -} - //------------------------------------------------------------------------------ // Internal Functions @@ -249,9 +171,8 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu // if we dont support that attribute if (metadata == nullptr) { - emberAfAttributesPrintln("%pep %x clus " ChipLogFormatMEI " attr " ChipLogFormatMEI " not supported", - "WRITE ERR: ", endpoint, ChipLogValueMEI(cluster), ChipLogValueMEI(attributeID)); - emberAfAttributesFlush(); + ChipLogProgress(Zcl, "%pep %x clus " ChipLogFormatMEI " attr " ChipLogFormatMEI " not supported", "WRITE ERR: ", endpoint, + ChipLogValueMEI(cluster), ChipLogValueMEI(attributeID)); return status; } @@ -260,15 +181,13 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu { if (dataType != metadata->attributeType) { - emberAfAttributesPrintln("%pinvalid data type", "WRITE ERR: "); - emberAfAttributesFlush(); + ChipLogProgress(Zcl, "%pinvalid data type", "WRITE ERR: "); return EMBER_ZCL_STATUS_INVALID_DATA_TYPE; } if (metadata->IsReadOnly()) { - emberAfAttributesPrintln("%pattr not writable", "WRITE ERR: "); - emberAfAttributesFlush(); + ChipLogProgress(Zcl, "%pattr not writable", "WRITE ERR: "); return EMBER_ZCL_STATUS_UNSUPPORTED_WRITE; } } @@ -375,8 +294,7 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu // bug: 11618, we are not handling properly external attributes // in this case... We need to do something. We don't really // know if it will succeed. - emberAfAttributesPrintln("WRITE: no write, just a test"); - emberAfAttributesFlush(); + ChipLogProgress(Zcl, "WRITE: no write, just a test"); } return EMBER_ZCL_STATUS_SUCCESS; @@ -409,8 +327,7 @@ EmberAfStatus emAfReadAttribute(EndpointId endpoint, ClusterId cluster, Attribut { // failed, print debug info if (status == EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED) { - emberAfAttributesPrintln("READ: attribute size too large for caller"); - emberAfAttributesFlush(); + ChipLogProgress(Zcl, "READ: attribute size too large for caller"); } } diff --git a/src/app/util/attribute-table.h b/src/app/util/attribute-table.h index 5cc2a3d9aa6ecd..bc46ddd467df05 100644 --- a/src/app/util/attribute-table.h +++ b/src/app/util/attribute-table.h @@ -25,8 +25,6 @@ EmberAfStatus emberAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * dataPtr, EmberAfAttributeType dataType); -void emberAfPrintAttributeTable(void); - EmberAfStatus emAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * data, EmberAfAttributeType dataType, bool overrideReadOnlyAndDataType, bool justTest); diff --git a/src/app/util/debug-printing-test.h b/src/app/util/debug-printing-test.h deleted file mode 100644 index da6ab7f90688c6..00000000000000 --- a/src/app/util/debug-printing-test.h +++ /dev/null @@ -1,188 +0,0 @@ -/** - * - * 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. - */ - -// This file is generated by Simplicity Studio. Please do not edit manually. -// -// - -// This is the test header, that enables all printing -// Enclosing macro to prevent multiple inclusion - -#pragma once - -#define EMBER_AF_PRINT_ENABLE -#define EMBER_AF_PRINT_BASIC_CLUSTER 0x0001 -#define EMBER_AF_PRINT_POWER_CONFIG_CLUSTER 0x0002 -#define EMBER_AF_PRINT_DEVICE_TEMP_CLUSTER 0x0004 -#define EMBER_AF_PRINT_IDENTIFY_CLUSTER 0x0008 -#define EMBER_AF_PRINT_GROUPS_CLUSTER 0x0010 -#define EMBER_AF_PRINT_SCENES_CLUSTER 0x0020 -#define EMBER_AF_PRINT_ON_OFF_CLUSTER 0x0040 -#define EMBER_AF_PRINT_ON_OFF_SWITCH_CONFIGURATION_CLUSTER 0x0080 -#define EMBER_AF_PRINT_LEVEL_CONTROL_CLUSTER 0x0101 -#define EMBER_AF_PRINT_ALARM_CLUSTER 0x0102 -#define EMBER_AF_PRINT_TIME_CLUSTER 0x0104 -#define EMBER_AF_PRINT_RSSI_LOCATION_CLUSTER 0x0108 -#define EMBER_AF_PRINT_BINARY_INPUT_BASIC_CLUSTER 0x0110 -#define EMBER_AF_PRINT_COMMISSIONING_CLUSTER 0x0120 -#define EMBER_AF_PRINT_PARTITION_CLUSTER 0x0140 -#define EMBER_AF_PRINT_OTA_BOOTLOAD_CLUSTER 0x0180 -#define EMBER_AF_PRINT_POWER_PROFILE_CLUSTER 0x0201 -#define EMBER_AF_PRINT_APPLIANCE_CONTROL_CLUSTER 0x0202 -#define EMBER_AF_PRINT_POLL_CONTROL_CLUSTER 0x0204 -#define EMBER_AF_PRINT_GREEN_POWER_CLUSTER 0x0208 -#define EMBER_AF_PRINT_KEEPALIVE_CLUSTER 0x0210 -#define EMBER_AF_PRINT_SHADE_CONFIG_CLUSTER 0x0220 -#define EMBER_AF_PRINT_DOOR_LOCK_CLUSTER 0x0240 -#define EMBER_AF_PRINT_WINDOW_COVERING_CLUSTER 0x0280 -#define EMBER_AF_PRINT_BARRIER_CONTROL_CLUSTER 0x0301 -#define EMBER_AF_PRINT_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER 0x0302 -#define EMBER_AF_PRINT_THERMOSTAT_CLUSTER 0x0304 -#define EMBER_AF_PRINT_FAN_CONTROL_CLUSTER 0x0308 -#define EMBER_AF_PRINT_DEHUMID_CONTROL_CLUSTER 0x0310 -#define EMBER_AF_PRINT_THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER 0x0320 -#define EMBER_AF_PRINT_COLOR_CONTROL_CLUSTER 0x0340 -#define EMBER_AF_PRINT_BALLAST_CONFIGURATION_CLUSTER 0x0380 -#define EMBER_AF_PRINT_ILLUM_MEASUREMENT_CLUSTER 0x0401 -#define EMBER_AF_PRINT_ILLUM_LEVEL_SENSING_CLUSTER 0x0402 -#define EMBER_AF_PRINT_TEMPERATURE_MEASUREMENT_CLUSTER 0x0404 -#define EMBER_AF_PRINT_PRESSURE_MEASUREMENT_CLUSTER 0x0408 -#define EMBER_AF_PRINT_FLOW_MEASUREMENT_CLUSTER 0x0410 -#define EMBER_AF_PRINT_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER 0x0420 -#define EMBER_AF_PRINT_OCCUPANCY_SENSING_CLUSTER 0x0440 -#define EMBER_AF_PRINT_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0480 -#define EMBER_AF_PRINT_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0501 -#define EMBER_AF_PRINT_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0502 -#define EMBER_AF_PRINT_ETHYLENE_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0504 -#define EMBER_AF_PRINT_HYDROGEN_CONCENTRATION_MEASUREMENT_CLUSTER 0x0508 -#define EMBER_AF_PRINT_HYDROGEN_SULPHIDE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0510 -#define EMBER_AF_PRINT_NITRIC_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0520 -#define EMBER_AF_PRINT_NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0540 -#define EMBER_AF_PRINT_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER 0x0580 -#define EMBER_AF_PRINT_OZONE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0601 -#define EMBER_AF_PRINT_SULFUR_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0602 -#define EMBER_AF_PRINT_DISSOLVED_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER 0x0604 -#define EMBER_AF_PRINT_BROMATE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0608 -#define EMBER_AF_PRINT_CHLORAMINES_CONCENTRATION_MEASUREMENT_CLUSTER 0x0610 -#define EMBER_AF_PRINT_CHLORINE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0620 -#define EMBER_AF_PRINT_FECAL_COLIFORM_AND_E_COLI_CONCENTRATION_MEASUREMENT_CLUSTER 0x0640 -#define EMBER_AF_PRINT_FLUORIDE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0680 -#define EMBER_AF_PRINT_HALOACETIC_ACIDS_CONCENTRATION_MEASUREMENT_CLUSTER 0x0701 -#define EMBER_AF_PRINT_TOTAL_TRIHALOMETHANES_CONCENTRATION_MEASUREMENT_CLUSTER 0x0702 -#define EMBER_AF_PRINT_TOTAL_COLIFORM_BACTERIA_CONCENTRATION_MEASUREMENT_CLUSTER 0x0704 -#define EMBER_AF_PRINT_TURBIDITY_CONCENTRATION_MEASUREMENT_CLUSTER 0x0708 -#define EMBER_AF_PRINT_COPPER_CONCENTRATION_MEASUREMENT_CLUSTER 0x0710 -#define EMBER_AF_PRINT_LEAD_CONCENTRATION_MEASUREMENT_CLUSTER 0x0720 -#define EMBER_AF_PRINT_MANGANESE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0740 -#define EMBER_AF_PRINT_SULFATE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0780 -#define EMBER_AF_PRINT_BROMODICHLOROMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0801 -#define EMBER_AF_PRINT_BROMOFORM_CONCENTRATION_MEASUREMENT_CLUSTER 0x0802 -#define EMBER_AF_PRINT_CHLORODIBROMOMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER 0x0804 -#define EMBER_AF_PRINT_CHLOROFORM_CONCENTRATION_MEASUREMENT_CLUSTER 0x0808 -#define EMBER_AF_PRINT_SODIUM_CONCENTRATION_MEASUREMENT_CLUSTER 0x0810 -#define EMBER_AF_PRINT_IAS_ZONE_CLUSTER 0x0820 -#define EMBER_AF_PRINT_IAS_ACE_CLUSTER 0x0840 -#define EMBER_AF_PRINT_IAS_WD_CLUSTER 0x0880 -#define EMBER_AF_PRINT_GENERIC_TUNNEL_CLUSTER 0x0901 -#define EMBER_AF_PRINT_BACNET_PROTOCOL_TUNNEL_CLUSTER 0x0902 -#define EMBER_AF_PRINT_11073_PROTOCOL_TUNNEL_CLUSTER 0x0904 -#define EMBER_AF_PRINT_ISO7816_PROTOCOL_TUNNEL_CLUSTER 0x0908 -#define EMBER_AF_PRINT_PRICE_CLUSTER 0x0910 -#define EMBER_AF_PRINT_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER 0x0920 -#define EMBER_AF_PRINT_SIMPLE_METERING_CLUSTER 0x0940 -#define EMBER_AF_PRINT_MESSAGING_CLUSTER 0x0980 -#define EMBER_AF_PRINT_TUNNELING_CLUSTER 0x0A01 -#define EMBER_AF_PRINT_PREPAYMENT_CLUSTER 0x0A02 -#define EMBER_AF_PRINT_ENERGY_MANAGEMENT_CLUSTER 0x0A04 -#define EMBER_AF_PRINT_CALENDAR_CLUSTER 0x0A08 -#define EMBER_AF_PRINT_DEVICE_MANAGEMENT_CLUSTER 0x0A10 -#define EMBER_AF_PRINT_EVENTS_CLUSTER 0x0A20 -#define EMBER_AF_PRINT_MDU_PAIRING_CLUSTER 0x0A40 -#define EMBER_AF_PRINT_SUB_GHZ_CLUSTER 0x0A80 -#define EMBER_AF_PRINT_KEY_ESTABLISHMENT_CLUSTER 0x0B01 -#define EMBER_AF_PRINT_INFORMATION_CLUSTER 0x0B02 -#define EMBER_AF_PRINT_DATA_SHARING_CLUSTER 0x0B04 -#define EMBER_AF_PRINT_GAMING_CLUSTER 0x0B08 -#define EMBER_AF_PRINT_DATA_RATE_CONTROL_CLUSTER 0x0B10 -#define EMBER_AF_PRINT_VOICE_OVER_ZIGBEE_CLUSTER 0x0B20 -#define EMBER_AF_PRINT_CHATTING_CLUSTER 0x0B40 -#define EMBER_AF_PRINT_PAYMENT_CLUSTER 0x0B80 -#define EMBER_AF_PRINT_BILLING_CLUSTER 0x0C01 -#define EMBER_AF_PRINT_APPLIANCE_IDENTIFICATION_CLUSTER 0x0C02 -#define EMBER_AF_PRINT_METER_IDENTIFICATION_CLUSTER 0x0C04 -#define EMBER_AF_PRINT_APPLIANCE_EVENTS_AND_ALERT_CLUSTER 0x0C08 -#define EMBER_AF_PRINT_APPLIANCE_STATISTICS_CLUSTER 0x0C10 -#define EMBER_AF_PRINT_ELECTRICAL_MEASUREMENT_CLUSTER 0x0C20 -#define EMBER_AF_PRINT_DIAGNOSTICS_CLUSTER 0x0C40 -#define EMBER_AF_PRINT_ZLL_COMMISSIONING_CLUSTER 0x0C80 -#define EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER 0x0D01 -#define EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER_2 0x0D02 -#define EMBER_AF_PRINT_OTA_CONFIGURATION_CLUSTER 0x0D04 -#define EMBER_AF_PRINT_MFGLIB_CLUSTER 0x0D08 -#define EMBER_AF_PRINT_SL_WWAH_CLUSTER 0x0D10 -#define EMBER_AF_PRINT_CORE 0x0D20 -#define EMBER_AF_PRINT_DEBUG 0x0D40 -#define EMBER_AF_PRINT_APP 0x0D80 -#define EMBER_AF_PRINT_SECURITY 0x0E01 -#define EMBER_AF_PRINT_ATTRIBUTES 0x0E02 -#define EMBER_AF_PRINT_REGISTRATION 0x0E10 -#define EMBER_AF_PRINT_ZDO 0x0E20 -#define EMBER_AF_PRINT_CUSTOM1 0x0E40 -#define EMBER_AF_PRINT_CUSTOM2 0x0E80 -#define EMBER_AF_PRINT_CUSTOM3 0x0F01 - -#define EMBER_AF_PRINT_OUTPUT 1 - -#define EMBER_AF_PRINT_NAMES \ - { \ - "Basic Information", "Power Configuration", "Device Temperature Configuration", "Identify", "Groups", "Scenes", "On/off", \ - "On/off Switch Configuration", "Level Control", "Alarms", "Time", "RSSI Location", "Binary Input (Basic)", \ - "Commissioning", "Partition", "Over the Air Bootloading", "Power Profile", "Appliance Control", "Poll Control", \ - "Green Power", "Keep-Alive", "Shade Configuration", "Door Lock", "Window Covering", "Barrier Control", \ - "Pump Configuration and Control", "Thermostat", "Fan Control", "Dehumidification Control", \ - "Thermostat User Interface Configuration", "Color Control", "Ballast Configuration", "Illuminance Measurement", \ - "Illuminance Level Sensing", "Temperature Measurement", "Pressure Measurement", "Flow Measurement", \ - "Relative Humidity Measurement", "Occupancy Sensing", "Carbon Monoxide Concentration Measurement", \ - "Carbon Dioxide Concentration Measurement", "Ethylene Concentration Measurement", \ - "Ethylene Oxide Concentration Measurement", "Hydrogen Concentration Measurement", \ - "Hydrogen Sulphide Concentration Measurement", "Nitric Oxide Concentration Measurement", \ - "Nitrogen Dioxide Concentration Measurement", "Oxygen Concentration Measurement", "Ozone Concentration Measurement", \ - "Sulfur Dioxide Concentration Measurement", "Dissolved Oxygen Concentration Measurement", \ - "Bromate Concentration Measurement", "Chloramines Concentration Measurement", "Chlorine Concentration Measurement", \ - "Fecal coliform and E. Coli Concentration Measurement", "Fluoride Concentration Measurement", \ - "Haloacetic Acids Concentration Measurement", "Total Trihalomethanes Concentration Measurement", \ - "Total Coliform Bacteria Concentration Measurement", "Turbidity Concentration Measurement", \ - "Copper Concentration Measurement", "Lead Concentration Measurement", "Manganese Concentration Measurement", \ - "Sulfate Concentration Measurement", "Bromodichloromethane Concentration Measurement", \ - "Bromoform Concentration Measurement", "Chlorodibromomethane Concentration Measurement", \ - "Chloroform Concentration Measurement", "Sodium Concentration Measurement", "IAS Zone", "IAS ACE", "IAS WD", \ - "Generic Tunnel", "BACnet Protocol Tunnel", "11073 Protocol Tunnel", "ISO 7816 Protocol Tunnel", "Price", \ - "Demand Response and Load Control", "Simple Metering", "Messaging", "Tunneling", "Prepayment", "Energy Management", \ - "Calendar", "Device Management", "Events", "MDU Pairing", "Sub-GHz", "Key Establishment", "Information", \ - "Data Sharing", "Gaming", "Data Rate Control", "Voice over ZigBee", "Chatting", "Payment", "Billing", \ - "Appliance Identification", "Meter Identification", "Appliance Events and Alert", "Appliance Statistics", \ - "Electrical Measurement", "Diagnostics", "ZLL Commissioning", "Sample Mfg Specific Cluster", \ - "Sample Mfg Specific Cluster 2", "Configuration Cluster", "MFGLIB Cluster", "SL Works With All Hubs", "Core", "Debug", \ - "Application", "Security", "Attributes", "Service discovery", "Registration", "ZDO (ZigBee Device Object)", \ - "Custom messages (1)", "Custom messages (2)", "Custom messages (3)" \ - } - -#define EMBER_AF_PRINT_NAME_NUMBER 121 -#define EMBER_AF_PRINT_BITS \ - { \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF \ - } diff --git a/src/app/util/debug-printing.h b/src/app/util/debug-printing.h deleted file mode 100644 index bea705c170bfc9..00000000000000 --- a/src/app/util/debug-printing.h +++ /dev/null @@ -1,2251 +0,0 @@ -/** - * - * 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. - */ - -// This file is generated by Simplicity Studio. Please do not edit manually. -// -// - -#pragma once - -#include "debug-printing-test.h" - -// Printing macros for cluster: Basic -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BASIC_CLUSTER) -#define emberAfBasicClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_BASIC_CLUSTER, __VA_ARGS__) -#define emberAfBasicClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_BASIC_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfBasicClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_BASIC_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfBasicClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_BASIC_CLUSTER, (buffer)) -#else -#define emberAfBasicClusterPrint(...) -#define emberAfBasicClusterPrintln(...) - -#define emberAfBasicClusterPrintBuffer(buffer, len, withSpace) -#define emberAfBasicClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BASIC_CLUSTER) - -// Printing macros for cluster: Power Configuration -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_POWER_CONFIG_CLUSTER) -#define emberAfPowerConfigClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_POWER_CONFIG_CLUSTER, __VA_ARGS__) -#define emberAfPowerConfigClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_POWER_CONFIG_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfPowerConfigClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_POWER_CONFIG_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfPowerConfigClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_POWER_CONFIG_CLUSTER, (buffer)) -#else -#define emberAfPowerConfigClusterPrint(...) -#define emberAfPowerConfigClusterPrintln(...) - -#define emberAfPowerConfigClusterPrintBuffer(buffer, len, withSpace) -#define emberAfPowerConfigClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_POWER_CONFIG_CLUSTER) - -// Printing macros for cluster: Device Temperature Configuration -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DEVICE_TEMP_CLUSTER) -#define emberAfDeviceTempClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_DEVICE_TEMP_CLUSTER, __VA_ARGS__) -#define emberAfDeviceTempClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_DEVICE_TEMP_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfDeviceTempClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_DEVICE_TEMP_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfDeviceTempClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_DEVICE_TEMP_CLUSTER, (buffer)) -#else -#define emberAfDeviceTempClusterPrint(...) -#define emberAfDeviceTempClusterPrintln(...) - -#define emberAfDeviceTempClusterPrintBuffer(buffer, len, withSpace) -#define emberAfDeviceTempClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DEVICE_TEMP_CLUSTER) - -// Printing macros for cluster: Identify -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_IDENTIFY_CLUSTER) -#define emberAfIdentifyClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_IDENTIFY_CLUSTER, __VA_ARGS__) -#define emberAfIdentifyClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_IDENTIFY_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfIdentifyClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_IDENTIFY_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfIdentifyClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_IDENTIFY_CLUSTER, (buffer)) -#else -#define emberAfIdentifyClusterPrint(...) -#define emberAfIdentifyClusterPrintln(...) - -#define emberAfIdentifyClusterPrintBuffer(buffer, len, withSpace) -#define emberAfIdentifyClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_IDENTIFY_CLUSTER) - -// Printing macros for cluster: Groups -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_GROUPS_CLUSTER) -#define emberAfGroupsClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_GROUPS_CLUSTER, __VA_ARGS__) -#define emberAfGroupsClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_GROUPS_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfGroupsClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_GROUPS_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfGroupsClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_GROUPS_CLUSTER, (buffer)) -#else -#define emberAfGroupsClusterPrint(...) -#define emberAfGroupsClusterPrintln(...) - -#define emberAfGroupsClusterPrintBuffer(buffer, len, withSpace) -#define emberAfGroupsClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_GROUPS_CLUSTER) - -// Printing macros for cluster: Scenes -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SCENES_CLUSTER) -#define emberAfScenesClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_SCENES_CLUSTER, __VA_ARGS__) -#define emberAfScenesClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_SCENES_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfScenesClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_SCENES_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfScenesClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_SCENES_CLUSTER, (buffer)) -#else -#define emberAfScenesClusterPrint(...) -#define emberAfScenesClusterPrintln(...) - -#define emberAfScenesClusterPrintBuffer(buffer, len, withSpace) -#define emberAfScenesClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SCENES_CLUSTER) - -// Printing macros for cluster: On/off -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ON_OFF_CLUSTER) -#define emberAfOnOffClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_ON_OFF_CLUSTER, __VA_ARGS__) -#define emberAfOnOffClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ON_OFF_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfOnOffClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ON_OFF_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfOnOffClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_ON_OFF_CLUSTER, (buffer)) -#else -#define emberAfOnOffClusterPrint(...) -#define emberAfOnOffClusterPrintln(...) - -#define emberAfOnOffClusterPrintBuffer(buffer, len, withSpace) -#define emberAfOnOffClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ON_OFF_CLUSTER) - -// Printing macros for cluster: On/off Switch Configuration -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ON_OFF_SWITCH_CONFIGURATION_CLUSTER) -#define emberAfOnOffSwitchConfigClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_ON_OFF_SWITCH_CONFIGURATION_CLUSTER, __VA_ARGS__) -#define emberAfOnOffSwitchConfigClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ON_OFF_SWITCH_CONFIGURATION_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfOnOffSwitchConfigClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ON_OFF_SWITCH_CONFIGURATION_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfOnOffSwitchConfigClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_ON_OFF_SWITCH_CONFIGURATION_CLUSTER, (buffer)) -#else -#define emberAfOnOffSwitchConfigClusterPrint(...) -#define emberAfOnOffSwitchConfigClusterPrintln(...) - -#define emberAfOnOffSwitchConfigClusterPrintBuffer(buffer, len, withSpace) -#define emberAfOnOffSwitchConfigClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ON_OFF_SWITCH_CONFIGURATION_CLUSTER) - -// Printing macros for cluster: Level Control -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_LEVEL_CONTROL_CLUSTER) -#define emberAfLevelControlClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_LEVEL_CONTROL_CLUSTER, __VA_ARGS__) -#define emberAfLevelControlClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_LEVEL_CONTROL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfLevelControlClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_LEVEL_CONTROL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfLevelControlClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_LEVEL_CONTROL_CLUSTER, (buffer)) -#else -#define emberAfLevelControlClusterPrint(...) -#define emberAfLevelControlClusterPrintln(...) - -#define emberAfLevelControlClusterPrintBuffer(buffer, len, withSpace) -#define emberAfLevelControlClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_LEVEL_CONTROL_CLUSTER) - -// Printing macros for cluster: Alarms -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ALARM_CLUSTER) -#define emberAfAlarmClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_ALARM_CLUSTER, __VA_ARGS__) -#define emberAfAlarmClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ALARM_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfAlarmClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ALARM_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfAlarmClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_ALARM_CLUSTER, (buffer)) -#else -#define emberAfAlarmClusterPrint(...) -#define emberAfAlarmClusterPrintln(...) - -#define emberAfAlarmClusterPrintBuffer(buffer, len, withSpace) -#define emberAfAlarmClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ALARM_CLUSTER) - -// Printing macros for cluster: Time -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TIME_CLUSTER) -#define emberAfTimeClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_TIME_CLUSTER, __VA_ARGS__) -#define emberAfTimeClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_TIME_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfTimeClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_TIME_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfTimeClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_TIME_CLUSTER, (buffer)) -#else -#define emberAfTimeClusterPrint(...) -#define emberAfTimeClusterPrintln(...) - -#define emberAfTimeClusterPrintBuffer(buffer, len, withSpace) -#define emberAfTimeClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TIME_CLUSTER) - -// Printing macros for cluster: RSSI Location -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_RSSI_LOCATION_CLUSTER) -#define emberAfRssiLocationClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_RSSI_LOCATION_CLUSTER, __VA_ARGS__) -#define emberAfRssiLocationClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_RSSI_LOCATION_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfRssiLocationClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_RSSI_LOCATION_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfRssiLocationClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_RSSI_LOCATION_CLUSTER, (buffer)) -#else -#define emberAfRssiLocationClusterPrint(...) -#define emberAfRssiLocationClusterPrintln(...) - -#define emberAfRssiLocationClusterPrintBuffer(buffer, len, withSpace) -#define emberAfRssiLocationClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_RSSI_LOCATION_CLUSTER) - -// Printing macros for cluster: Binary Input (Basic) -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BINARY_INPUT_BASIC_CLUSTER) -#define emberAfBinaryInputBasicClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_BINARY_INPUT_BASIC_CLUSTER, __VA_ARGS__) -#define emberAfBinaryInputBasicClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_BINARY_INPUT_BASIC_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfBinaryInputBasicClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_BINARY_INPUT_BASIC_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfBinaryInputBasicClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_BINARY_INPUT_BASIC_CLUSTER, (buffer)) -#else -#define emberAfBinaryInputBasicClusterPrint(...) -#define emberAfBinaryInputBasicClusterPrintln(...) - -#define emberAfBinaryInputBasicClusterPrintBuffer(buffer, len, withSpace) -#define emberAfBinaryInputBasicClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BINARY_INPUT_BASIC_CLUSTER) - -// Printing macros for cluster: Commissioning -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_COMMISSIONING_CLUSTER) -#define emberAfCommissioningClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_COMMISSIONING_CLUSTER, __VA_ARGS__) -#define emberAfCommissioningClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_COMMISSIONING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfCommissioningClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_COMMISSIONING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfCommissioningClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_COMMISSIONING_CLUSTER, (buffer)) -#else -#define emberAfCommissioningClusterPrint(...) -#define emberAfCommissioningClusterPrintln(...) - -#define emberAfCommissioningClusterPrintBuffer(buffer, len, withSpace) -#define emberAfCommissioningClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_COMMISSIONING_CLUSTER) - -// Printing macros for cluster: Partition -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PARTITION_CLUSTER) -#define emberAfPartitionClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_PARTITION_CLUSTER, __VA_ARGS__) -#define emberAfPartitionClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_PARTITION_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfPartitionClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_PARTITION_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfPartitionClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_PARTITION_CLUSTER, (buffer)) -#else -#define emberAfPartitionClusterPrint(...) -#define emberAfPartitionClusterPrintln(...) - -#define emberAfPartitionClusterPrintBuffer(buffer, len, withSpace) -#define emberAfPartitionClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PARTITION_CLUSTER) - -// Printing macros for cluster: Over the Air Bootloading -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_OTA_BOOTLOAD_CLUSTER) -#define emberAfOtaBootloadClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_OTA_BOOTLOAD_CLUSTER, __VA_ARGS__) -#define emberAfOtaBootloadClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_OTA_BOOTLOAD_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfOtaBootloadClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_OTA_BOOTLOAD_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfOtaBootloadClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_OTA_BOOTLOAD_CLUSTER, (buffer)) -#else -#define emberAfOtaBootloadClusterPrint(...) -#define emberAfOtaBootloadClusterPrintln(...) - -#define emberAfOtaBootloadClusterPrintBuffer(buffer, len, withSpace) -#define emberAfOtaBootloadClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_OTA_BOOTLOAD_CLUSTER) - -// Printing macros for cluster: Power Profile -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_POWER_PROFILE_CLUSTER) -#define emberAfPowerProfileClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_POWER_PROFILE_CLUSTER, __VA_ARGS__) -#define emberAfPowerProfileClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_POWER_PROFILE_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfPowerProfileClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_POWER_PROFILE_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfPowerProfileClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_POWER_PROFILE_CLUSTER, (buffer)) -#else -#define emberAfPowerProfileClusterPrint(...) -#define emberAfPowerProfileClusterPrintln(...) - -#define emberAfPowerProfileClusterPrintBuffer(buffer, len, withSpace) -#define emberAfPowerProfileClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_POWER_PROFILE_CLUSTER) - -// Printing macros for cluster: Appliance Control -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLIANCE_CONTROL_CLUSTER) -#define emberAfApplianceControlClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_APPLIANCE_CONTROL_CLUSTER, __VA_ARGS__) -#define emberAfApplianceControlClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_APPLIANCE_CONTROL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfApplianceControlClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_APPLIANCE_CONTROL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfApplianceControlClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_APPLIANCE_CONTROL_CLUSTER, (buffer)) -#else -#define emberAfApplianceControlClusterPrint(...) -#define emberAfApplianceControlClusterPrintln(...) - -#define emberAfApplianceControlClusterPrintBuffer(buffer, len, withSpace) -#define emberAfApplianceControlClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLIANCE_CONTROL_CLUSTER) - -// Printing macros for cluster: Poll Control -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_POLL_CONTROL_CLUSTER) -#define emberAfPollControlClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_POLL_CONTROL_CLUSTER, __VA_ARGS__) -#define emberAfPollControlClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_POLL_CONTROL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfPollControlClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_POLL_CONTROL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfPollControlClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_POLL_CONTROL_CLUSTER, (buffer)) -#else -#define emberAfPollControlClusterPrint(...) -#define emberAfPollControlClusterPrintln(...) - -#define emberAfPollControlClusterPrintBuffer(buffer, len, withSpace) -#define emberAfPollControlClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_POLL_CONTROL_CLUSTER) - -// Printing macros for cluster: Green Power -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_GREEN_POWER_CLUSTER) -#define emberAfGreenPowerClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_GREEN_POWER_CLUSTER, __VA_ARGS__) -#define emberAfGreenPowerClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_GREEN_POWER_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfGreenPowerClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_GREEN_POWER_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfGreenPowerClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_GREEN_POWER_CLUSTER, (buffer)) -#else -#define emberAfGreenPowerClusterPrint(...) -#define emberAfGreenPowerClusterPrintln(...) - -#define emberAfGreenPowerClusterPrintBuffer(buffer, len, withSpace) -#define emberAfGreenPowerClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_GREEN_POWER_CLUSTER) - -// Printing macros for cluster: Keep-Alive -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_KEEPALIVE_CLUSTER) -#define emberAfKeepaliveClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_KEEPALIVE_CLUSTER, __VA_ARGS__) -#define emberAfKeepaliveClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_KEEPALIVE_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfKeepaliveClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_KEEPALIVE_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfKeepaliveClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_KEEPALIVE_CLUSTER, (buffer)) -#else -#define emberAfKeepaliveClusterPrint(...) -#define emberAfKeepaliveClusterPrintln(...) - -#define emberAfKeepaliveClusterPrintBuffer(buffer, len, withSpace) -#define emberAfKeepaliveClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_KEEPALIVE_CLUSTER) - -// Printing macros for cluster: Shade Configuration -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SHADE_CONFIG_CLUSTER) -#define emberAfShadeConfigClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_SHADE_CONFIG_CLUSTER, __VA_ARGS__) -#define emberAfShadeConfigClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_SHADE_CONFIG_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfShadeConfigClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_SHADE_CONFIG_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfShadeConfigClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_SHADE_CONFIG_CLUSTER, (buffer)) -#else -#define emberAfShadeConfigClusterPrint(...) -#define emberAfShadeConfigClusterPrintln(...) - -#define emberAfShadeConfigClusterPrintBuffer(buffer, len, withSpace) -#define emberAfShadeConfigClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SHADE_CONFIG_CLUSTER) - -// Printing macros for cluster: Door Lock -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DOOR_LOCK_CLUSTER) -#define emberAfDoorLockClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_DOOR_LOCK_CLUSTER, __VA_ARGS__) -#define emberAfDoorLockClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_DOOR_LOCK_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfDoorLockClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_DOOR_LOCK_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfDoorLockClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_DOOR_LOCK_CLUSTER, (buffer)) -#else -#define emberAfDoorLockClusterPrint(...) -#define emberAfDoorLockClusterPrintln(...) - -#define emberAfDoorLockClusterPrintBuffer(buffer, len, withSpace) -#define emberAfDoorLockClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DOOR_LOCK_CLUSTER) - -// Printing macros for cluster: Window Covering -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_WINDOW_COVERING_CLUSTER) -#define emberAfWindowCoveringClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_WINDOW_COVERING_CLUSTER, __VA_ARGS__) -#define emberAfWindowCoveringClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_WINDOW_COVERING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfWindowCoveringClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_WINDOW_COVERING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfWindowCoveringClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_WINDOW_COVERING_CLUSTER, (buffer)) -#else -#define emberAfWindowCoveringClusterPrint(...) -#define emberAfWindowCoveringClusterPrintln(...) - -#define emberAfWindowCoveringClusterPrintBuffer(buffer, len, withSpace) -#define emberAfWindowCoveringClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_WINDOW_COVERING_CLUSTER) - -// Printing macros for cluster: Barrier Control -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BARRIER_CONTROL_CLUSTER) -#define emberAfBarrierControlClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_BARRIER_CONTROL_CLUSTER, __VA_ARGS__) -#define emberAfBarrierControlClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_BARRIER_CONTROL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfBarrierControlClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_BARRIER_CONTROL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfBarrierControlClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_BARRIER_CONTROL_CLUSTER, (buffer)) -#else -#define emberAfBarrierControlClusterPrint(...) -#define emberAfBarrierControlClusterPrintln(...) - -#define emberAfBarrierControlClusterPrintBuffer(buffer, len, withSpace) -#define emberAfBarrierControlClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BARRIER_CONTROL_CLUSTER) - -// Printing macros for cluster: Pump Configuration and Control -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER) -#define emberAfPumpConfigControlClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER, __VA_ARGS__) -#define emberAfPumpConfigControlClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfPumpConfigControlClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfPumpConfigControlClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER, (buffer)) -#else -#define emberAfPumpConfigControlClusterPrint(...) -#define emberAfPumpConfigControlClusterPrintln(...) - -#define emberAfPumpConfigControlClusterPrintBuffer(buffer, len, withSpace) -#define emberAfPumpConfigControlClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER) - -// Printing macros for cluster: Thermostat -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_THERMOSTAT_CLUSTER) -#define emberAfThermostatClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_THERMOSTAT_CLUSTER, __VA_ARGS__) -#define emberAfThermostatClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_THERMOSTAT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfThermostatClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_THERMOSTAT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfThermostatClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_THERMOSTAT_CLUSTER, (buffer)) -#else -#define emberAfThermostatClusterPrint(...) -#define emberAfThermostatClusterPrintln(...) - -#define emberAfThermostatClusterPrintBuffer(buffer, len, withSpace) -#define emberAfThermostatClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_THERMOSTAT_CLUSTER) - -// Printing macros for cluster: Fan Control -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_FAN_CONTROL_CLUSTER) -#define emberAfFanControlClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_FAN_CONTROL_CLUSTER, __VA_ARGS__) -#define emberAfFanControlClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_FAN_CONTROL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfFanControlClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_FAN_CONTROL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfFanControlClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_FAN_CONTROL_CLUSTER, (buffer)) -#else -#define emberAfFanControlClusterPrint(...) -#define emberAfFanControlClusterPrintln(...) - -#define emberAfFanControlClusterPrintBuffer(buffer, len, withSpace) -#define emberAfFanControlClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_FAN_CONTROL_CLUSTER) - -// Printing macros for cluster: Dehumidification Control -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DEHUMID_CONTROL_CLUSTER) -#define emberAfDehumidControlClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_DEHUMID_CONTROL_CLUSTER, __VA_ARGS__) -#define emberAfDehumidControlClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_DEHUMID_CONTROL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfDehumidControlClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_DEHUMID_CONTROL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfDehumidControlClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_DEHUMID_CONTROL_CLUSTER, (buffer)) -#else -#define emberAfDehumidControlClusterPrint(...) -#define emberAfDehumidControlClusterPrintln(...) - -#define emberAfDehumidControlClusterPrintBuffer(buffer, len, withSpace) -#define emberAfDehumidControlClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DEHUMID_CONTROL_CLUSTER) - -// Printing macros for cluster: Thermostat User Interface Configuration -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER) -#define emberAfThermostatUiConfigClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER, __VA_ARGS__) -#define emberAfThermostatUiConfigClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfThermostatUiConfigClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfThermostatUiConfigClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER, (buffer)) -#else -#define emberAfThermostatUiConfigClusterPrint(...) -#define emberAfThermostatUiConfigClusterPrintln(...) - -#define emberAfThermostatUiConfigClusterPrintBuffer(buffer, len, withSpace) -#define emberAfThermostatUiConfigClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER) - -// Printing macros for cluster: Color Control -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_COLOR_CONTROL_CLUSTER) -#define emberAfColorControlClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_COLOR_CONTROL_CLUSTER, __VA_ARGS__) -#define emberAfColorControlClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_COLOR_CONTROL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfColorControlClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_COLOR_CONTROL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfColorControlClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_COLOR_CONTROL_CLUSTER, (buffer)) -#else -#define emberAfColorControlClusterPrint(...) -#define emberAfColorControlClusterPrintln(...) - -#define emberAfColorControlClusterPrintBuffer(buffer, len, withSpace) -#define emberAfColorControlClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_COLOR_CONTROL_CLUSTER) - -// Printing macros for cluster: Ballast Configuration -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BALLAST_CONFIGURATION_CLUSTER) -#define emberAfBallastConfigurationClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_BALLAST_CONFIGURATION_CLUSTER, __VA_ARGS__) -#define emberAfBallastConfigurationClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_BALLAST_CONFIGURATION_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfBallastConfigurationClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_BALLAST_CONFIGURATION_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfBallastConfigurationClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_BALLAST_CONFIGURATION_CLUSTER, (buffer)) -#else -#define emberAfBallastConfigurationClusterPrint(...) -#define emberAfBallastConfigurationClusterPrintln(...) - -#define emberAfBallastConfigurationClusterPrintBuffer(buffer, len, withSpace) -#define emberAfBallastConfigurationClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BALLAST_CONFIGURATION_CLUSTER) - -// Printing macros for cluster: Illuminance Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ILLUM_MEASUREMENT_CLUSTER) -#define emberAfIllumMeasurementClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_ILLUM_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfIllumMeasurementClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ILLUM_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfIllumMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ILLUM_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfIllumMeasurementClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_ILLUM_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfIllumMeasurementClusterPrint(...) -#define emberAfIllumMeasurementClusterPrintln(...) - -#define emberAfIllumMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfIllumMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ILLUM_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Illuminance Level Sensing -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ILLUM_LEVEL_SENSING_CLUSTER) -#define emberAfIllumLevelSensingClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_ILLUM_LEVEL_SENSING_CLUSTER, __VA_ARGS__) -#define emberAfIllumLevelSensingClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ILLUM_LEVEL_SENSING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfIllumLevelSensingClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ILLUM_LEVEL_SENSING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfIllumLevelSensingClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_ILLUM_LEVEL_SENSING_CLUSTER, (buffer)) -#else -#define emberAfIllumLevelSensingClusterPrint(...) -#define emberAfIllumLevelSensingClusterPrintln(...) - -#define emberAfIllumLevelSensingClusterPrintBuffer(buffer, len, withSpace) -#define emberAfIllumLevelSensingClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ILLUM_LEVEL_SENSING_CLUSTER) - -// Printing macros for cluster: Temperature Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TEMPERATURE_MEASUREMENT_CLUSTER) -#define emberAfTempMeasurementClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_TEMPERATURE_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfTempMeasurementClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_TEMPERATURE_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfTempMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_TEMPERATURE_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfTempMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_TEMPERATURE_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfTempMeasurementClusterPrint(...) -#define emberAfTempMeasurementClusterPrintln(...) - -#define emberAfTempMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfTempMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TEMPERATURE_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Pressure Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PRESSURE_MEASUREMENT_CLUSTER) -#define emberAfPressureMeasurementClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_PRESSURE_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfPressureMeasurementClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_PRESSURE_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfPressureMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_PRESSURE_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfPressureMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_PRESSURE_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfPressureMeasurementClusterPrint(...) -#define emberAfPressureMeasurementClusterPrintln(...) - -#define emberAfPressureMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfPressureMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PRESSURE_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Flow Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_FLOW_MEASUREMENT_CLUSTER) -#define emberAfFlowMeasurementClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_FLOW_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfFlowMeasurementClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_FLOW_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfFlowMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_FLOW_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfFlowMeasurementClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_FLOW_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfFlowMeasurementClusterPrint(...) -#define emberAfFlowMeasurementClusterPrintln(...) - -#define emberAfFlowMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfFlowMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_FLOW_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Relative Humidity Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER) -#define emberAfRelativeHumidityMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfRelativeHumidityMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfRelativeHumidityMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfRelativeHumidityMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfRelativeHumidityMeasurementClusterPrint(...) -#define emberAfRelativeHumidityMeasurementClusterPrintln(...) - -#define emberAfRelativeHumidityMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfRelativeHumidityMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Occupancy Sensing -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_OCCUPANCY_SENSING_CLUSTER) -#define emberAfOccupancySensingClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_OCCUPANCY_SENSING_CLUSTER, __VA_ARGS__) -#define emberAfOccupancySensingClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_OCCUPANCY_SENSING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfOccupancySensingClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_OCCUPANCY_SENSING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfOccupancySensingClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_OCCUPANCY_SENSING_CLUSTER, (buffer)) -#else -#define emberAfOccupancySensingClusterPrint(...) -#define emberAfOccupancySensingClusterPrintln(...) - -#define emberAfOccupancySensingClusterPrintBuffer(buffer, len, withSpace) -#define emberAfOccupancySensingClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_OCCUPANCY_SENSING_CLUSTER) - -// Printing macros for cluster: Carbon Monoxide Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfCarbonMonoxideConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfCarbonMonoxideConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfCarbonMonoxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfCarbonMonoxideConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfCarbonMonoxideConcentrationMeasurementClusterPrint(...) -#define emberAfCarbonMonoxideConcentrationMeasurementClusterPrintln(...) - -#define emberAfCarbonMonoxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfCarbonMonoxideConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Carbon Dioxide Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfCarbonDioxideConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfCarbonDioxideConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfCarbonDioxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfCarbonDioxideConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfCarbonDioxideConcentrationMeasurementClusterPrint(...) -#define emberAfCarbonDioxideConcentrationMeasurementClusterPrintln(...) - -#define emberAfCarbonDioxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfCarbonDioxideConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Ethylene Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfEthyleneConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfEthyleneConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfEthyleneConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfEthyleneConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfEthyleneConcentrationMeasurementClusterPrint(...) -#define emberAfEthyleneConcentrationMeasurementClusterPrintln(...) - -#define emberAfEthyleneConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfEthyleneConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Ethylene Oxide Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ETHYLENE_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfEthyleneOxideConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_ETHYLENE_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfEthyleneOxideConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_ETHYLENE_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfEthyleneOxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ETHYLENE_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfEthyleneOxideConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_ETHYLENE_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfEthyleneOxideConcentrationMeasurementClusterPrint(...) -#define emberAfEthyleneOxideConcentrationMeasurementClusterPrintln(...) - -#define emberAfEthyleneOxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfEthyleneOxideConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ETHYLENE_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Hydrogen Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_HYDROGEN_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfHydrogenConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_HYDROGEN_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfHydrogenConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_HYDROGEN_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfHydrogenConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_HYDROGEN_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfHydrogenConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_HYDROGEN_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfHydrogenConcentrationMeasurementClusterPrint(...) -#define emberAfHydrogenConcentrationMeasurementClusterPrintln(...) - -#define emberAfHydrogenConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfHydrogenConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_HYDROGEN_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Hydrogen Sulphide Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_HYDROGEN_SULPHIDE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfHydrogenSulphideConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_HYDROGEN_SULPHIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfHydrogenSulphideConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_HYDROGEN_SULPHIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfHydrogenSulphideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_HYDROGEN_SULPHIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfHydrogenSulphideConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_HYDROGEN_SULPHIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfHydrogenSulphideConcentrationMeasurementClusterPrint(...) -#define emberAfHydrogenSulphideConcentrationMeasurementClusterPrintln(...) - -#define emberAfHydrogenSulphideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfHydrogenSulphideConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_HYDROGEN_SULPHIDE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Nitric Oxide Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_NITRIC_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfNitricOxideConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_NITRIC_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfNitricOxideConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_NITRIC_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfNitricOxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_NITRIC_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfNitricOxideConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_NITRIC_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfNitricOxideConcentrationMeasurementClusterPrint(...) -#define emberAfNitricOxideConcentrationMeasurementClusterPrintln(...) - -#define emberAfNitricOxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfNitricOxideConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_NITRIC_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Nitrogen Dioxide Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfNitrogenDioxideConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfNitrogenDioxideConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfNitrogenDioxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfNitrogenDioxideConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfNitrogenDioxideConcentrationMeasurementClusterPrint(...) -#define emberAfNitrogenDioxideConcentrationMeasurementClusterPrintln(...) - -#define emberAfNitrogenDioxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfNitrogenDioxideConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Oxygen Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfOxygenConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfOxygenConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfOxygenConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfOxygenConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfOxygenConcentrationMeasurementClusterPrint(...) -#define emberAfOxygenConcentrationMeasurementClusterPrintln(...) - -#define emberAfOxygenConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfOxygenConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Ozone Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_OZONE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfOzoneConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_OZONE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfOzoneConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_OZONE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfOzoneConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_OZONE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfOzoneConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_OZONE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfOzoneConcentrationMeasurementClusterPrint(...) -#define emberAfOzoneConcentrationMeasurementClusterPrintln(...) - -#define emberAfOzoneConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfOzoneConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_OZONE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Sulfur Dioxide Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SULFUR_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfSulfurDioxideConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_SULFUR_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfSulfurDioxideConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_SULFUR_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfSulfurDioxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_SULFUR_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfSulfurDioxideConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_SULFUR_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfSulfurDioxideConcentrationMeasurementClusterPrint(...) -#define emberAfSulfurDioxideConcentrationMeasurementClusterPrintln(...) - -#define emberAfSulfurDioxideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfSulfurDioxideConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SULFUR_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Dissolved Oxygen Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DISSOLVED_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfDissolvedOxygenConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_DISSOLVED_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfDissolvedOxygenConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_DISSOLVED_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfDissolvedOxygenConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_DISSOLVED_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfDissolvedOxygenConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_DISSOLVED_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfDissolvedOxygenConcentrationMeasurementClusterPrint(...) -#define emberAfDissolvedOxygenConcentrationMeasurementClusterPrintln(...) - -#define emberAfDissolvedOxygenConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfDissolvedOxygenConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DISSOLVED_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Bromate Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BROMATE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfBromateConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_BROMATE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfBromateConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_BROMATE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfBromateConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_BROMATE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfBromateConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_BROMATE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfBromateConcentrationMeasurementClusterPrint(...) -#define emberAfBromateConcentrationMeasurementClusterPrintln(...) - -#define emberAfBromateConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfBromateConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BROMATE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Chloramines Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CHLORAMINES_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfChloraminesConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_CHLORAMINES_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfChloraminesConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_CHLORAMINES_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfChloraminesConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_CHLORAMINES_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfChloraminesConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_CHLORAMINES_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfChloraminesConcentrationMeasurementClusterPrint(...) -#define emberAfChloraminesConcentrationMeasurementClusterPrintln(...) - -#define emberAfChloraminesConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfChloraminesConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CHLORAMINES_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Chlorine Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CHLORINE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfChlorineConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_CHLORINE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfChlorineConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_CHLORINE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfChlorineConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_CHLORINE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfChlorineConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_CHLORINE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfChlorineConcentrationMeasurementClusterPrint(...) -#define emberAfChlorineConcentrationMeasurementClusterPrintln(...) - -#define emberAfChlorineConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfChlorineConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CHLORINE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Fecal coliform and E. Coli Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_FECAL_COLIFORM_AND_E_COLI_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfFecalColiformAndEColiConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_FECAL_COLIFORM_AND_E_COLI_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfFecalColiformAndEColiConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_FECAL_COLIFORM_AND_E_COLI_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfFecalColiformAndEColiConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_FECAL_COLIFORM_AND_E_COLI_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfFecalColiformAndEColiConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_FECAL_COLIFORM_AND_E_COLI_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfFecalColiformAndEColiConcentrationMeasurementClusterPrint(...) -#define emberAfFecalColiformAndEColiConcentrationMeasurementClusterPrintln(...) - -#define emberAfFecalColiformAndEColiConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfFecalColiformAndEColiConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_FECAL_COLIFORM_AND_E_COLI_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Fluoride Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_FLUORIDE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfFluorideConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_FLUORIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfFluorideConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_FLUORIDE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfFluorideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_FLUORIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfFluorideConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_FLUORIDE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfFluorideConcentrationMeasurementClusterPrint(...) -#define emberAfFluorideConcentrationMeasurementClusterPrintln(...) - -#define emberAfFluorideConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfFluorideConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_FLUORIDE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Haloacetic Acids Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_HALOACETIC_ACIDS_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfHaloaceticAcidsConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_HALOACETIC_ACIDS_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfHaloaceticAcidsConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_HALOACETIC_ACIDS_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfHaloaceticAcidsConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_HALOACETIC_ACIDS_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfHaloaceticAcidsConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_HALOACETIC_ACIDS_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfHaloaceticAcidsConcentrationMeasurementClusterPrint(...) -#define emberAfHaloaceticAcidsConcentrationMeasurementClusterPrintln(...) - -#define emberAfHaloaceticAcidsConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfHaloaceticAcidsConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_HALOACETIC_ACIDS_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Total Trihalomethanes Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TOTAL_TRIHALOMETHANES_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfTotalTrihalomethanesConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_TOTAL_TRIHALOMETHANES_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfTotalTrihalomethanesConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_TOTAL_TRIHALOMETHANES_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfTotalTrihalomethanesConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_TOTAL_TRIHALOMETHANES_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfTotalTrihalomethanesConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_TOTAL_TRIHALOMETHANES_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfTotalTrihalomethanesConcentrationMeasurementClusterPrint(...) -#define emberAfTotalTrihalomethanesConcentrationMeasurementClusterPrintln(...) - -#define emberAfTotalTrihalomethanesConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfTotalTrihalomethanesConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TOTAL_TRIHALOMETHANES_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Total Coliform Bacteria Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TOTAL_COLIFORM_BACTERIA_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfTotalColiformBacteriaConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_TOTAL_COLIFORM_BACTERIA_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfTotalColiformBacteriaConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_TOTAL_COLIFORM_BACTERIA_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfTotalColiformBacteriaConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_TOTAL_COLIFORM_BACTERIA_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfTotalColiformBacteriaConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_TOTAL_COLIFORM_BACTERIA_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfTotalColiformBacteriaConcentrationMeasurementClusterPrint(...) -#define emberAfTotalColiformBacteriaConcentrationMeasurementClusterPrintln(...) - -#define emberAfTotalColiformBacteriaConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfTotalColiformBacteriaConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TOTAL_COLIFORM_BACTERIA_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Turbidity Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TURBIDITY_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfTurbidityConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_TURBIDITY_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfTurbidityConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_TURBIDITY_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfTurbidityConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_TURBIDITY_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfTurbidityConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_TURBIDITY_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfTurbidityConcentrationMeasurementClusterPrint(...) -#define emberAfTurbidityConcentrationMeasurementClusterPrintln(...) - -#define emberAfTurbidityConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfTurbidityConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TURBIDITY_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Copper Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_COPPER_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfCopperConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_COPPER_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfCopperConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_COPPER_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfCopperConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_COPPER_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfCopperConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_COPPER_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfCopperConcentrationMeasurementClusterPrint(...) -#define emberAfCopperConcentrationMeasurementClusterPrintln(...) - -#define emberAfCopperConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfCopperConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_COPPER_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Lead Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_LEAD_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfLeadConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_LEAD_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfLeadConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_LEAD_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfLeadConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_LEAD_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfLeadConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_LEAD_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfLeadConcentrationMeasurementClusterPrint(...) -#define emberAfLeadConcentrationMeasurementClusterPrintln(...) - -#define emberAfLeadConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfLeadConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_LEAD_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Manganese Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_MANGANESE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfManganeseConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_MANGANESE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfManganeseConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_MANGANESE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfManganeseConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_MANGANESE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfManganeseConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_MANGANESE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfManganeseConcentrationMeasurementClusterPrint(...) -#define emberAfManganeseConcentrationMeasurementClusterPrintln(...) - -#define emberAfManganeseConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfManganeseConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_MANGANESE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Sulfate Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SULFATE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfSulfateConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_SULFATE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfSulfateConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_SULFATE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfSulfateConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_SULFATE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfSulfateConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_SULFATE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfSulfateConcentrationMeasurementClusterPrint(...) -#define emberAfSulfateConcentrationMeasurementClusterPrintln(...) - -#define emberAfSulfateConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfSulfateConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SULFATE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Bromodichloromethane Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BROMODICHLOROMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfBromodichloromethaneConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_BROMODICHLOROMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfBromodichloromethaneConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_BROMODICHLOROMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfBromodichloromethaneConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_BROMODICHLOROMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfBromodichloromethaneConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_BROMODICHLOROMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfBromodichloromethaneConcentrationMeasurementClusterPrint(...) -#define emberAfBromodichloromethaneConcentrationMeasurementClusterPrintln(...) - -#define emberAfBromodichloromethaneConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfBromodichloromethaneConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BROMODICHLOROMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Bromoform Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BROMOFORM_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfBromoformConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_BROMOFORM_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfBromoformConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_BROMOFORM_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfBromoformConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_BROMOFORM_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfBromoformConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_BROMOFORM_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfBromoformConcentrationMeasurementClusterPrint(...) -#define emberAfBromoformConcentrationMeasurementClusterPrintln(...) - -#define emberAfBromoformConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfBromoformConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BROMOFORM_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Chlorodibromomethane Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CHLORODIBROMOMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfChlorodibromomethaneConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_CHLORODIBROMOMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfChlorodibromomethaneConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_CHLORODIBROMOMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfChlorodibromomethaneConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_CHLORODIBROMOMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfChlorodibromomethaneConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_CHLORODIBROMOMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfChlorodibromomethaneConcentrationMeasurementClusterPrint(...) -#define emberAfChlorodibromomethaneConcentrationMeasurementClusterPrintln(...) - -#define emberAfChlorodibromomethaneConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfChlorodibromomethaneConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CHLORODIBROMOMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Chloroform Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CHLOROFORM_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfChloroformConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_CHLOROFORM_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfChloroformConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_CHLOROFORM_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfChloroformConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_CHLOROFORM_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfChloroformConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_CHLOROFORM_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfChloroformConcentrationMeasurementClusterPrint(...) -#define emberAfChloroformConcentrationMeasurementClusterPrintln(...) - -#define emberAfChloroformConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfChloroformConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CHLOROFORM_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Sodium Concentration Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SODIUM_CONCENTRATION_MEASUREMENT_CLUSTER) -#define emberAfSodiumConcentrationMeasurementClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_SODIUM_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfSodiumConcentrationMeasurementClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_SODIUM_CONCENTRATION_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfSodiumConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_SODIUM_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfSodiumConcentrationMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_SODIUM_CONCENTRATION_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfSodiumConcentrationMeasurementClusterPrint(...) -#define emberAfSodiumConcentrationMeasurementClusterPrintln(...) - -#define emberAfSodiumConcentrationMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfSodiumConcentrationMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SODIUM_CONCENTRATION_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Generic Tunnel -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_GENERIC_TUNNEL_CLUSTER) -#define emberAfGenericTunnelClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_GENERIC_TUNNEL_CLUSTER, __VA_ARGS__) -#define emberAfGenericTunnelClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_GENERIC_TUNNEL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfGenericTunnelClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_GENERIC_TUNNEL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfGenericTunnelClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_GENERIC_TUNNEL_CLUSTER, (buffer)) -#else -#define emberAfGenericTunnelClusterPrint(...) -#define emberAfGenericTunnelClusterPrintln(...) - -#define emberAfGenericTunnelClusterPrintBuffer(buffer, len, withSpace) -#define emberAfGenericTunnelClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_GENERIC_TUNNEL_CLUSTER) - -// Printing macros for cluster: BACnet Protocol Tunnel -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BACNET_PROTOCOL_TUNNEL_CLUSTER) -#define emberAfBacnetProtocolTunnelClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_BACNET_PROTOCOL_TUNNEL_CLUSTER, __VA_ARGS__) -#define emberAfBacnetProtocolTunnelClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_BACNET_PROTOCOL_TUNNEL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfBacnetProtocolTunnelClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_BACNET_PROTOCOL_TUNNEL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfBacnetProtocolTunnelClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_BACNET_PROTOCOL_TUNNEL_CLUSTER, (buffer)) -#else -#define emberAfBacnetProtocolTunnelClusterPrint(...) -#define emberAfBacnetProtocolTunnelClusterPrintln(...) - -#define emberAfBacnetProtocolTunnelClusterPrintBuffer(buffer, len, withSpace) -#define emberAfBacnetProtocolTunnelClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BACNET_PROTOCOL_TUNNEL_CLUSTER) - -// Printing macros for cluster: 11073 Protocol Tunnel -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_11073_PROTOCOL_TUNNEL_CLUSTER) -#define emberAf11073ProtocolTunnelClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_11073_PROTOCOL_TUNNEL_CLUSTER, __VA_ARGS__) -#define emberAf11073ProtocolTunnelClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_11073_PROTOCOL_TUNNEL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAf11073ProtocolTunnelClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_11073_PROTOCOL_TUNNEL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAf11073ProtocolTunnelClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_11073_PROTOCOL_TUNNEL_CLUSTER, (buffer)) -#else -#define emberAf11073ProtocolTunnelClusterPrint(...) -#define emberAf11073ProtocolTunnelClusterPrintln(...) - -#define emberAf11073ProtocolTunnelClusterPrintBuffer(buffer, len, withSpace) -#define emberAf11073ProtocolTunnelClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_11073_PROTOCOL_TUNNEL_CLUSTER) - -// Printing macros for cluster: ISO 7816 Protocol Tunnel -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ISO7816_PROTOCOL_TUNNEL_CLUSTER) -#define emberAfIso7816ProtocolTunnelClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_ISO7816_PROTOCOL_TUNNEL_CLUSTER, __VA_ARGS__) -#define emberAfIso7816ProtocolTunnelClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ISO7816_PROTOCOL_TUNNEL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfIso7816ProtocolTunnelClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ISO7816_PROTOCOL_TUNNEL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfIso7816ProtocolTunnelClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_ISO7816_PROTOCOL_TUNNEL_CLUSTER, (buffer)) -#else -#define emberAfIso7816ProtocolTunnelClusterPrint(...) -#define emberAfIso7816ProtocolTunnelClusterPrintln(...) - -#define emberAfIso7816ProtocolTunnelClusterPrintBuffer(buffer, len, withSpace) -#define emberAfIso7816ProtocolTunnelClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ISO7816_PROTOCOL_TUNNEL_CLUSTER) - -// Printing macros for cluster: Price -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PRICE_CLUSTER) -#define emberAfPriceClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_PRICE_CLUSTER, __VA_ARGS__) -#define emberAfPriceClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_PRICE_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfPriceClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_PRICE_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfPriceClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_PRICE_CLUSTER, (buffer)) -#else -#define emberAfPriceClusterPrint(...) -#define emberAfPriceClusterPrintln(...) - -#define emberAfPriceClusterPrintBuffer(buffer, len, withSpace) -#define emberAfPriceClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PRICE_CLUSTER) - -// Printing macros for cluster: Demand Response and Load Control -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER) -#define emberAfDemandResponseLoadControlClusterPrint(...) \ - emberAfPrint(EMBER_AF_PRINT_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER, __VA_ARGS__) -#define emberAfDemandResponseLoadControlClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfDemandResponseLoadControlClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfDemandResponseLoadControlClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER, (buffer)) -#else -#define emberAfDemandResponseLoadControlClusterPrint(...) -#define emberAfDemandResponseLoadControlClusterPrintln(...) - -#define emberAfDemandResponseLoadControlClusterPrintBuffer(buffer, len, withSpace) -#define emberAfDemandResponseLoadControlClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER) - -// Printing macros for cluster: Simple Metering -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SIMPLE_METERING_CLUSTER) -#define emberAfSimpleMeteringClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_SIMPLE_METERING_CLUSTER, __VA_ARGS__) -#define emberAfSimpleMeteringClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_SIMPLE_METERING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfSimpleMeteringClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_SIMPLE_METERING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfSimpleMeteringClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_SIMPLE_METERING_CLUSTER, (buffer)) -#else -#define emberAfSimpleMeteringClusterPrint(...) -#define emberAfSimpleMeteringClusterPrintln(...) - -#define emberAfSimpleMeteringClusterPrintBuffer(buffer, len, withSpace) -#define emberAfSimpleMeteringClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SIMPLE_METERING_CLUSTER) - -// Printing macros for cluster: Messaging -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_MESSAGING_CLUSTER) -#define emberAfMessagingClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_MESSAGING_CLUSTER, __VA_ARGS__) -#define emberAfMessagingClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_MESSAGING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfMessagingClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_MESSAGING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfMessagingClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_MESSAGING_CLUSTER, (buffer)) -#else -#define emberAfMessagingClusterPrint(...) -#define emberAfMessagingClusterPrintln(...) - -#define emberAfMessagingClusterPrintBuffer(buffer, len, withSpace) -#define emberAfMessagingClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_MESSAGING_CLUSTER) - -// Printing macros for cluster: Tunneling -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TUNNELING_CLUSTER) -#define emberAfTunnelingClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_TUNNELING_CLUSTER, __VA_ARGS__) -#define emberAfTunnelingClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_TUNNELING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfTunnelingClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_TUNNELING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfTunnelingClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_TUNNELING_CLUSTER, (buffer)) -#else -#define emberAfTunnelingClusterPrint(...) -#define emberAfTunnelingClusterPrintln(...) - -#define emberAfTunnelingClusterPrintBuffer(buffer, len, withSpace) -#define emberAfTunnelingClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TUNNELING_CLUSTER) - -// Printing macros for cluster: Prepayment -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PREPAYMENT_CLUSTER) -#define emberAfPrepaymentClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_PREPAYMENT_CLUSTER, __VA_ARGS__) -#define emberAfPrepaymentClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_PREPAYMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfPrepaymentClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_PREPAYMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfPrepaymentClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_PREPAYMENT_CLUSTER, (buffer)) -#else -#define emberAfPrepaymentClusterPrint(...) -#define emberAfPrepaymentClusterPrintln(...) - -#define emberAfPrepaymentClusterPrintBuffer(buffer, len, withSpace) -#define emberAfPrepaymentClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PREPAYMENT_CLUSTER) - -// Printing macros for cluster: Energy Management -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ENERGY_MANAGEMENT_CLUSTER) -#define emberAfEnergyManagementClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_ENERGY_MANAGEMENT_CLUSTER, __VA_ARGS__) -#define emberAfEnergyManagementClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ENERGY_MANAGEMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfEnergyManagementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ENERGY_MANAGEMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfEnergyManagementClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_ENERGY_MANAGEMENT_CLUSTER, (buffer)) -#else -#define emberAfEnergyManagementClusterPrint(...) -#define emberAfEnergyManagementClusterPrintln(...) - -#define emberAfEnergyManagementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfEnergyManagementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ENERGY_MANAGEMENT_CLUSTER) - -// Printing macros for cluster: Calendar -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CALENDAR_CLUSTER) -#define emberAfCalendarClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_CALENDAR_CLUSTER, __VA_ARGS__) -#define emberAfCalendarClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_CALENDAR_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfCalendarClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_CALENDAR_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfCalendarClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_CALENDAR_CLUSTER, (buffer)) -#else -#define emberAfCalendarClusterPrint(...) -#define emberAfCalendarClusterPrintln(...) - -#define emberAfCalendarClusterPrintBuffer(buffer, len, withSpace) -#define emberAfCalendarClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CALENDAR_CLUSTER) - -// Printing macros for cluster: Device Management -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DEVICE_MANAGEMENT_CLUSTER) -#define emberAfDeviceManagementClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_DEVICE_MANAGEMENT_CLUSTER, __VA_ARGS__) -#define emberAfDeviceManagementClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_DEVICE_MANAGEMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfDeviceManagementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_DEVICE_MANAGEMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfDeviceManagementClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_DEVICE_MANAGEMENT_CLUSTER, (buffer)) -#else -#define emberAfDeviceManagementClusterPrint(...) -#define emberAfDeviceManagementClusterPrintln(...) - -#define emberAfDeviceManagementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfDeviceManagementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DEVICE_MANAGEMENT_CLUSTER) - -// Printing macros for cluster: Events -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_EVENTS_CLUSTER) -#define emberAfEventsClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_EVENTS_CLUSTER, __VA_ARGS__) -#define emberAfEventsClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_EVENTS_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfEventsClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_EVENTS_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfEventsClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_EVENTS_CLUSTER, (buffer)) -#else -#define emberAfEventsClusterPrint(...) -#define emberAfEventsClusterPrintln(...) - -#define emberAfEventsClusterPrintBuffer(buffer, len, withSpace) -#define emberAfEventsClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_EVENTS_CLUSTER) - -// Printing macros for cluster: MDU Pairing -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_MDU_PAIRING_CLUSTER) -#define emberAfMduPairingClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_MDU_PAIRING_CLUSTER, __VA_ARGS__) -#define emberAfMduPairingClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_MDU_PAIRING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfMduPairingClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_MDU_PAIRING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfMduPairingClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_MDU_PAIRING_CLUSTER, (buffer)) -#else -#define emberAfMduPairingClusterPrint(...) -#define emberAfMduPairingClusterPrintln(...) - -#define emberAfMduPairingClusterPrintBuffer(buffer, len, withSpace) -#define emberAfMduPairingClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_MDU_PAIRING_CLUSTER) - -// Printing macros for cluster: Sub-GHz -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SUB_GHZ_CLUSTER) -#define emberAfSubGhzClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_SUB_GHZ_CLUSTER, __VA_ARGS__) -#define emberAfSubGhzClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_SUB_GHZ_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfSubGhzClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_SUB_GHZ_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfSubGhzClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_SUB_GHZ_CLUSTER, (buffer)) -#else -#define emberAfSubGhzClusterPrint(...) -#define emberAfSubGhzClusterPrintln(...) - -#define emberAfSubGhzClusterPrintBuffer(buffer, len, withSpace) -#define emberAfSubGhzClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SUB_GHZ_CLUSTER) - -// Printing macros for cluster: Key Establishment -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_KEY_ESTABLISHMENT_CLUSTER) -#define emberAfKeyEstablishmentClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_KEY_ESTABLISHMENT_CLUSTER, __VA_ARGS__) -#define emberAfKeyEstablishmentClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_KEY_ESTABLISHMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfKeyEstablishmentClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_KEY_ESTABLISHMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfKeyEstablishmentClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_KEY_ESTABLISHMENT_CLUSTER, (buffer)) -#else -#define emberAfKeyEstablishmentClusterPrint(...) -#define emberAfKeyEstablishmentClusterPrintln(...) - -#define emberAfKeyEstablishmentClusterPrintBuffer(buffer, len, withSpace) -#define emberAfKeyEstablishmentClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_KEY_ESTABLISHMENT_CLUSTER) - -// Printing macros for cluster: Information -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_INFORMATION_CLUSTER) -#define emberAfInformationClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_INFORMATION_CLUSTER, __VA_ARGS__) -#define emberAfInformationClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_INFORMATION_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfInformationClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_INFORMATION_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfInformationClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_INFORMATION_CLUSTER, (buffer)) -#else -#define emberAfInformationClusterPrint(...) -#define emberAfInformationClusterPrintln(...) - -#define emberAfInformationClusterPrintBuffer(buffer, len, withSpace) -#define emberAfInformationClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_INFORMATION_CLUSTER) - -// Printing macros for cluster: Data Sharing -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DATA_SHARING_CLUSTER) -#define emberAfDataSharingClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_DATA_SHARING_CLUSTER, __VA_ARGS__) -#define emberAfDataSharingClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_DATA_SHARING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfDataSharingClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_DATA_SHARING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfDataSharingClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_DATA_SHARING_CLUSTER, (buffer)) -#else -#define emberAfDataSharingClusterPrint(...) -#define emberAfDataSharingClusterPrintln(...) - -#define emberAfDataSharingClusterPrintBuffer(buffer, len, withSpace) -#define emberAfDataSharingClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DATA_SHARING_CLUSTER) - -// Printing macros for cluster: Gaming -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_GAMING_CLUSTER) -#define emberAfGamingClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_GAMING_CLUSTER, __VA_ARGS__) -#define emberAfGamingClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_GAMING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfGamingClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_GAMING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfGamingClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_GAMING_CLUSTER, (buffer)) -#else -#define emberAfGamingClusterPrint(...) -#define emberAfGamingClusterPrintln(...) - -#define emberAfGamingClusterPrintBuffer(buffer, len, withSpace) -#define emberAfGamingClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_GAMING_CLUSTER) - -// Printing macros for cluster: Data Rate Control -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DATA_RATE_CONTROL_CLUSTER) -#define emberAfDataRateControlClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_DATA_RATE_CONTROL_CLUSTER, __VA_ARGS__) -#define emberAfDataRateControlClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_DATA_RATE_CONTROL_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfDataRateControlClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_DATA_RATE_CONTROL_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfDataRateControlClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_DATA_RATE_CONTROL_CLUSTER, (buffer)) -#else -#define emberAfDataRateControlClusterPrint(...) -#define emberAfDataRateControlClusterPrintln(...) - -#define emberAfDataRateControlClusterPrintBuffer(buffer, len, withSpace) -#define emberAfDataRateControlClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DATA_RATE_CONTROL_CLUSTER) - -// Printing macros for cluster: Voice over ZigBee -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_VOICE_OVER_ZIGBEE_CLUSTER) -#define emberAfVoiceOverZigbeeClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_VOICE_OVER_ZIGBEE_CLUSTER, __VA_ARGS__) -#define emberAfVoiceOverZigbeeClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_VOICE_OVER_ZIGBEE_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfVoiceOverZigbeeClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_VOICE_OVER_ZIGBEE_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfVoiceOverZigbeeClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_VOICE_OVER_ZIGBEE_CLUSTER, (buffer)) -#else -#define emberAfVoiceOverZigbeeClusterPrint(...) -#define emberAfVoiceOverZigbeeClusterPrintln(...) - -#define emberAfVoiceOverZigbeeClusterPrintBuffer(buffer, len, withSpace) -#define emberAfVoiceOverZigbeeClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_VOICE_OVER_ZIGBEE_CLUSTER) - -// Printing macros for cluster: Chatting -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CHATTING_CLUSTER) -#define emberAfChattingClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_CHATTING_CLUSTER, __VA_ARGS__) -#define emberAfChattingClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_CHATTING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfChattingClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_CHATTING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfChattingClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_CHATTING_CLUSTER, (buffer)) -#else -#define emberAfChattingClusterPrint(...) -#define emberAfChattingClusterPrintln(...) - -#define emberAfChattingClusterPrintBuffer(buffer, len, withSpace) -#define emberAfChattingClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CHATTING_CLUSTER) - -// Printing macros for cluster: Payment -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PAYMENT_CLUSTER) -#define emberAfPaymentClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_PAYMENT_CLUSTER, __VA_ARGS__) -#define emberAfPaymentClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_PAYMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfPaymentClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_PAYMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfPaymentClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_PAYMENT_CLUSTER, (buffer)) -#else -#define emberAfPaymentClusterPrint(...) -#define emberAfPaymentClusterPrintln(...) - -#define emberAfPaymentClusterPrintBuffer(buffer, len, withSpace) -#define emberAfPaymentClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_PAYMENT_CLUSTER) - -// Printing macros for cluster: Billing -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BILLING_CLUSTER) -#define emberAfBillingClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_BILLING_CLUSTER, __VA_ARGS__) -#define emberAfBillingClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_BILLING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfBillingClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_BILLING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfBillingClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_BILLING_CLUSTER, (buffer)) -#else -#define emberAfBillingClusterPrint(...) -#define emberAfBillingClusterPrintln(...) - -#define emberAfBillingClusterPrintBuffer(buffer, len, withSpace) -#define emberAfBillingClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_BILLING_CLUSTER) - -// Printing macros for cluster: Appliance Identification -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLIANCE_IDENTIFICATION_CLUSTER) -#define emberAfApplianceIdentificationClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_APPLIANCE_IDENTIFICATION_CLUSTER, __VA_ARGS__) -#define emberAfApplianceIdentificationClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_APPLIANCE_IDENTIFICATION_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfApplianceIdentificationClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_APPLIANCE_IDENTIFICATION_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfApplianceIdentificationClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_APPLIANCE_IDENTIFICATION_CLUSTER, (buffer)) -#else -#define emberAfApplianceIdentificationClusterPrint(...) -#define emberAfApplianceIdentificationClusterPrintln(...) - -#define emberAfApplianceIdentificationClusterPrintBuffer(buffer, len, withSpace) -#define emberAfApplianceIdentificationClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLIANCE_IDENTIFICATION_CLUSTER) - -// Printing macros for cluster: Meter Identification -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_METER_IDENTIFICATION_CLUSTER) -#define emberAfMeterIdentificationClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_METER_IDENTIFICATION_CLUSTER, __VA_ARGS__) -#define emberAfMeterIdentificationClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_METER_IDENTIFICATION_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfMeterIdentificationClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_METER_IDENTIFICATION_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfMeterIdentificationClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_METER_IDENTIFICATION_CLUSTER, (buffer)) -#else -#define emberAfMeterIdentificationClusterPrint(...) -#define emberAfMeterIdentificationClusterPrintln(...) - -#define emberAfMeterIdentificationClusterPrintBuffer(buffer, len, withSpace) -#define emberAfMeterIdentificationClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_METER_IDENTIFICATION_CLUSTER) - -// Printing macros for cluster: Appliance Events and Alert -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLIANCE_EVENTS_AND_ALERT_CLUSTER) -#define emberAfApplianceEventsAndAlertClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_APPLIANCE_EVENTS_AND_ALERT_CLUSTER, __VA_ARGS__) -#define emberAfApplianceEventsAndAlertClusterPrintln(...) \ - emberAfPrintln(EMBER_AF_PRINT_APPLIANCE_EVENTS_AND_ALERT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfApplianceEventsAndAlertClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_APPLIANCE_EVENTS_AND_ALERT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfApplianceEventsAndAlertClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_APPLIANCE_EVENTS_AND_ALERT_CLUSTER, (buffer)) -#else -#define emberAfApplianceEventsAndAlertClusterPrint(...) -#define emberAfApplianceEventsAndAlertClusterPrintln(...) - -#define emberAfApplianceEventsAndAlertClusterPrintBuffer(buffer, len, withSpace) -#define emberAfApplianceEventsAndAlertClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLIANCE_EVENTS_AND_ALERT_CLUSTER) - -// Printing macros for cluster: Appliance Statistics -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLIANCE_STATISTICS_CLUSTER) -#define emberAfApplianceStatisticsClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_APPLIANCE_STATISTICS_CLUSTER, __VA_ARGS__) -#define emberAfApplianceStatisticsClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_APPLIANCE_STATISTICS_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfApplianceStatisticsClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_APPLIANCE_STATISTICS_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfApplianceStatisticsClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_APPLIANCE_STATISTICS_CLUSTER, (buffer)) -#else -#define emberAfApplianceStatisticsClusterPrint(...) -#define emberAfApplianceStatisticsClusterPrintln(...) - -#define emberAfApplianceStatisticsClusterPrintBuffer(buffer, len, withSpace) -#define emberAfApplianceStatisticsClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLIANCE_STATISTICS_CLUSTER) - -// Printing macros for cluster: Electrical Measurement -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ELECTRICAL_MEASUREMENT_CLUSTER) -#define emberAfElectricalMeasurementClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_ELECTRICAL_MEASUREMENT_CLUSTER, __VA_ARGS__) -#define emberAfElectricalMeasurementClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ELECTRICAL_MEASUREMENT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfElectricalMeasurementClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ELECTRICAL_MEASUREMENT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfElectricalMeasurementClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_ELECTRICAL_MEASUREMENT_CLUSTER, (buffer)) -#else -#define emberAfElectricalMeasurementClusterPrint(...) -#define emberAfElectricalMeasurementClusterPrintln(...) - -#define emberAfElectricalMeasurementClusterPrintBuffer(buffer, len, withSpace) -#define emberAfElectricalMeasurementClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ELECTRICAL_MEASUREMENT_CLUSTER) - -// Printing macros for cluster: Diagnostics -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DIAGNOSTICS_CLUSTER) -#define emberAfDiagnosticsClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_DIAGNOSTICS_CLUSTER, __VA_ARGS__) -#define emberAfDiagnosticsClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_DIAGNOSTICS_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfDiagnosticsClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_DIAGNOSTICS_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfDiagnosticsClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_DIAGNOSTICS_CLUSTER, (buffer)) -#else -#define emberAfDiagnosticsClusterPrint(...) -#define emberAfDiagnosticsClusterPrintln(...) - -#define emberAfDiagnosticsClusterPrintBuffer(buffer, len, withSpace) -#define emberAfDiagnosticsClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DIAGNOSTICS_CLUSTER) - -// Printing macros for cluster: Application Basic -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLICATION_BASIC_CLUSTER) -#define emberAfApplicationBasicClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_APPLICATION_BASIC_CLUSTER, __VA_ARGS__) -#define emberAfApplicationBasicClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_APPLICATION_BASIC_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfApplicationBasicClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_APPLICATION_BASIC_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfApplicationBasicClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_APPLICATION_BASIC_CLUSTER, (buffer)) -#else -#define emberAfApplicationBasicClusterPrint(...) -#define emberAfApplicationBasicClusterPrintln(...) - -#define emberAfApplicationBasicClusterPrintBuffer(buffer, len, withSpace) -#define emberAfApplicationBasicClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLICATION_BASIC_CLUSTER) - -// Printing macros for cluster: ZLL Commissioning -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ZLL_COMMISSIONING_CLUSTER) -#define emberAfZllCommissioningClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_ZLL_COMMISSIONING_CLUSTER, __VA_ARGS__) -#define emberAfZllCommissioningClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ZLL_COMMISSIONING_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfZllCommissioningClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ZLL_COMMISSIONING_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfZllCommissioningClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_ZLL_COMMISSIONING_CLUSTER, (buffer)) -#else -#define emberAfZllCommissioningClusterPrint(...) -#define emberAfZllCommissioningClusterPrintln(...) - -#define emberAfZllCommissioningClusterPrintBuffer(buffer, len, withSpace) -#define emberAfZllCommissioningClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ZLL_COMMISSIONING_CLUSTER) - -// Printing macros for cluster: Sample Mfg Specific Cluster -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER) -#define emberAfSampleMfgSpecificClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER, __VA_ARGS__) -#define emberAfSampleMfgSpecificClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfSampleMfgSpecificClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfSampleMfgSpecificClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER, (buffer)) -#else -#define emberAfSampleMfgSpecificClusterPrint(...) -#define emberAfSampleMfgSpecificClusterPrintln(...) - -#define emberAfSampleMfgSpecificClusterPrintBuffer(buffer, len, withSpace) -#define emberAfSampleMfgSpecificClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER) - -// Printing macros for cluster: Sample Mfg Specific Cluster 2 -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER_2) -#define emberAfSampleMfgSpecificCluster2Print(...) emberAfPrint(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER_2, __VA_ARGS__) -#define emberAfSampleMfgSpecificCluster2Println(...) emberAfPrintln(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER_2, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfSampleMfgSpecificCluster2PrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER_2, (buffer), (len), (withSpace)) -#define emberAfSampleMfgSpecificCluster2PrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER_2, (buffer)) -#else -#define emberAfSampleMfgSpecificCluster2Print(...) -#define emberAfSampleMfgSpecificCluster2Println(...) - -#define emberAfSampleMfgSpecificCluster2PrintBuffer(buffer, len, withSpace) -#define emberAfSampleMfgSpecificCluster2PrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SAMPLE_MFG_SPECIFIC_CLUSTER_2) - -// Printing macros for cluster: Configuration Cluster -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_OTA_CONFIGURATION_CLUSTER) -#define emberAfOtaConfigurationClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_OTA_CONFIGURATION_CLUSTER, __VA_ARGS__) -#define emberAfOtaConfigurationClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_OTA_CONFIGURATION_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfOtaConfigurationClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_OTA_CONFIGURATION_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfOtaConfigurationClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_OTA_CONFIGURATION_CLUSTER, (buffer)) -#else -#define emberAfOtaConfigurationClusterPrint(...) -#define emberAfOtaConfigurationClusterPrintln(...) - -#define emberAfOtaConfigurationClusterPrintBuffer(buffer, len, withSpace) -#define emberAfOtaConfigurationClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_OTA_CONFIGURATION_CLUSTER) - -// Printing macros for cluster: MFGLIB Cluster -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_MFGLIB_CLUSTER) -#define emberAfMfglibClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_MFGLIB_CLUSTER, __VA_ARGS__) -#define emberAfMfglibClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_MFGLIB_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfMfglibClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_MFGLIB_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfMfglibClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_MFGLIB_CLUSTER, (buffer)) -#else -#define emberAfMfglibClusterPrint(...) -#define emberAfMfglibClusterPrintln(...) - -#define emberAfMfglibClusterPrintBuffer(buffer, len, withSpace) -#define emberAfMfglibClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_MFGLIB_CLUSTER) - -// Printing macros for cluster: SL Works With All Hubs -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SL_WWAH_CLUSTER) -#define emberAfSlWwahClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_SL_WWAH_CLUSTER, __VA_ARGS__) -#define emberAfSlWwahClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_SL_WWAH_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfSlWwahClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_SL_WWAH_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfSlWwahClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_SL_WWAH_CLUSTER, (buffer)) -#else -#define emberAfSlWwahClusterPrint(...) -#define emberAfSlWwahClusterPrintln(...) - -#define emberAfSlWwahClusterPrintBuffer(buffer, len, withSpace) -#define emberAfSlWwahClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_SL_WWAH_CLUSTER) - -// Printing macros for Core -// Prints messages for global flow of the receive/send -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CORE) -#define emberAfCorePrint(...) emberAfPrint(EMBER_AF_PRINT_CORE, __VA_ARGS__) -#define emberAfCorePrintln(...) emberAfPrintln(EMBER_AF_PRINT_CORE, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. -#define emberAfCoreFlush() -#define emberAfCorePrintBuffer(buffer, len, withSpace) emberAfPrintBuffer(EMBER_AF_PRINT_CORE, (buffer), (len), (withSpace)) -#define emberAfCorePrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_CORE, (buffer)) -#else -#define emberAfCorePrint(...) -#define emberAfCorePrintln(...) -#define emberAfCoreFlush() -#define emberAfCorePrintBuffer(buffer, len, withSpace) -#define emberAfCorePrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CORE) - -// Printing macros for Debug -// Prints messages for random debugging -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DEBUG) -#define emberAfDebugPrint(...) emberAfPrint(EMBER_AF_PRINT_DEBUG, __VA_ARGS__) -#define emberAfDebugPrintln(...) emberAfPrintln(EMBER_AF_PRINT_DEBUG, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. -#define emberAfDebugFlush() -#define emberAfDebugPrintBuffer(buffer, len, withSpace) emberAfPrintBuffer(EMBER_AF_PRINT_DEBUG, (buffer), (len), (withSpace)) -#define emberAfDebugPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_DEBUG, (buffer)) -#else -#define emberAfDebugPrint(...) -#define emberAfDebugPrintln(...) -#define emberAfDebugFlush() -#define emberAfDebugPrintBuffer(buffer, len, withSpace) -#define emberAfDebugPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_DEBUG) - -// Printing macros for Application -// Prints messages for application part -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APP) -#define emberAfAppPrint(...) emberAfPrint(EMBER_AF_PRINT_APP, __VA_ARGS__) -#define emberAfAppPrintln(...) emberAfPrintln(EMBER_AF_PRINT_APP, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. -#define emberAfAppFlush() -#define emberAfAppPrintBuffer(buffer, len, withSpace) emberAfPrintBuffer(EMBER_AF_PRINT_APP, (buffer), (len), (withSpace)) -#define emberAfAppPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_APP, (buffer)) -#else -#define emberAfAppPrint(...) -#define emberAfAppPrintln(...) -#define emberAfAppFlush() -#define emberAfAppPrintBuffer(buffer, len, withSpace) -#define emberAfAppPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APP) - -// Printing macros for Attributes -// Prints messages related to attributes -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ATTRIBUTES) -#define emberAfAttributesPrint(...) emberAfPrint(EMBER_AF_PRINT_ATTRIBUTES, __VA_ARGS__) -#define emberAfAttributesPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ATTRIBUTES, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. -#define emberAfAttributesFlush() -#define emberAfAttributesPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ATTRIBUTES, (buffer), (len), (withSpace)) -#define emberAfAttributesPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_ATTRIBUTES, (buffer)) -#else -#define emberAfAttributesPrint(...) -#define emberAfAttributesPrintln(...) -#define emberAfAttributesFlush() -#define emberAfAttributesPrintBuffer(buffer, len, withSpace) -#define emberAfAttributesPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ATTRIBUTES) - -// Printing macros for Registration -// Prints messages related to registration -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_REGISTRATION) -#define emberAfRegistrationPrint(...) emberAfPrint(EMBER_AF_PRINT_REGISTRATION, __VA_ARGS__) -#define emberAfRegistrationPrintln(...) emberAfPrintln(EMBER_AF_PRINT_REGISTRATION, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. -#define emberAfRegistrationFlush() -#define emberAfRegistrationPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_REGISTRATION, (buffer), (len), (withSpace)) -#define emberAfRegistrationPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_REGISTRATION, (buffer)) -#else -#define emberAfRegistrationPrint(...) -#define emberAfRegistrationPrintln(...) -#define emberAfRegistrationFlush() -#define emberAfRegistrationPrintBuffer(buffer, len, withSpace) -#define emberAfRegistrationPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_REGISTRATION) - -// Printing macros for ZDO (ZigBee Device Object) -// Prints messages related to ZDO functionality -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ZDO) -#define emberAfZdoPrint(...) emberAfPrint(EMBER_AF_PRINT_ZDO, __VA_ARGS__) -#define emberAfZdoPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ZDO, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. -#define emberAfZdoFlush() -#define emberAfZdoPrintBuffer(buffer, len, withSpace) emberAfPrintBuffer(EMBER_AF_PRINT_ZDO, (buffer), (len), (withSpace)) -#define emberAfZdoPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_ZDO, (buffer)) -#else -#define emberAfZdoPrint(...) -#define emberAfZdoPrintln(...) -#define emberAfZdoFlush() -#define emberAfZdoPrintBuffer(buffer, len, withSpace) -#define emberAfZdoPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ZDO) - -// Printing macros for Custom messages (1) -// Messages that can be used by the end developer -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CUSTOM1) -#define emberAfCustom1Print(...) emberAfPrint(EMBER_AF_PRINT_CUSTOM1, __VA_ARGS__) -#define emberAfCustom1Println(...) emberAfPrintln(EMBER_AF_PRINT_CUSTOM1, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. -#define emberAfCustom1Flush() -#define emberAfCustom1PrintBuffer(buffer, len, withSpace) emberAfPrintBuffer(EMBER_AF_PRINT_CUSTOM1, (buffer), (len), (withSpace)) -#define emberAfCustom1PrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_CUSTOM1, (buffer)) -#else -#define emberAfCustom1Print(...) -#define emberAfCustom1Println(...) -#define emberAfCustom1Flush() -#define emberAfCustom1PrintBuffer(buffer, len, withSpace) -#define emberAfCustom1PrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CUSTOM1) - -// Printing macros for Custom messages (2) -// Messages that can be used by the end developer -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CUSTOM2) -#define emberAfCustom2Print(...) emberAfPrint(EMBER_AF_PRINT_CUSTOM2, __VA_ARGS__) -#define emberAfCustom2Println(...) emberAfPrintln(EMBER_AF_PRINT_CUSTOM2, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. -#define emberAfCustom2Flush() -#define emberAfCustom2PrintBuffer(buffer, len, withSpace) emberAfPrintBuffer(EMBER_AF_PRINT_CUSTOM2, (buffer), (len), (withSpace)) -#define emberAfCustom2PrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_CUSTOM2, (buffer)) -#else -#define emberAfCustom2Print(...) -#define emberAfCustom2Println(...) -#define emberAfCustom2Flush() -#define emberAfCustom2PrintBuffer(buffer, len, withSpace) -#define emberAfCustom2PrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CUSTOM2) - -// Printing macros for cluster: Account Login -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ACCOUNT_LOGIN_CLUSTER) -#define emberAfAccountLoginClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_ACCOUNT_LOGIN_CLUSTER, __VA_ARGS__) -#define emberAfAccountLoginClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_ACCOUNT_LOGIN_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfAccountLoginClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_ACCOUNT_LOGIN_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfAccountLoginClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_ACCOUNT_LOGIN_CLUSTER, (buffer)) -#else -#define emberAfAccountLoginClusterPrint(...) -#define emberAfAccountLoginClusterPrintln(...) - -#define emberAfAccountLoginClusterPrintBuffer(buffer, len, withSpace) -#define emberAfAccountLoginClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ACCOUNT_LOGIN_CLUSTER) - -// Printing macros for cluster: Media Playback -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_MEDIA_PLAYBACK_CLUSTER) -#define emberAfMediaPlaybackClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_MEDIA_PLAYBACK_CLUSTER, __VA_ARGS__) -#define emberAfMediaPlaybackClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_MEDIA_PLAYBACK_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfMediaPlaybackClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_MEDIA_PLAYBACK_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfMediaPlaybackClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_MEDIA_PLAYBACK_CLUSTER, (buffer)) -#else -#define emberAfMediaPlaybackClusterPrint(...) -#define emberAfMediaPlaybackClusterPrintln(...) - -#define emberAfMediaPlaybackClusterPrintBuffer(buffer, len, withSpace) -#define emberAfMediaPlaybackClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_MEDIA_PLAYBACK_CLUSTER) - -// Printing macros for Custom messages (3) -// Messages that can be used by the end developer -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CUSTOM3) -#define emberAfCustom3Print(...) emberAfPrint(EMBER_AF_PRINT_CUSTOM3, __VA_ARGS__) -#define emberAfCustom3Println(...) emberAfPrintln(EMBER_AF_PRINT_CUSTOM3, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. -#define emberAfCustom3Flush() -#define emberAfCustom3PrintBuffer(buffer, len, withSpace) emberAfPrintBuffer(EMBER_AF_PRINT_CUSTOM3, (buffer), (len), (withSpace)) -#define emberAfCustom3PrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_CUSTOM3, (buffer)) -#else -#define emberAfCustom3Print(...) -#define emberAfCustom3Println(...) -#define emberAfCustom3Flush() -#define emberAfCustom3PrintBuffer(buffer, len, withSpace) -#define emberAfCustom3PrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CUSTOM3) - -// Printing macros for cluster: Application Launcher -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLICATION_LAUNCHER_CLUSTER) -#define emberAfApplicationLauncherClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_APPLICATION_LAUNCHER_CLUSTER, __VA_ARGS__) -#define emberAfApplicationLauncherClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_APPLICATION_LAUNCHER_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfApplicationLauncherClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_APPLICATION_LAUNCHER_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfApplicationLauncherClusterPrintString(buffer) \ - emberAfPrintString(EMBER_AF_PRINT_APPLICATION_LAUNCHER_CLUSTER, (buffer)) -#else -#define emberAfApplicationLauncherClusterPrint(...) -#define emberAfApplicationLauncherClusterPrintln(...) - -#define emberAfApplicationLauncherClusterPrintBuffer(buffer, len, withSpace) -#define emberAfApplicationLauncherClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_APPLICATION_LAUNCHER_CLUSTER) - -// Printing macros for cluster: Audio Output -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_AUDIO_OUTPUT_CLUSTER) -#define emberAfAudioOutputClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_AUDIO_OUTPUT_CLUSTER, __VA_ARGS__) -#define emberAfAudioOutputClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_AUDIO_OUTPUT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfAudioOutputClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_AUDIO_OUTPUT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfAudioOutputClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_AUDIO_OUTPUT_CLUSTER, (buffer)) -#else -#define emberAfAudioOutputClusterPrint(...) -#define emberAfAudioOutputClusterPrintln(...) - -#define emberAfAudioOutputClusterPrintBuffer(buffer, len, withSpace) -#define emberAfAudioOutputClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_AUDIO_OUTPUT_CLUSTER) - -// Printing macros for cluster: Keypad Input -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_KEYPAD_INPUT_CLUSTER) -#define emberAfKeypadInputClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_KEYPAD_INPUT_CLUSTER, __VA_ARGS__) -#define emberAfKeypadInputClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_KEYPAD_INPUT_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfKeypadInputClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_KEYPAD_INPUT_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfKeypadInputClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_KEYPAD_INPUT_CLUSTER, (buffer)) -#else -#define emberAfKeypadInputClusterPrint(...) -#define emberAfKeypadInputClusterPrintln(...) - -#define emberAfKeypadInputClusterPrintBuffer(buffer, len, withSpace) -#define emberAfKeypadInputClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_KEYPAD_INPUT_CLUSTER) - -// Printing macros for cluster: Content Launcher -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CONTENT_LAUNCHER_CLUSTER) -#define emberAfContentLauncherClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_CONTENT_LAUNCHER_CLUSTER, __VA_ARGS__) -#define emberAfContentLauncherClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_CONTENT_LAUNCHER_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfContentLauncherClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_CONTENT_LAUNCHER_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfContentLauncherClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_CONTENT_LAUNCHER_CLUSTER, (buffer)) -#else -#define emberAfContentLauncherClusterPrint(...) -#define emberAfContentLauncherClusterPrintln(...) - -#define emberAfContentLauncherClusterPrintBuffer(buffer, len, withSpace) -#define emberAfContentLauncherClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_CONTENT_LAUNCHER_CLUSTER) - -// Printing macros for cluster: Target Navigator -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TARGET_NAVIGATOR_CLUSTER) -#define emberAfTargetNavigatorClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_TARGET_NAVIGATOR_CLUSTER, __VA_ARGS__) -#define emberAfTargetNavigatorClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_TARGET_NAVIGATOR_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfTargetNavigatorClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_TARGET_NAVIGATOR_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfTargetNavigatorClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_TARGET_NAVIGATOR_CLUSTER, (buffer)) -#else -#define emberAfTargetNavigatorClusterPrint(...) -#define emberAfTargetNavigatorClusterPrintln(...) - -#define emberAfTargetNavigatorClusterPrintBuffer(buffer, len, withSpace) -#define emberAfTargetNavigatorClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_TARGET_NAVIGATOR_CLUSTER) - -// Printing macros for cluster: Wake on LAN -#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_WAKE_ON_LAN_CLUSTER) -#define emberAfWakeOnLanClusterPrint(...) emberAfPrint(EMBER_AF_PRINT_WAKE_ON_LAN_CLUSTER, __VA_ARGS__) -#define emberAfWakeOnLanClusterPrintln(...) emberAfPrintln(EMBER_AF_PRINT_WAKE_ON_LAN_CLUSTER, __VA_ARGS__) -// Blocking IO is enabled for all serial ports, therefore flush calls are unnecessary. - -#define emberAfWakeOnLanClusterPrintBuffer(buffer, len, withSpace) \ - emberAfPrintBuffer(EMBER_AF_PRINT_WAKE_ON_LAN_CLUSTER, (buffer), (len), (withSpace)) -#define emberAfWakeOnLanClusterPrintString(buffer) emberAfPrintString(EMBER_AF_PRINT_WAKE_ON_LAN_CLUSTER, (buffer)) -#else -#define emberAfWakeOnLanClusterPrint(...) -#define emberAfWakeOnLanClusterPrintln(...) - -#define emberAfWakeOnLanClusterPrintBuffer(buffer, len, withSpace) -#define emberAfWakeOnLanClusterPrintString(buffer) -#endif // defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_WAKE_ON_LAN_CLUSTER) diff --git a/src/app/util/ember-print.cpp b/src/app/util/ember-print.cpp deleted file mode 100644 index 9f863b42fa3716..00000000000000 --- a/src/app/util/ember-print.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/** - * - * Copyright (c) 2020-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. - */ -#include -#include -#include - -#include -#include - -#include -#include -#include - -bool emberAfPrintReceivedMessages = true; - -using namespace chip::Logging; - -#if CHIP_PROGRESS_LOGGING - -void emberAfPrint(int category, const char * format, ...) -{ - if (format != nullptr) - { - va_list args; - va_start(args, format); - chip::Logging::LogV(chip::Logging::kLogModule_Zcl, chip::Logging::kLogCategory_Progress, format, args); - va_end(args); - } -} - -#if !CHIP_PW_TOKENIZER_LOGGING -void emberAfPrintln(int category, const char * format, ...) -{ - if (format != nullptr) - { - va_list args; - va_start(args, format); - chip::Logging::LogV(chip::Logging::kLogModule_Zcl, chip::Logging::kLogCategory_Progress, format, args); - va_end(args); - } -} -#endif - -// TODO: add unit tests. - -void emberAfPrintBuffer(int category, const uint8_t * buffer, uint16_t length, bool withSpace) -{ - if (buffer != nullptr && length > 0) - { - constexpr uint16_t kBufferSize = CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE; - const char * perByteFormatStr = withSpace ? "%02X " : "%02X"; - const uint8_t perByteCharCount = withSpace ? 3 : 2; - const uint16_t bytesPerBuffer = static_cast((kBufferSize - 1) / perByteCharCount); - char result[kBufferSize]; - - uint16_t index = 0; - while (index < length) - { - const uint16_t remainingBytes = static_cast(length - index); - const uint16_t segmentLength = chip::min(bytesPerBuffer, remainingBytes); - const uint16_t segmentEnd = static_cast(index + segmentLength); - const uint32_t outStringEnd = segmentLength * perByteCharCount; - for (uint32_t dst_idx = 0; dst_idx < outStringEnd && index < segmentEnd; dst_idx += perByteCharCount, index++) - { - // The perByteFormatStr is in fact a literal (one of two), but - // the compiler does not realize that. We could branch on - // perByteFormatStr and have separate snprintf calls, but this - // seems like it might lead to smaller code. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wformat-nonliteral" - snprintf(result + dst_idx, outStringEnd - dst_idx + 1, perByteFormatStr, buffer[index]); -#pragma GCC diagnostic pop - } - result[outStringEnd] = 0; - emberAfPrint(category, "%s", result); - } - } - else - { - emberAfPrint(EMBER_AF_PRINT_CORE, "NULL"); - } -} - -void emberAfPrintString(int category, const uint8_t * string) -{ - emberAfPrint(category, "%.*s", emberAfStringLength(string), string + 1); -} - -#endif // CHIP_PROGRESS_LOGGING diff --git a/src/app/util/ember-print.h b/src/app/util/ember-print.h deleted file mode 100644 index a456adbf15d3a4..00000000000000 --- a/src/app/util/ember-print.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * - * 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. - */ - -#pragma once - -#include -#include - -#include -#include - -/** - * @brief Prints a log message - * @param category - Currently ignored as zcl categories do not map to chip categories. Defaults to kLogCategory_Progress - * @param format - Format string to print - */ -#if CHIP_PROGRESS_LOGGING -void emberAfPrint(int category, const char * format, ...) ENFORCE_FORMAT(2, 3); -#else -#define emberAfPrint(...) ((void) 0) -#endif - -/** - * @brief Prints a log followed by new line line - * @param category - Currently ignored as zcl categories do not map to chip categories. Defaults to kLogCategory_Progress - * @param format - Format string to print - */ -#if CHIP_PW_TOKENIZER_LOGGING -#define emberAfPrintln(MOD, MSG, ...) ChipLogProgress(Zcl, MSG, __VA_ARGS__); -#elif CHIP_PROGRESS_LOGGING -void emberAfPrintln(int category, const char * format, ...) ENFORCE_FORMAT(2, 3); -#else -#define emberAfPrintln(...) ((void) 0) -#endif - -/** - * @brief Prints a buffer - * @param category - Currently ignored as zcl categories do not map to chip categories. Defaults to kLogCategory_Progress. - * @param buffer - Buffer to print. - * @param length - Length of buffer - * @param withSpace - Pass in true if a space should be printed between each byte. - */ -#if CHIP_PROGRESS_LOGGING -void emberAfPrintBuffer(int category, const uint8_t * buffer, uint16_t length, bool withSpace); -#else -#define emberAfPrintBuffer(...) ((void) 0) -#endif - -/** - * @brief Prints a strings - * @param category - Currently ignored as zcl categories do not map to chip categories. Defaults to kLogCategory_Progress. - * @param string - Buffer to print as a string - */ -#if CHIP_PROGRESS_LOGGING -void emberAfPrintString(int category, const uint8_t * string); -#else -#define emberAfPrintString(...) ((void) 0) -#endif diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml index fbc8b1f5d80857..d0f256128e19a4 100644 --- a/src/app/zap-templates/zcl/data-model/all.xml +++ b/src/app/zap-templates/zcl/data-model/all.xml @@ -56,7 +56,7 @@ - + diff --git a/src/app/zap-templates/zcl/data-model/chip/replacable-monitoring-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.xml similarity index 100% rename from src/app/zap-templates/zcl/data-model/chip/replacable-monitoring-cluster.xml rename to src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.xml diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 9aa99576b33208..24a435d846fade 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -75,7 +75,7 @@ "pwm-cluster.xml", "refrigerator-alarm.xml", "relative-humidity-measurement-cluster.xml", - "replacable-monitoring-cluster.xml", + "resource-monitoring-cluster.xml", "scene.xml", "smoke-co-alarm-cluster.xml", "software-diagnostics-cluster.xml", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index cdee396cb50811..dfe2ebd70e9471 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -73,7 +73,7 @@ "pwm-cluster.xml", "refrigerator-alarm.xml", "relative-humidity-measurement-cluster.xml", - "replacable-monitoring-cluster.xml", + "resource-monitoring-cluster.xml", "scene.xml", "smoke-co-alarm-cluster.xml", "software-diagnostics-cluster.xml", diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index 3beb2afb26e68a..054f59db9ed36c 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -265,10 +265,15 @@ kotlin_library("onboarding_payload") { } sources = [ + "src/chip/onboardingpayload/CommissioningFlow.kt", "src/chip/onboardingpayload/DiscoveryCapability.kt", + "src/chip/onboardingpayload/ManualOnboardingPayloadGenerator.kt", + "src/chip/onboardingpayload/ManualOnboardingPayloadParser.kt", "src/chip/onboardingpayload/OnboardingPayload.kt", "src/chip/onboardingpayload/OnboardingPayloadParser.kt", "src/chip/onboardingpayload/OptionalQRCodeInfo.kt", + "src/chip/onboardingpayload/Verhoeff.kt", + "src/chip/onboardingpayload/Verhoeff10.kt", ] } diff --git a/src/controller/java/OnboardingPayloadParser-JNI.cpp b/src/controller/java/OnboardingPayloadParser-JNI.cpp index c07e4b2a7060c5..cea62189fd0850 100644 --- a/src/controller/java/OnboardingPayloadParser-JNI.cpp +++ b/src/controller/java/OnboardingPayloadParser-JNI.cpp @@ -1,7 +1,5 @@ #include "lib/core/CHIPError.h" #include "lib/support/JniTypeWrappers.h" -#include -#include #include #include @@ -31,7 +29,6 @@ static jobject CreateCapabilitiesHashSet(JNIEnv * env, RendezvousInformationFlag static void TransformSetupPayloadFromJobject(JNIEnv * env, jobject jPayload, SetupPayload & payload); static void CreateCapabilitiesFromHashSet(JNIEnv * env, jobject discoveryCapabilitiesObj, RendezvousInformationFlags & flags); static CHIP_ERROR ThrowUnrecognizedQRCodeException(JNIEnv * env, jstring qrCodeObj); -static CHIP_ERROR ThrowInvalidManualPairingCodeFormatException(JNIEnv * env, jstring manualPairingCodeObj); jint JNI_OnLoad(JavaVM * jvm, void * reserved) { @@ -71,39 +68,6 @@ JNI_METHOD(jobject, fetchPayloadFromQrCode)(JNIEnv * env, jobject self, jstring return TransformSetupPayload(env, payload); } -JNI_METHOD(jobject, parsePayloadFromManualPairingCode) -(JNIEnv * env, jobject self, jstring manualPairingCode, jboolean skipPayloadValidation) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - const char * manualPairingCodeString = NULL; - SetupPayload payload; - - manualPairingCodeString = env->GetStringUTFChars(manualPairingCode, 0); - - err = ManualSetupPayloadParser(manualPairingCodeString).populatePayload(payload); - env->ReleaseStringUTFChars(manualPairingCode, manualPairingCodeString); - - if (skipPayloadValidation == JNI_FALSE && !payload.isValidManualCode()) - { - jclass exceptionCls = env->FindClass("chip/setuppayload/SetupPayloadParser$SetupPayloadException"); - JniReferences::GetInstance().ThrowError(env, exceptionCls, CHIP_ERROR_INVALID_ARGUMENT); - return nullptr; - } - - if (err != CHIP_NO_ERROR) - { - err = ThrowInvalidManualPairingCodeFormatException(env, manualPairingCode); - if (err != CHIP_NO_ERROR) - { - ChipLogError(SetupPayload, "Error throwing ThrowInvalidManualPairingCodeFormatException: %" CHIP_ERROR_FORMAT, - err.Format()); - } - return nullptr; - } - - return TransformSetupPayload(env, payload); -} - jobject TransformSetupPayload(JNIEnv * env, SetupPayload & payload) { jclass setupPayloadClass = env->FindClass("chip/setuppayload/SetupPayload"); @@ -254,25 +218,6 @@ JNI_METHOD(jstring, getQrCodeFromPayload)(JNIEnv * env, jobject self, jobject se return env->NewStringUTF(qrString.c_str()); } -JNI_METHOD(jstring, getManualPairingCodeFromPayload)(JNIEnv * env, jobject self, jobject setupPayload) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - SetupPayload payload; - std::string outDecimalString; - - TransformSetupPayloadFromJobject(env, setupPayload, payload); - - err = ManualSetupPayloadGenerator(payload).payloadDecimalStringRepresentation(outDecimalString); - if (err != CHIP_NO_ERROR) - { - jclass exceptionCls = env->FindClass("chip/setuppayload/SetupPayloadParser$SetupPayloadException"); - JniReferences::GetInstance().ThrowError(env, exceptionCls, err); - return nullptr; - } - - return env->NewStringUTF(outDecimalString.c_str()); -} - void TransformSetupPayloadFromJobject(JNIEnv * env, jobject jPayload, SetupPayload & payload) { jclass setupPayloadClass = env->FindClass("chip/setuppayload/SetupPayload"); @@ -357,22 +302,3 @@ CHIP_ERROR ThrowUnrecognizedQRCodeException(JNIEnv * env, jstring qrCodeObj) env->Throw(exception); return CHIP_NO_ERROR; } - -CHIP_ERROR ThrowInvalidManualPairingCodeFormatException(JNIEnv * env, jstring manualPairingCodeObj) -{ - jclass exceptionCls = nullptr; - jmethodID exceptionConstructor = nullptr; - jthrowable exception = nullptr; - - env->ExceptionClear(); - - exceptionCls = env->FindClass("chip/setuppayload/SetupPayloadParser$InvalidEntryCodeFormatException"); - VerifyOrReturnError(exceptionCls != NULL, SETUP_PAYLOAD_PARSER_JNI_ERROR_TYPE_NOT_FOUND); - exceptionConstructor = env->GetMethodID(exceptionCls, "", "(Ljava/lang/String;)V"); - VerifyOrReturnError(exceptionConstructor != NULL, SETUP_PAYLOAD_PARSER_JNI_ERROR_METHOD_NOT_FOUND); - exception = (jthrowable) env->NewObject(exceptionCls, exceptionConstructor, manualPairingCodeObj); - VerifyOrReturnError(exception != NULL, SETUP_PAYLOAD_PARSER_JNI_ERROR_EXCEPTION_THROWN); - - env->Throw(exception); - return CHIP_NO_ERROR; -} diff --git a/src/controller/java/src/chip/onboardingpayload/CommissioningFlow.kt b/src/controller/java/src/chip/onboardingpayload/CommissioningFlow.kt new file mode 100644 index 00000000000000..3c641f9e8da8c5 --- /dev/null +++ b/src/controller/java/src/chip/onboardingpayload/CommissioningFlow.kt @@ -0,0 +1,28 @@ +/* + * + * Copyright (c) 2023 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. + */ + +package chip.onboardingpayload + +/** + * Enum values for possible flows for out-of-box commissioning that a Matter device manufacturer + * may select for a given product. + */ +enum class CommissioningFlow(val value: Int) { + STANDARD(0), // Device automatically enters pairing mode upon power-up + USER_ACTION_REQUIRED(1), // Device requires a user interaction to enter pairing mode + CUSTOM(2) // Commissioning steps should be retrieved from the distributed compliance ledger +} diff --git a/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadGenerator.kt b/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadGenerator.kt new file mode 100644 index 00000000000000..c71b1f8605657a --- /dev/null +++ b/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadGenerator.kt @@ -0,0 +1,152 @@ +/* + * + * Copyright (c) 2023 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. + */ + +package chip.onboardingpayload + +class ManualOnboardingPayloadGenerator(private val payloadContents: OnboardingPayload) { + private var skipPayloadValidation = false + private var forceShortCode = false + + fun setSkipPayloadValidation(allow: Boolean) { + skipPayloadValidation = allow + } + + fun setForceShortCode(useShort: Boolean) { + forceShortCode = useShort + } + + fun payloadDecimalStringRepresentation(): String { + // One extra char for the check digit. + val decimalString = CharArray(kManualSetupLongCodeCharLength + 1) + + if (kManualSetupCodeChunk1CharLength + kManualSetupCodeChunk2CharLength + kManualSetupCodeChunk3CharLength != + kManualSetupShortCodeCharLength) { + throw OnboardingPayloadException("Manual code length mismatch (short)") + } + + if (kManualSetupShortCodeCharLength + kManualSetupVendorIdCharLength + kManualSetupProductIdCharLength != + kManualSetupLongCodeCharLength) { + throw OnboardingPayloadException("Manual code length mismatch (long)") + } + + if (kManualSetupChunk1DiscriminatorMsbitsLength + kManualSetupChunk2DiscriminatorLsbitsLength != + kManualSetupDiscriminatorFieldLengthInBits) { + throw OnboardingPayloadException("Discriminator length is not valid") + } + + if (kManualSetupChunk2PINCodeLsbitsLength + kManualSetupChunk3PINCodeMsbitsLength != + kSetupPINCodeFieldLengthInBits) { + throw OnboardingPayloadException("PIN code length is not valid") + } + + val useLongCode = (payloadContents.commissioningFlow != CommissioningFlow.STANDARD.value) && !forceShortCode + + if (!skipPayloadValidation && !payloadContents.isValidManualCode()) { + throw OnboardingPayloadException("The Manual Pairing code is not valid") + } + + // Add two for the check digit and null terminator. + if ((useLongCode && decimalString.size < kManualSetupLongCodeCharLength + 1) || + (!useLongCode && decimalString.size < kManualSetupShortCodeCharLength + 1)) { + throw OnboardingPayloadException("The decimalString has insufficient size") + } + + val chunk1 = chunk1PayloadRepresentation(payloadContents) + val chunk2 = chunk2PayloadRepresentation(payloadContents) + val chunk3 = chunk3PayloadRepresentation(payloadContents) + + var offset = 0 + + decimalStringWithPadding(decimalString.sliceArray(offset until offset + kManualSetupCodeChunk1CharLength), chunk1) + offset += kManualSetupCodeChunk1CharLength + decimalStringWithPadding(decimalString.sliceArray(offset until offset + kManualSetupCodeChunk2CharLength), chunk2) + offset += kManualSetupCodeChunk2CharLength + decimalStringWithPadding(decimalString.sliceArray(offset until offset + kManualSetupCodeChunk3CharLength), chunk3) + offset += kManualSetupCodeChunk3CharLength + + if (useLongCode) { + decimalStringWithPadding(decimalString.sliceArray(offset until offset + kManualSetupVendorIdCharLength), payloadContents.vendorId) + offset += kManualSetupVendorIdCharLength + decimalStringWithPadding(decimalString.sliceArray(offset until offset + kManualSetupProductIdCharLength), payloadContents.productId) + offset += kManualSetupProductIdCharLength + } + + val checkDigit = Verhoeff10.charToVal(Verhoeff10.computeCheckChar(decimalString.concatToString())) + decimalStringWithPadding(decimalString.sliceArray(offset until offset + 2), checkDigit) + offset += 1 + + // Reduce decimalString size to be the size of written data and to not include null-terminator. In Kotlin, there is no direct + // method to resize an array.We use copyOfRange(0, offset) to create a new CharArray that includes only the elements from index + // 0 to offset-1, effectively reducing the size of the buffer. + decimalString.copyOfRange(0, offset) + + return decimalString.joinToString() + } + + private fun chunk1PayloadRepresentation(payload: OnboardingPayload): Int { + /* <1 digit> Represents: + * - Discriminator + * - VID/PID present flag + */ + val discriminatorShift = (kManualSetupDiscriminatorFieldLengthInBits - kManualSetupChunk1DiscriminatorMsbitsLength) + val discriminatorMask: Int = (1 shl kManualSetupChunk1DiscriminatorMsbitsLength) - 1 + + if (kManualSetupChunk1VidPidPresentBitPos < + kManualSetupChunk1DiscriminatorMsbitsPos + kManualSetupChunk1DiscriminatorMsbitsLength) { + throw OnboardingPayloadException("Discriminator won't fit") + } + + val discriminatorChunk: Int = (payload.getShortDiscriminatorValue() shr discriminatorShift) and discriminatorMask + val vidPidPresentFlag: Int = if (payload.commissioningFlow != CommissioningFlow.STANDARD.value) 1 else 0 + + return (discriminatorChunk shl kManualSetupChunk1DiscriminatorMsbitsPos) or + (vidPidPresentFlag shl kManualSetupChunk1VidPidPresentBitPos) + } + + private fun chunk2PayloadRepresentation(payload: OnboardingPayload): Int { + /* <5 digits> Represents: + * - PIN Code + * - Discriminator + */ + val discriminatorMask: Int = (1 shl kManualSetupChunk2DiscriminatorLsbitsLength) - 1 + val pincodeMask: Int = (1 shl kManualSetupChunk2PINCodeLsbitsLength) - 1 + + val discriminatorChunk: Int = payload.getShortDiscriminatorValue() and discriminatorMask + + return ((payload.setupPinCode.toInt() and pincodeMask) shl kManualSetupChunk2PINCodeLsbitsPos) or + (discriminatorChunk shl kManualSetupChunk2DiscriminatorLsbitsPos) + } + + private fun chunk3PayloadRepresentation(payload: OnboardingPayload): Int { + /* <4 digits> Represents: + * - PIN Code + */ + val pincodeShift: Int = (kSetupPINCodeFieldLengthInBits - kManualSetupChunk3PINCodeMsbitsLength) + val pincodeMask: Int = (1 shl kManualSetupChunk3PINCodeMsbitsLength) - 1 + + return ((payload.setupPinCode.toInt() shr pincodeShift) and pincodeMask) shl kManualSetupChunk3PINCodeMsbitsPos + } + + private fun decimalStringWithPadding(buffer: CharArray, number: Int): Unit { + val len = buffer.size - 1 + val retval = String.format("%0${len}d", number).toCharArray(buffer, 0, buffer.size) + + if (retval.size >= buffer.size) { + throw OnboardingPayloadException("The outBuffer has insufficient size") + } + } +} diff --git a/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadParser.kt b/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadParser.kt new file mode 100644 index 00000000000000..ec866ad9df5d9e --- /dev/null +++ b/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadParser.kt @@ -0,0 +1,149 @@ +/* + * + * Copyright (c) 2023 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. + */ + +package chip.onboardingpayload + +import java.util.concurrent.atomic.AtomicInteger + +import java.lang.StringBuilder + +/** + * A class that can be used to convert a decimal encoded payload to a OnboardingPayload object. + */ +class ManualOnboardingPayloadParser(decimalRepresentation: String) { + private val decimalStringRepresentation: String + + init { + // '-' might be being used in the decimal code as a digit group + // separator, to aid in readability. It's not actually part of the + // decimal code, so strip it out. + decimalStringRepresentation = decimalRepresentation.replace("-", "") + } + + fun populatePayload(outPayload: OnboardingPayload): Unit { + var representationWithoutCheckDigit: String + + representationWithoutCheckDigit = checkDecimalStringValidity(decimalStringRepresentation) + + var stringOffset: AtomicInteger = AtomicInteger(0) + + var chunk1 = readDigitsFromDecimalString(representationWithoutCheckDigit, stringOffset, kManualSetupCodeChunk1CharLength) + var chunk2 = readDigitsFromDecimalString(representationWithoutCheckDigit, stringOffset, kManualSetupCodeChunk2CharLength) + var chunk3 = readDigitsFromDecimalString(representationWithoutCheckDigit, stringOffset, kManualSetupCodeChunk3CharLength) + + + // First digit of '8' or '9' would be invalid for v1 and would indicate new format (e.g. version 2) + if (chunk1 == 8u || chunk1 == 9u) { + throw InvalidManualPairingCodeFormatException("Invalid argument") + } + + val isLongCode = ((chunk1 shr kManualSetupChunk1VidPidPresentBitPos) and 1u) == 1u + checkCodeLengthValidity(representationWithoutCheckDigit, isLongCode) + + val kDiscriminatorMsbitsMask: UInt = (1u shl kManualSetupChunk1DiscriminatorMsbitsLength) - 1u + val kDiscriminatorLsbitsMask: UInt = (1u shl kManualSetupChunk2DiscriminatorLsbitsLength) - 1u + + var discriminator = ((chunk2 shr kManualSetupChunk2DiscriminatorLsbitsPos) and kDiscriminatorLsbitsMask).toInt() + + discriminator = discriminator or + (((chunk1 shr kManualSetupChunk1DiscriminatorMsbitsPos) and kDiscriminatorMsbitsMask).toInt() + shl kManualSetupChunk2DiscriminatorLsbitsLength) + + val kPincodeMsbitsMask: UInt = (1u shl kManualSetupChunk3PINCodeMsbitsLength) - 1u + val kPincodeLsbitsMask: UInt = (1u shl kManualSetupChunk2PINCodeLsbitsLength) - 1u + + var setUpPINCode: Long = ((chunk2 shr kManualSetupChunk2PINCodeLsbitsPos) and kPincodeLsbitsMask).toLong() + + setUpPINCode = setUpPINCode or + (((chunk3 shr kManualSetupChunk3PINCodeMsbitsPos) and kPincodeMsbitsMask).toLong() + shl kManualSetupChunk2PINCodeLsbitsLength) + + if (setUpPINCode == 0L) { + throw InvalidManualPairingCodeFormatException("Failed decoding base10. SetUpPINCode was 0") + } + + if (isLongCode) { + var vendorID = readDigitsFromDecimalString(representationWithoutCheckDigit, stringOffset, kManualSetupVendorIdCharLength) + var productID = readDigitsFromDecimalString(representationWithoutCheckDigit, stringOffset, kManualSetupProductIdCharLength) + + // Need to do dynamic checks, because we are reading 5 chars, so could have 99,999 here or something. + if (vendorID !in UShort.MIN_VALUE..UShort.MAX_VALUE) { + throw InvalidManualPairingCodeFormatException("Invalid integer value") + } + + outPayload.vendorId = vendorID.toInt() + if (productID !in UShort.MIN_VALUE..UShort.MAX_VALUE) { + throw InvalidManualPairingCodeFormatException("Invalid interger value") + } + outPayload.productId = productID.toInt() + } + + outPayload.commissioningFlow = if (isLongCode) CommissioningFlow.CUSTOM.value else CommissioningFlow.STANDARD.value + require(kSetupPINCodeFieldLengthInBits <= 32) { "Won't fit in UInt32" } + outPayload.setupPinCode = setUpPINCode + require(kManualSetupDiscriminatorFieldLengthInBits <= 8) { "Won't fit in UInt8" } + outPayload.discriminator = discriminator + } + + companion object { + private fun checkDecimalStringValidity(decimalString: String): String { + if (decimalString.length < 2) { + throw InvalidManualPairingCodeFormatException("Failed decoding base10. Input was empty. ${decimalString.length}") + } + val repWithoutCheckChar = decimalString.substring(0, decimalString.length - 1) + + val checkChar = decimalString.last() + + if (!Verhoeff10.validateCheckChar(checkChar, repWithoutCheckChar)) { + throw InvalidManualPairingCodeFormatException("Integrity check failed") + } + + return repWithoutCheckChar + } + + private fun checkCodeLengthValidity(decimalString: String, isLongCode: Boolean): Unit { + val expectedCharLength = if (isLongCode) kManualSetupLongCodeCharLength else kManualSetupShortCodeCharLength + if (decimalString.length != expectedCharLength) { + throw InvalidManualPairingCodeFormatException("Failed decoding base10. Input length ${decimalString.length} was not expected length $expectedCharLength") + } + } + + private fun toNumber(decimalString: String): UInt { + var number: UInt = 0u + for (c in decimalString) { + if (!c.isDigit()) { + throw InvalidManualPairingCodeFormatException("Failed decoding base10. Character was invalid $c") + } + number *= 10u + number += (c - '0').toUInt() + } + return number + } + + // Populate numberOfChars into dest from decimalString starting at startIndex (least significant digit = left-most digit) + fun readDigitsFromDecimalString(decimalString: String, index: AtomicInteger, numberOfCharsToRead: Int): UInt { + val startIndex = index.get() + if (decimalString.length < numberOfCharsToRead || (numberOfCharsToRead + startIndex > decimalString.length)) { + throw InvalidManualPairingCodeFormatException("Failed decoding base10. Input was too short. ${decimalString.length}") + } + + val decimalSubstring = decimalString.substring(index.toInt(), (startIndex + numberOfCharsToRead).toInt()) + index.set(startIndex + numberOfCharsToRead) + return toNumber(decimalSubstring) + } + } +} diff --git a/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt b/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt index 5baf8058acad9c..660d0a47d1ffdb 100644 --- a/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt +++ b/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt @@ -17,6 +17,53 @@ package chip.onboardingpayload +// See section 5.1.2. QR Code in the Matter specification +const val kDiscriminatorLongBits = 12 +const val kDiscriminatorShortBits = 4 +const val kDiscriminatorLongMask = (1 shl kDiscriminatorLongBits) - 1 +const val kDiscriminatorShortMask = (1 shl kDiscriminatorShortBits) - 1 + +const val kVersionFieldLengthInBits = 3 +const val kVendorIDFieldLengthInBits = 16 +const val kProductIDFieldLengthInBits = 16 +const val kCommissioningFlowFieldLengthInBits = 2 +const val kRendezvousInfoFieldLengthInBits = 8 +const val kPayloadDiscriminatorFieldLengthInBits = kDiscriminatorLongBits +const val kSetupPINCodeFieldLengthInBits = 27 +const val kPaddingFieldLengthInBits = 4 +const val kRawVendorTagLengthInBits = 7 + +// See section 5.1.3. Manual Pairing Code in the Matter specification +const val kManualSetupDiscriminatorFieldLengthInBits = kDiscriminatorShortBits +const val kManualSetupChunk1DiscriminatorMsbitsPos = 0 +const val kManualSetupChunk1DiscriminatorMsbitsLength = 2 +const val kManualSetupChunk1VidPidPresentBitPos = + (kManualSetupChunk1DiscriminatorMsbitsPos + kManualSetupChunk1DiscriminatorMsbitsLength) +const val kManualSetupChunk2PINCodeLsbitsPos = 0 +const val kManualSetupChunk2PINCodeLsbitsLength = 14 +const val kManualSetupChunk2DiscriminatorLsbitsPos = (kManualSetupChunk2PINCodeLsbitsPos + kManualSetupChunk2PINCodeLsbitsLength) +const val kManualSetupChunk2DiscriminatorLsbitsLength = 2 +const val kManualSetupChunk3PINCodeMsbitsPos = 0 +const val kManualSetupChunk3PINCodeMsbitsLength = 13 + +const val kManualSetupShortCodeCharLength = 10 +const val kManualSetupLongCodeCharLength = 20 +const val kManualSetupCodeChunk1CharLength = 1 +const val kManualSetupCodeChunk2CharLength = 5 +const val kManualSetupCodeChunk3CharLength = 4 +const val kManualSetupVendorIdCharLength = 5 +const val kManualSetupProductIdCharLength = 5 + +// Spec 5.1.4.2 CHIP-Common Reserved Tags +const val kSerialNumberTag = 0x00 +const val kPBKDFIterationsTag = 0x01 +const val kBPKFSaltTag = 0x02 +const val kNumberOFDevicesTag = 0x03 +const val kCommissioningTimeoutTag = 0x04 + +const val kSetupPINCodeMaximumValue = 99999998 +const val kSetupPINCodeUndefinedValue = 0 + /** Class to hold the data from the scanned QR code or Manual Pairing Code. */ class OnboardingPayload( /** Version info of the OnboardingPayload: version SHALL be 0 */ @@ -55,6 +102,711 @@ class OnboardingPayload( ) { var optionalQRCodeInfo: HashMap + // code="0x0000" is defined as "Matter Standard" in the official CSA alliance manufacturer ID database + // and is treated as invalid in Matter SDK. + enum class VendorId(val value: Int) { + UNSPECIFIED(0x0000), + PANASONIC(0x0001), + SONY(0x0002), + SAMSUNG(0x0003), + PHILIPS(0x0004), + FREESCALE_RF(0x0005), + OKI_SEMICONDUCTORS(0x0006), + TEXAS_INSTRUMENTS(0x0007), + CIRRONET(0x1000), + CHIPCON(0x1001), + EMBER(0x1002), + NTS(0x1003), + FREESCALE(0x1004), + IP_COM(0x1005), + SAN_JUAN_SOFTWARE(0x1006), + TUV(0x1007), + INTEGRATION(0x1008), + BM_SPA(0x1009), + AWAREPOINT(0x100A), + SIGNIFY_NETHERLANDS(0x100B), + LUXOFT(0x100C), + KORWIN(0x100D), + ONE_RF_TECHNOLOGY(0x100E), + SOFTWARE_TECHNOLOGIES_GROUP(0x100F), + TELEGESIS(0x1010), + VISONIC(0x1011), + INSTA(0x1012), + ATALUM(0x1013), + ATMEL(0x1014), + DEVELCO(0x1015), + HONEYWELL(0x1016), + RADIOPULSE(0x1017), + RENESAS(0x1018), + XANADU_WIRELESS(0x1019), + NEC_ENGINEERING(0x101A), + YAMATAKE_CORPORATION(0x101B), + TENDRIL_NETWORKS(0x101C), + ASSA_ABLOY(0x101D), + MAXSTREAM(0x101E), + NEUROCOM(0x101F), + INSTITUTE_FOR_INFORMATION_INDUSTRY(0x1020), + LEGRAND_GROUP(0x1021), + ICONTROL(0x1022), + RAYMARINE(0x1023), + LS_RESEARCH(0x1024), + ONITY_INC(0x1025), + MONO_PRODUCTS(0x1026), + RF_TECHNOLOGIES(0x1027), + ITRON(0x1028), + TRITECH(0x1029), + EMBEDIT_AS(0x102A), + S3C(0x102B), + SIEMENS(0x102C), + MINDTECH(0x102D), + LG_ELECTRONICS(0x102E), + MITSUBISHI_ELECTRIC_CORP(0x102F), + JOHNSON_CONTROLS(0x1030), + SECURE_METERS_UK_LTD(0x1031), + KNICK(0x1032), + VICONICS(0x1033), + FLEXIPANEL(0x1034), + PIASIM_CORPORATION_PTE_LTD(0x1035), + TRANE(0x1036), + NXP_SEMICONDUCTORS(0x1037), + LIVING_INDEPENDENTLY_GROUP(0x1038), + ALERTME_COM(0x1039), + DAINTREE(0x103A), + AIJI_SYSTEM(0x103B), + TELECOM_ITALIA(0x103C), + MIKROKRETS_AS(0x103D), + OKI_SEMICONDUCTOR(0x103E), + NEWPORT_ELECTONICS(0x103F), + CONTROL_4(0x1040), + STMICROELECTRONICS(0x1041), + AD_SOL_NISSIN_CORP(0x1042), + DCSI(0x1043), + FRANCE_TELECOM(0x1044), + MUNET(0x1045), + AUTANI_CORPORATION(0x1046), + COLORADO_VNET(0x1047), + AEROCOMM_INC(0x1048), + SILICON_LABORATORIES(0x1049), + INNCOM_INTERNATIONAL_INC(0x104A), + COOPER_POWER_SYSTEMS(0x104B), + SYNAPSE(0x104C), + FISHER_PIERCE_SUNRISE(0x104D), + CENTRALITE_SYSTEMS_INC(0x104E), + CRANE_WIRELESS_MONITORING_SOLUTIONS(0x104F), + MOBILARM_LIMITED(0x1050), + IMONITOR_RESEARCH_LTD(0x1051), + BARTECH(0x1052), + MESHNETICS(0x1053), + LS_INDUSTRIAL_SYSTEMS(0x1054), + CASON_ENGINEERING(0x1055), + WIRELESS_GLUE_NETWORKS(0x1056), + ELSTER(0x1057), + SMS_TECNOLOGIA_ELETRONICA(0x1058), + ONSET_COMPUTER_CORPORATION(0x1059), + RIGA_DEVELOPMENT(0x105A), + ENERGATE(0x105B), + CONMED_LINVATEC(0x105C), + POWERMAND(0x105D), + SCHNEIDER_ELECTRIC(0x105E), + EATON_CORPORATION(0x105F), + TELULAR_CORPORATION(0x1060), + DELPHI_MEDICAL_SYSTEMS(0x1061), + EPISENSOR_LIMITED(0x1062), + LANDIS_GYR(0x1063), + KABA_GROUP(0x1064), + SHURE_INCORPORATED(0x1065), + COMVERGE_INC(0x1066), + DBS_LODGING_TECHNOLOGIES(0x1067), + ENERGY_AWARE_TECHNOLOGY(0x1068), + HIDALGO_LIMITED(0x1069), + AIR2APP(0x106A), + AMX(0x106B), + EDMI_PTY_LTD(0x106C), + CYAN_LTD(0x106D), + SYSTEM_SPA(0x106E), + TELIT(0x106F), + KAGA_ELECTRONICS(0x1070), + ASTREL_GROUP(0x1071), + CERTICOM(0x1072), + GRIDPOINT(0x1073), + PROFILE_SYSTEMS(0x1074), + COMPACTA_INTERNATIONAL(0x1075), + FREESTYLE_TECHNOLOGY(0x1076), + ALEKTRONA(0x1077), + COMPUTIME(0x1078), + REMOTE_TECHNOLOGIES_INC(0x1079), + WAVECOM_SA(0x107A), + ENERGY_OPTIMIZERS(0x107B), + GE(0x107C), + JETLUN(0x107D), + CIPHER_SYSTEMS(0x107E), + CORPORATE_SYSTEMS_ENGINEERING(0x107F), + ECOBEE(0x1080), + SMK(0x1081), + MESHWORKS_WIRELESS(0x1082), + ELLIPS_BV(0x1083), + SECURE_ELECTRANS(0x1084), + CEDO(0x1085), + TOSHIBA(0x1086), + DIGI_INTERNATIONAL(0x1087), + UBILogix(0x1088), + ECHELON(0x1089), + GREEN_ENERGY_OPTIONS(0x1090), + SILVER_SPRING_NETWORKS(0x1091), + BLACK_AND_DECKER(0x1092), + AZTECH_ASSOCIATES_INC(0x1093), + A_AND_D_CO_LTD(0x1094), + RAINFOREST_AUTOMATION(0x1095), + CARRIER_ELECTRONICS(0x1096), + SYCHIP_MURATA(0x1097), + OPENPEAK(0x1098), + PASSIVE_SYSTEMS(0x1099), + MMB_RESEARCH(0x109A), + LEVITON_MANUFACTURING_COMPANY(0x109B), + KOREA_ELECTRIC_POWER_DATA_NETWORK_CO(0x109C), + COMCAST(0x109D), + NEC_ELECTRONICS(0x109E), + NETVOX(0x109F), + U_CONTROL(0x10A0), + EMBEDIA_TECHNOLOGIES_CORP(0x10A1), + SENSUS(0x10A2), + SUNRISE_TECHNOLOGIES(0x10A3), + MEMTECH_CORP(0x10A4), + FREEBOX(0x10A5), + M2_LABS_LTD(0x10A6), + BRITISH_GAS(0x10A7), + SENTEC_LTD(0x10A8), + NAVETAS(0x10A9), + LIGHTSPEED_TECHNOLOGIES(0x10AA), + OKI_ELECTRIC_INDUSTRY_CO(0x10AB), + S_I_SISTEMAS_INTELIGENTES_ELETRONICOS(0x10AC), + DOMETIC(0x10AD), + ALPS(0x10AE), + ENERGYHUB(0x10AF), + KAMSTRUP(0x10B0), + ECHOSTAR(0x10B1), + ENERNOC(0x10B2), + ELTAV(0x10B3), + BELKIN(0x10B4), + XSTREAMHD_WIRELESS_VENTURES(0x10B5), + SATURN_SOUTH_PTY_LTD(0x10B6), + GREENTRAPOLINE_A_S(0x10B7), + SMARTSYNCH_INC(0x10B8), + NYCE_CONTROL_INC(0x10B9), + ICM_CONTROLS_CORP(0x10BA), + MILLENNIUM_ELECTRONICS_PTY_LTD(0x10BB), + MOTOROLA_INC(0x10BC), + EMERSON_WHITE_RODGERS(0x10BD), + RADIO_THERMOSTAT_COMPANY_OF_AMERICA(0x10BE), + OMRON_CORPORATION(0x10BF), + GIINII_GLOBAL_LIMITED(0x10C0), + FUJITSU_GENERAL_LIMITED(0x10C1), + PEEL_TECHNOLOGIES_INC(0x10C2), + ACCENT_SPA(0x10C3), + BYTESNAP_DESIGN_LTD(0x10C4), + NEC_TOKIN_CORPORATION(0x10C5), + G4S_JUSTICE_SERVICES(0x10C6), + TRILLIANT_NETWORKS_INC(0x10C7), + ELECTROLUX_ITALIA_SPA(0x10C8), + ONZO_LTD(0x10C9), + ENTEK_SYSTEMS(0x10CA), + MAINSTREAM_ENGINEERING(0x10CC), + INDESIT_COMPANY(0x10CD), + THINKECO_INC(0x10CE), + D2C_INC(0x10CF), + QORVO(0x10D0), + INTERCEL(0x10D1), + MITSUMI_ELECTRIC_CO_LTD(0x10D3), + MITSUMI_ELECTRIC_CO_LTD_2(0x10D4), + ZENTRUM_MIKROELEKTRONIK_DRESDEN_AG(0x10D5), + NEST_LABS_INC(0x10D6), + EXEGIN_TECHNOLOGIES_LTD(0x10D7), + TAKAHATA_PRECISION_CO(0x10D9), + SUMITOMO_ELECTRIC_NETWORKS_INC(0x10DA), + GE_ENERGY(0x10DB), + GE_APPLIANCES(0x10DC), + RADIOCRAFTS_AS(0x10DD), + CEIVA(0x10DE), + TEC_AND_CO_CO_LTD(0x10DF), + CHAMELEON_TECHNOLOGY_UK_LTD(0x10E0), + RUWIDO_AUSTRIA_GMBH(0x10E2), + HUAWEI_TECHNOLOGIES_CO(0x10E3), + HUAWEI_TECHNOLOGIES_CO_2(0x10E4), + GREENWAVE_REALITY(0x10E5), + BGLOBAL_METERING_LTD(0x10E6), + MINDTECK(0x10E7), + INGERSOLL_RAND(0x10E8), + DIUS_COMPUTING_PTY_LTD(0x10E9), + EMBEDDED_AUTOMATION_INC(0x10EA), + ABB(0x10EB), + GENUS_POWER_INFRASTRUCTURES_LIMITED(0x10ED), + UNIVERSAL_ELECTRONICS_INC(0x10EE), + UNIVERSAL_ELECTRONICS_INC_2(0x10EF), + METRUM_TECHNOLOGIES_LLC(0x10F0), + CISCO(0x10F1), + UBISYS_TECHNOLOGIES_GMBH(0x10F2), + CONSERT(0x10F3), + CRESTRON_ELECTRONICS(0x10F4), + ENPHASE_ENERGY(0x10F5), + INVENSYS_CONTROLS(0x10F6), + MUELLER_SYSTEMS_LLC(0x10F7), + AAC_TECHNOLOGIES_HOLDING(0x10F8), + U_NEXT_CO(0x10F9), + STEELCASE_INC(0x10FA), + TELEMATICS_WIRELESS(0x10FB), + SAMIL_POWER_CO(0x10FC), + PACE_PLC(0x10FD), + OSBORNE_COINAGE_CO(0x10FE), + POWERWATCH(0x10FF), + CANDELED_GMBH(0x1100), + FLEXGRID_SRL(0x1101), + HUMAX(0x1102), + UNIVERSAL_DEVICES(0x1103), + ADVANCED_ENERGY(0x1104), + BEGA_GANTENBRINK_LEUCHTEN(0x1105), + BRUNEL_UNIVERSITY(0x1106), + PANASONIC_RD_CENTER_SINGAPORE(0x1107), + ESYSTEMS_RESEARCH(0x1108), + PANAMAX(0x1109), + SMARTTHINGS_INC(0x110A), + EM_LITE_LTD(0x110B), + OSRAM_SYLVANIA(0x110C), + SAVE_ENERGY_LTD(0x110D), + PLANET_INNOVATION_PRODUCTS_PTY_LTD(0x110E), + AMBIENT_DEVICES_INC(0x110F), + PROFALUX(0x1110), + BILLION_ELECTRIC_COMPANY(0x1111), + EMBERTEC_PTY_LTD(0x1112), + IT_WATCHDOGS(0x1113), + RELOC(0x1114), + INTEL_CORPORATION(0x1115), + TREND_ELECTRONICS_LIMITED(0x1116), + MOXA(0x1117), + QEES(0x1118), + SAYME_WIRELESS_SENSOR_NETWORKS(0x1119), + PENTAIR_AQUATIC_SYSTEMS(0x111A), + ORBIT_IRRIGATION(0x111B), + CALIFORNIA_EASTERN_LABORATORIES(0x111C), + IDT_TECHNOLOGY_LIMITED(0x111E), + PIXELA_CORPORATION(0x111F), + TIVO_INC(0x1120), + FIDURE_CORP(0x1121), + MARVELL_SEMICONDUCTOR_INC(0x1122), + WASION_GROUP_LIMITED(0x1123), + JASCO_PRODUCTS_COMPANY(0x1124), + SHENZHEN_KAIFA_TECHNOLOGY(0x1125), + NETCOMM_WIRELESS_LIMITED(0x1126), + DEFINE_INSTRUMENTS_LIMITED(0x1127), + IN_HOME_DISPLAYS_LTD(0x1128), + MIELE_AND_CIE_KG(0x1129), + TELEVES_SA(0x112A), + LABELEC(0x112B), + CHINA_ELECTRONICS_STANDARDIZATION_INSTITUTE(0x112C), + VECTORFORM_LLC(0x112D), + BUSCH_JAEGER_ELEKTRO(0x112E), + REDPINE_SIGNALS_INC(0x112F), + BRIDGES_ELECTRONIC_TECHNOLOGY_PTY_LTD(0x1130), + SERCOMM(0x1131), + WSH_GMBH_WIRSINDHELLER(0x1132), + BOSCH_SECURITY_SYSTEMS_INC(0x1133), + EZEX_CORPORATION(0x1134), + DRESDEN_ELEKTRONIK_INGENIEURTECHNIK_GMBH(0x1135), + MEAZON_SA(0x1136), + CROW_ELECTRONIC_ENGINEERING_LTD(0x1137), + HARVARD_ENGINEERING_PLC(0x1138), + ANDSON_BEIJING_TECHNOLOGY(0x1139), + ADHOCO_AG(0x113A), + WAXMAN_CONSUMER_PRODUCTS_GROUP_INC(0x113B), + OWON_TECHNOLOGY_INC(0x113C), + HITRON_TECHNOLOGIES_INC(0x113D), + SCEMTEC_HARD_UND_SOFTWARE(0x113E), + WEBEE_LLC(0x113F), + GRID2HOME_INC(0x1140), + TELINK_MICRO(0x1141), + JASMINE_SYSTEMS_INC(0x1142), + BIDGELY(0x1143), + LUTRON(0x1144), + IJENKO(0x1145), + STARFIELD_ELECTRONIC_LTD(0x1146), + TCP_INC(0x1147), + ROGERS_COMMUNICATIONS_PARTNERSHIP(0x1148), + CREE_INC(0x1149), + ROBERT_BOSCH_LLC(0x114A), + IBIS_NETWORKS_INC(0x114B), + QUIRKY_INC(0x114C), + EFERGY_TECHNOLOGIES_LIMITED(0x114D), + SMARTLABS_INC(0x114E), + EVERSPRING_INDUSTRY_CO_LTD(0x114F), + SWANN_COMMUNICATIONS_PTL_LTD(0x1150), + SONETER(0x1151), + SAMSUNG_SDS(0x1152), + UNIBAND_ELECTRONIC_CORPORATION(0x1153), + ACCTON_TECHNOLOGY_CORPORATION(0x1154), + BOSCH_THERMOTECHNIK_GMBH(0x1155), + WINCOR_NIXDORF_INC(0x1156), + OHSUNG_ELECTRONICS(0x1157), + ZEN_WITHIN_INC(0x1158), + TECH4HOME_LDA(0x1159), + NANOLEAF(0x115A), + KEEN_HOME_INC(0x115B), + POLY_CONTROL_APS(0x115C), + EASTFIELD_LIGHTING_CO_LTD_SHENZHEN(0x115D), + IP_DATATEL_INC(0x115E), + LUMI_UNITED_TECHOLOGY_LTD_SHENZHEN(0x115F), + SENGLED_CO_LTD(0x1160), + REMOTE_SOLUTION_CO_LTD(0x1161), + ABB_GENWAY_XIAMEN_ELECTRICAL_EQUIPMENT_CO(0x1162), + ZHEJIANG_REXENSE_TECH(0x1163), + FOREE_TECHNOLOGY(0x1164), + OPEN_ACCESS_TECHNOLOGY_INTL(0x1165), + INNR_LIGHTING_BV(0x1166), + TECHWORLD_INDUSTRIES(0x1167), + LEEDARSON_LIGHTING_CO_LTD(0x1168), + ARZEL_ZONING(0x1169), + HOLLEY_TECHNOLOGY(0x116A), + BELDON_TECHNOLOGIES(0x116B), + FLEXTRONICS(0x116C), + SHENZHEN_MEIAN(0x116D), + LOWES(0x116E), + SIGMA_CONNECTIVITY(0x116F), + WULIAN(0x1171), + PLUGWISE_BV(0x1172), + TITAN_PRODUCTS(0x1173), + ECOSPECTRAL(0x1174), + D_LINK(0x1175), + TECHNICOLOR_HOME_USA(0x1176), + OPPLE_LIGHTING(0x1177), + WISTRON_NEWEB_CORP(0x1178), + QMOTION_SHADES(0x1179), + INSTA_GMBH(0x117A), + SHANGHAI_VANCOUNT(0x117B), + IKEA_OF_SWEDEN(0x117C), + RT_RK(0x117D), + SHENZHEN_FEIBIT(0x117E), + EUCONTROLS(0x117F), + TELKONET(0x1180), + THERMAL_SOLUTION_RESOURCES(0x1181), + POMCUBE(0x1182), + EI_ELECTRONICS(0x1183), + OPTOGA(0x1184), + STELPRO(0x1185), + LYNXUS_TECHNOLOGIES_CORP(0x1186), + SEMICONDUCTOR_COMPONENTS(0x1187), + TP_LINK(0x1188), + LEDVANCE_GMBH(0x1189), + NORTEK(0x118A), + IREVO_ASSA_ABBLOY_KOREA(0x118B), + MIDEA(0x118C), + ZF_FRIEDRICHSHAFEN(0x118D), + CHECKIT(0x118E), + ACLARA(0x118F), + NOKIA(0x1190), + GOLDCARD_HIGH_TECH_CO(0x1191), + GEORGE_WILSON_INDUSTRIES_LTD(0x1192), + EASY_SAVER_CO_INC(0x1193), + ZTE_CORPORATION(0x1194), + ARRIS(0x1195), + RELIANCE_BIG_TV(0x1196), + INSIGHT_ENERGY_VENTURES_POWERLEY(0x1197), + THOMAS_RESEARCH_PRODUCTS(0x1198), + LI_SENG_TECHNOLOGY(0x1199), + SYSTEM_LEVEL_SOLUTIONS_INC(0x119A), + MATRIX_LABS(0x119B), + SINOPE_TECHNOLOGIES(0x119C), + JIUZHOU_GREEBLE(0x119D), + GUANGZHOU_LANVEE_TECH_CO_LTD(0x119E), + VENSTAR(0x119F), + SLV(0x1200), + HALO_SMART_LABS(0x1201), + SCOUT_SECURITY_INC(0x1202), + ALIBABA_CHINA_INC(0x1203), + RESOLUTION_PRODUCTS_INC(0x1204), + SMARTLOK_INC(0x1205), + LUX_PRODUCTS_CORP(0x1206), + VIMAR_SPA(0x1207), + UNIVERSAL_LIGHTING_TECHNOLOGIES(0x1208), + ROBERT_BOSCH_GMBH(0x1209), + ACCENTURE(0x120A), + HEIMAN_TECHNOLOGY_CO(0x120B), + SHENZHEN_HOMA_TECHNOLOGY_CO(0x120C), + VISION_ELECTRONICS_TECHNOLOGY(0x120D), + LENOVO(0x120E), + PRESCIENSE_RD(0x120F), + SHENZHEN_SEASTAR_INTELLIGENCE_CO(0x1210), + SENSATIVE_AB(0x1211), + SOLAREDGE(0x1212), + ZIPATO(0x1213), + CHINA_FIRE_SECURITY_SENSING_MANUFACTURING(0x1214), + QUBY_BV(0x1215), + HANGZHOU_ROOMBANKER_TECHNOLOGY_CO(0x1216), + AMAZON_LAB126(0x1217), + PAULMANN_LICHT_GMBH(0x1218), + SHENZHEN_ORVIBO_ELECTRONICS_CO_LTD(0x1219), + TCI_TELECOMMUNICATIONS(0x121A), + MUELLER_LICHT_INTERNATIONAL_INC(0x121B), + AURORA_LIMITED(0x121C), + SMARTDCC(0x121D), + SHANGHAI_UMEINFO_CO_LTD(0x121E), + CARBONTRACK(0x121F), + SOMFY(0x1220), + VIESSMANN_ELEKTRONIK_GMBH(0x1221), + HILDEBRAND_TECHNOLOGY_LTD(0x1222), + ONKYO_TECHNOLOGY_CORPORATION(0x1223), + SHENZHEN_SUNRICHER_TECHNOLOGY_LTD(0x1224), + XIU_XIU_TECHNOLOGY_CO_LTD(0x1225), + ZUMTOBEL_GROUP(0x1226), + SHENZHEN_KAADAS_INTELLIGENT_TECHNOLOGY_CO_LTD(0x1227), + SHANGHAI_XIAOYAN_TECHNOLOGY_CO_LTD(0x1228), + CYPRESS_SEMICONDUCTOR(0x1229), + XAL_GMBH(0x122A), + INERGY_SYSTEMS_LLC(0x122B), + ALFRED_KARCHER_GMBH_CO_KG(0x122C), + ADUROLIGHT_MANUFACTURING(0x122D), + GROUPE_MULLER(0x122E), + V_MARK_ENTERPRISES_INC(0x122F), + LEAD_ENERGY_AG(0x1230), + ULTIMATE_IOT_HENAN_TECHNOLOGY_LTD(0x1231), + AXXESS_INDUSTRIES_INC(0x1232), + THIRD_REALITY_INC(0x1233), + DSR_CORPORATION(0x1234), + GUANGZHOU_VENSI_INTELLIGENT_TECHNOLOGY(0x1235), + SCHLAGE_LOCK_ALLEGION(0x1236), + NET2GRID(0x1237), + AIRAM_ELECTRIC_OY_AB(0x1238), + IMMAX_WPB_CZ(0x1239), + ZIV_AUTOMATION(0x123A), + HANGZHOU_IMAGICTECHNOLOGY(0x123B), + XIAMEN_LEELEN_TECHNOLOGY(0x123C), + OVERKIZ_SAS(0x123D), + FLONIDAN_A_S(0x123E), + HDL_AUTOMATION(0x123F), + ARDOMUS_NETWORKS_CORPORATION(0x1240), + SAMJIN_CO_LTD(0x1241), + FIREANGEL_SAFETY_TECHNOLOGY(0x1242), + INDRA_SISTEMAS_SA(0x1243), + SHENZHEN_JBT_SMART_LIGHTING(0x1244), + GE_LIGHTING_CURRENT(0x1245), + DANFOSS_A_S(0x1246), + NIVISS_PHP_SP_Z_O_O_SP_K(0x1247), + SHENZHEN_FENGLIYUAN_ENERGY_CONSERVATING_TECHNOLOGY(0x1248), + NEXELEC(0x1249), + SICHUAN_BEHOME_PROMINENT_TECHNOLOGY(0x124A), + FUJIAN_STAR_NET_COMMUNICATION(0x124B), + TOSHIBA_VISUAL_SOLUTIONS_CORPORATION(0x124C), + LATCHABLE_INC(0x124D), + L_S_DEUTSCHLAND_GMBH(0x124E), + GLEDOPTO_CO_LTD(0x124F), + THE_HOME_DEPOT(0x1250), + NEONLITE_DISTRIBUTION_LIMITED(0x1251), + ARLO_TECHNOLOGIES_INC(0x1252), + XINGLUO_TECHNOLOGY_CO_LTD(0x1253), + SIMON_ELECTRIC_CHINA_CO_LTD(0x1254), + HANGZHOU_GREATSTAR_INDUSTRIAL_CO_LTD(0x1255), + SEQUENTRIC_ENERGY_SYSTEMS_LLC(0x1256), + SOLUM_CO_LTD(0x1257), + EAGLERISE_ELECTRIC_ELECTRONIC_CHINA_CO_LTD(0x1258), + FANTEM_TECHNOLOGIES_SHENZHEN_CO_LTD(0x1259), + YUNDING_NETWORK_TECHNOLOGY_BEIJING_CO_LTD(0x125A), + ATLANTIC_GROUP(0x125B), + XIAMEN_INTRETECH_INC(0x125C), + TUYA_GLOBAL_INC(0x125D), + DNAKE_XIAMEN_INTELLIGENT_TECHNOLOGY(0x125E), + NIKO_NV(0x125F), + EMPORIA_ENERGY(0x1260), + SIKOM_AS(0x1261), + AXIS_LABS_INC(0x1262), + CURRENT_PRODUCTS_CORPORATION(0x1263), + METERSIT_SRL(0x1264), + HORNBACH_BAUMARKT_AG(0x1265), + DICEWORLD_S_R_L_A_SOCIO_UNICO(0x1266), + ARC_TECHNOLOGY_CO_LTD(0x1267), + HANGZHOU_KONKE_INFORMATION_TECHNOLOGY(0x1268), + SALTO_SYSTEMS_SL(0x1269), + SHENZHEN_SHYUGJ_TECHNOLOGY(0x126A), + BRAYDEN_AUTOMATION_CORPORATION(0x126B), + ENVIRONEXUS_PTY_LTD(0x126C), + ELTRA_NV_SA(0x126D), + XIAOMI_COMMUNICATIONS_CO_LTD(0x126E), + SHANGHAI_SHUNCOM_ELECTRONIC_TECHNOLOGY(0x126F), + VOLTALIS_SA(0x1270), + FEELUX_CO_LTD(0x1271), + SMARTPLUS_INC(0x1272), + HALEMEIER_GMBH(0x1273), + TRUST_INTERNATIONAL_BV(0x1274), + DUKE_ENERGY_BUSINESS_SERVICES_LLC(0x1275), + CALIX_INC(0x1276), + ADEO(0x1277), + CONNECTED_RESPONSE_LIMITED(0x1278), + STROYENERGOKOM_LTD(0x1279), + LUMITECH_LIGHTING_SOLUTION_GMBH(0x127A), + VERDANT_ENVIRONMENTAL_TECHNOLOGIES(0x127B), + ALFRED_INTERNATIONAL_INC(0x127C), + ANSI_LED_LIGHTING_CO_LTD(0x127D), + MINDTREE_LIMITED(0x127E), + NORDIC_SEMICONDUCTOR_ASA(0x127F), + SITERWELL_ELECTRONICS_CO_LIMITED(0x1280), + BRILONER_LEUCHTEN_GMBH(0x1281), + SHENZHEN_SEI_TECHNOLOGY_CO_LTD(0x1282), + COPPER_LABS_INC(0x1283), + DELTA_DORE(0x1284), + HAGER_GROUP(0x1285), + SHENZHEN_COOLKIT_TECHNOLOGY_CO_LTD(0x1286), + HANGZHOU_SKY_LIGHTING_CO_LTD(0x1287), + E_ON_SE(0x1288), + LIDL_STIFTUNG_CO_KG(0x1289), + SICHUAN_CHANGHONG_NETWORK_TECHNOLOGIES(0x128A), + NODON(0x128B), + JIANGXI_INNOTECH_TECHNOLOGY_CO_LTD(0x128C), + MERCATOR_PTY_LTD(0x128D), + BEIJING_RUYING_TECH_LIMITED(0x128E), + EGLO_LEUCHTEN_GMBH(0x128F), + PIETRO_FIORENTINI_SPA(0x1290), + ZEHNDER_GROUP_VAUX_ANDIGNY(0x1291), + BRK_BRANDS_INC(0x1292), + ASKEY_COMPUTER_CORP(0x1293), + PASSIVEBOLT_INC(0x1294), + AVM_AUDIOVISUELLES_MARKETING_UND_COMPUTERSYSTEME_BERLIN(0x1295), + NINGBO_SUNTECH_LIGHTING_TECHNOLOGY_CO_LTD(0x1296), + SOCIETE_EN_COMMANDITE_STELLO(0x1297), + VIVINT_SMART_HOME(0x1298), + NAMRON_AS(0x1299), + RADEMACHER_GERATE_ELEKTRONIK_GMBH(0x129A), + OMO_SYSTEMS_LTD(0x129B), + SIGLIS_AG(0x129C), + IMHOTEP_CREATION(0x129D), + ICASA(0x129E), + LEVEL_HOME_INC(0x129F), + TIS_CONTROL_LIMITED(0x1300), + RADISYS_INDIA_PVT_LTD(0x1301), + VEEA_INC(0x1302), + FELL_TECHNOLOGY_AS(0x1303), + SOWILO_DESIGN_SERVICES_LTD(0x1304), + LEXI_DEVICES_INC(0x1305), + LIFI_LABS_INC_DBA_LIFX(0x1306), + GRUNDFOS_HOLDING_AS(0x1307), + SOURCING_AND_CREATION(0x1308), + KRAKEN_TECHNOLOGIES_LTD(0x1309), + EVE_SYSTEMS(0x130A), + LITE_ON_TECHNOLOGY_CORPORATION(0x130B), + FOCALCREST_LIMITED(0x130C), + BOUFFALO_LAB_NANJING_CO_LTD(0x130D), + WYZE_LABS_INC(0x130E), + Z_WAVE_EUROPE_GMBH(0x130F), + AEOTEC_LIMITED(0x1310), + NGSTB_COMPANY_LIMITED(0x1311), + QINGDAO_YEELINK_INFORMATION_TECHNOLOGY_CO_LTD(0x1312), + E_SMART_HOME_AUTOMATION_SYSTEMS_LIMITED(0x1313), + FIBAR_GROUP_SA(0x1314), + PROLITECH_GMBH(0x1315), + PANKORE_INTEGRATED_CIRCUIT_TECHNOLOGY_CO_LTD(0x1316), + LOGITECH(0x1317), + PIARO_INC(0x1318), + MITSUBISHI_ELECTRIC_US_INC(0x1319), + RESIDEO_TECHNOLOGIES_INC(0x131A), + ESPRESSIF_SYSTEMS_SHANGHAI_CO_LTD(0x131B), + HELLA_SONNEN_UND_WETTERSCHUTZTECHNIK_GMBH(0x131C), + GEBERIT_INTERNATIONAL_AG(0x131D), + CAME_SPA(0x131E), + GUANGZHOU_ELITE_EDUCATION_AND_TECHNOLOGY_CO_LTD(0x131F), + PHYPLUS_MICROELECTRONICS_LIMITED(0x1320), + SHENZHEN_SONOFF_TECHNOLOGIES_CO_LTD(0x1321), + SAFE4_SECURITY_GROUP(0x1322), + SHANGHAI_MXCHIP_INFORMATION_TECHNOLOGY_CO_LTD(0x1323), + HDC_I_CONTROLS(0x1324), + ZUMA_ARRAY_LIMITED(0x1325), + DECELECT(0x1326), + MILL_INTERNATIONAL_AS(0x1327), + HOMEWIZARD_BV(0x1328), + SHENZHEN_TOPBAND_CO(0x1329), + PRESSAC_COMMUNICATIONS_LTD(0x132A), + ORIGIN_WIRELESS_INC(0x132B), + CONNECTE_AS(0x132C), + YOKIS(0x132D), + XIAMEN_YANKON_ENERGETIC_LIGHTING_CO(0x132E), + YANDEX_LLC(0x132F), + CRITICAL_SOFTWARE_SA(0x1330), + NORTEK_CONTROL(0x1331), + BRIGHTAI(0x1332), + BECKER_ANTRIEBE_GMBH(0x1333), + SHENZHEN_TCL_NEW_TECHNOLOGY_COMPANY_LIMITED(0x1334), + DEXATEK_TECHNOLOGY_LTD(0x1335), + ELELABS_INTERNATIONAL_LIMITED(0x1336), + DATEK_WIRELESS_AS(0x1337), + ALDES(0x1338), + SAVANT_COMPANY(0x1339), + ARISTON_THERMO_GROUP(0x133A), + WAREMA_RENKHOFF_SE(0x133B), + VTECH_HOLDINGS_LIMITED(0x133C), + FUTUREHOME_AS(0x133D), + COGNITIVE_SYSTEMS_CORP(0x133E), + ASR_MICROELECTRONICS_SHENZHEN_CO(0x133F), + AIRIOS(0x1340), + GUANGDONG_OPPO_MOBILE_TELECOMMUNICATIONS_CORP(0x1341), + BEKEN_CORPORATION(0x1342), + CORSAIR(0x1343), + ELTAKO_GMBH(0x1344), + CHENGDU_MEROSS_TECHNOLOGY_CO(0x1345), + RAFAEL_MICROELECTRONICS_INC(0x1346), + AUG_WINKHUAS_GMBH_AND_CO_KG(0x1347), + QINGDAO_HAIER_TECHNOLOGY_CO(0x1348), + APPLE_INC(0x1349), + ROLLEASE_ACME(0x134A), + NABU_CASA_INC(0x134B), + SIMON_HOLDING(0x134C), + KD_NAVIEN(0x134D), + TADO_GMBH(0x134E), + MEDIOLA_CONNECTED_LIVING_AG(0x134F), + POLYNHOME(0x1350), + HOORII_TECHNOLOGY_CO(0x1351), + KIMIN_ELECTRONICS_CO(0x1353), + ZYAX_AB(0x1354), + BARACODA_SA(0x1355), + LENNOX_INTERNATIONAL_INC(0x1356), + TELEDACTICS_INCORPORATED(0x1357), + TOP_VICTORY_INVESTMENTS_LIMITED(0x1358), + GOQUAL_INC(0x1359), + SIEGENIA_AUBI_KG(0x135A), + VIRTUAL_CONNECTED_CONTROLLING_SYSTEM_SINGAPORE_PTE_LTD(0x135B), + GIGASET_COMMUNICATIONS_GMBH(0x135C), + NUKI_HOME_SOLUTIONS_GMBH(0x135D), + DEVICEBOOK_INC(0x135E), + CONSUMER_2_INC_RENTLY(0x135F), + EDISON_LABS_INC_ORRO(0x1360), + INOVELLI(0x1361), + DEVERITEC_GMBH(0x1362), + CHARTER_COMMUNICATIONS(0x1363), + MONOLITHIC_POWER_SYSTEMS_INC(0x1364), + NINGBO_DOOYA_MECHANIC_AND_ELECTRONIC_TECHNOLOGY_CO(0x1365), + SHENZHEN_SDMC_TECHNOLOGY_CO(0x1366), + HP_INC(0x1367), + MUI_LAB_INC(0x1368), + BHTRONICS_SRL(0x1369), + AKUVOX_XIAMEN_NETWORKS_CO(0x136A), + GEWISS_SPA(0x1994), + CLIMAX_TECHNOLOGY_CO(0x2794), + GOOGLE_LLC(0x6006), + CONNECTIVITY_STANDARDS_ALLIANCE_1(0xC5A0), + CONNECTIVITY_STANDARDS_ALLIANCE_2(0xC5A1), + CONNECTIVITY_STANDARDS_ALLIANCE_3(0xC5A2), + CONNECTIVITY_STANDARDS_ALLIANCE_4(0xC5A3), + CONNECTIVITY_STANDARDS_ALLIANCE_5(0xC5A4), + CONNECTIVITY_STANDARDS_ALLIANCE_6(0xC5A5), + CONNECTIVITY_STANDARDS_ALLIANCE_7(0xC5A6), + CONNECTIVITY_STANDARDS_ALLIANCE_8(0xC5A7), + CONNECTIVITY_STANDARDS_ALLIANCE_9(0xC5A8), + CONNECTIVITY_STANDARDS_ALLIANCE_10(0xC5A9), + CONNECTIVITY_STANDARDS_ALLIANCE_11(0xC5AA), + CONNECTIVITY_STANDARDS_ALLIANCE_12(0xC5AB), + CONNECTIVITY_STANDARDS_ALLIANCE_13(0xC5AC), + CONNECTIVITY_STANDARDS_ALLIANCE_14(0xC5AD), + CONNECTIVITY_STANDARDS_ALLIANCE_15(0xC5AE), + CONNECTIVITY_STANDARDS_ALLIANCE_16(0xC5AF), + TESTVENDOR1(0xFFF1), + TESTVENDOR2(0xFFF2), + TESTVENDOR3(0xFFF3), + TESTVENDOR4(0xFFF4), + } + init { optionalQRCodeInfo = HashMap() } @@ -81,4 +833,78 @@ class OnboardingPayload( fun addOptionalQRCodeInfo(info: OptionalQRCodeInfo) { optionalQRCodeInfo[info.tag] = info } + + fun isValidManualCode(): Boolean { + if (setupPinCode >= (1 shl kSetupPINCodeFieldLengthInBits)) { + return false + } + + return checkPayloadCommonConstraints() + } + + fun getShortDiscriminatorValue(): Int { + if (hasShortDiscriminator) { + return discriminator + } + return longToShortValue(discriminator) + } + + private fun checkPayloadCommonConstraints(): Boolean { + if (version != 0) { + return false + } + + if (!isValidSetupPIN(setupPinCode.toInt())) { + return false + } + + if (!isVendorIdValidOperationally(vendorId) && vendorId != VendorId.UNSPECIFIED.value) { + return false + } + + if (productId == 0 && vendorId != VendorId.UNSPECIFIED.value) { + return false + } + + return true + } + + private fun isVendorIdValidOperationally(vendorId: Int): Boolean { + return vendorId != VendorId.UNSPECIFIED.value && vendorId <= VendorId.TESTVENDOR4.value + } + + companion object { + private fun isValidSetupPIN(setupPIN: Int): Boolean { + return (setupPIN != kSetupPINCodeUndefinedValue && setupPIN <= kSetupPINCodeMaximumValue && + setupPIN != 11111111 && setupPIN != 22222222 && setupPIN != 33333333 && + setupPIN != 44444444 && setupPIN != 55555555 && setupPIN != 66666666 && + setupPIN != 77777777 && setupPIN != 88888888 && setupPIN != 12345678 && + setupPIN != 87654321) + } + + private fun longToShortValue(longValue: Int): Int { + return (longValue shr (kDiscriminatorLongBits - kDiscriminatorShortBits)) + } + } +} + +class UnrecognizedQrCodeException(qrCode: String) : + Exception(String.format("Invalid QR code string: %s", qrCode), null) { + companion object { + private const val serialVersionUID = 1L + } +} + +class InvalidManualPairingCodeFormatException(entryCode: String) : + Exception(String.format("Invalid format for entry code string: %s", entryCode), null) { + companion object { + private const val serialVersionUID = 1L + } +} + +class OnboardingPayloadException(message: String) : + Exception(String.format("Failed to encode Onboarding payload to buffer: %s", message)) { + companion object { + private const val serialVersionUID = 1L + } } diff --git a/src/controller/java/src/chip/onboardingpayload/OnboardingPayloadParser.kt b/src/controller/java/src/chip/onboardingpayload/OnboardingPayloadParser.kt index 45056bb8d6348c..8e428639fc7d9f 100644 --- a/src/controller/java/src/chip/onboardingpayload/OnboardingPayloadParser.kt +++ b/src/controller/java/src/chip/onboardingpayload/OnboardingPayloadParser.kt @@ -46,6 +46,21 @@ class OnboardingPayloadParser { return fetchPayloadFromQrCode(qrCodeString, skipPayloadValidation) } + /** Get QR code string from [OnboardingPayload]. */ + @Throws(OnboardingPayloadException::class) + external fun getQrCodeFromPayload(payload: OnboardingPayload): String + + @Throws(UnrecognizedQrCodeException::class, OnboardingPayloadException::class) + private external fun fetchPayloadFromQrCode( + qrCodeString: String, skipPayloadValidation: Boolean + ): OnboardingPayload + + /** Get Manual Pairing Code string from [OnboardingPayload]. */ + @Throws(OnboardingPayloadException::class) + fun getManualPairingCodeFromPayload(payload: OnboardingPayload): String { + return ManualOnboardingPayloadGenerator(payload).payloadDecimalStringRepresentation() + } + /** * Returns [OnboardingPayload] parsed from the Manual Pairing Code string. If an SetupPINCode has * invalid value, OnboardingPayloadException occurs. Refer to [OnboardingPayload] for the description @@ -70,44 +85,19 @@ class OnboardingPayloadParser { return parsePayloadFromManualPairingCode(manualPairingCodeString, skipPayloadValidation) } - /** Get QR code string from [OnboardingPayload]. */ - @Throws(OnboardingPayloadException::class) - external fun getQrCodeFromPayload(payload: OnboardingPayload): String - - /** Get Manual Pairing Code string from [OnboardingPayload]. */ - @Throws(OnboardingPayloadException::class) - external fun getManualPairingCodeFromPayload(payload: OnboardingPayload): String - - @Throws(UnrecognizedQrCodeException::class, OnboardingPayloadException::class) - private external fun fetchPayloadFromQrCode( - qrCodeString: String, skipPayloadValidation: Boolean - ): OnboardingPayload - @Throws(InvalidManualPairingCodeFormatException::class, OnboardingPayloadException::class) - private external fun parsePayloadFromManualPairingCode( + private fun parsePayloadFromManualPairingCode( manualPairingCodeString: String, skipPayloadValidation: Boolean - ): OnboardingPayload + ): OnboardingPayload { + val payload = OnboardingPayload() + ManualOnboardingPayloadParser(manualPairingCodeString).populatePayload(payload) - class UnrecognizedQrCodeException(qrCode: String) : - Exception(String.format("Invalid QR code string: %s", qrCode), null) { - companion object { - private const val serialVersionUID = 1L + if (skipPayloadValidation == false && !payload.isValidManualCode()) { + throw OnboardingPayloadException("Invalid manual entry code") } - } - class InvalidManualPairingCodeFormatException(manualPairingCode: String) : - Exception(String.format("Invalid format for manual pairing code string: %s", manualPairingCode), null) { - companion object { - private const val serialVersionUID = 1L - } - } - - class OnboardingPayloadException(var errorCode: Int, message: String?) : - Exception(message ?: String.format("Error Code %d", errorCode)) { - companion object { - private const val serialVersionUID = 1L - } - } + return payload + } companion object { private val LOGGER: Logger = Logger.getLogger(OnboardingPayloadParser::class.java.getSimpleName()) diff --git a/src/controller/java/src/chip/onboardingpayload/Verhoeff.kt b/src/controller/java/src/chip/onboardingpayload/Verhoeff.kt new file mode 100644 index 00000000000000..eed7000ab0ca8a --- /dev/null +++ b/src/controller/java/src/chip/onboardingpayload/Verhoeff.kt @@ -0,0 +1,49 @@ +/* + * + * Copyright (c) 2023 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. + */ + +package chip.onboardingpayload + +class Verhoeff { + companion object { + fun dihedralMultiply(x: Int, y: Int, n: Int): Int { + val n2 = n * 2 + var newX = x % n2 + var newY = y % n2 + if (newX < n) { + if (newY < n) + return (newX + newY) % n + return ((newX + (newY - n)) % n) + n + } + if (newY < n) + return ((n + (newX - n) - newY) % n) + n + return (n + (newX - n) - (newY - n)) % n + } + + fun dihedralInvert(value: Int, n: Int): Int { + if (value > 0 && value < n) + return n - value + return value + } + + fun permute(value: Int, permTable: ByteArray, permTableLen: Int, iterCount: Int): Int { + var newValue = value % permTableLen + if (iterCount == 0) + return newValue + return permute(permTable[newValue].toInt(), permTable, permTableLen, iterCount - 1) + } + } +} \ No newline at end of file diff --git a/src/controller/java/src/chip/onboardingpayload/Verhoeff10.kt b/src/controller/java/src/chip/onboardingpayload/Verhoeff10.kt new file mode 100644 index 00000000000000..37b89efaef8a61 --- /dev/null +++ b/src/controller/java/src/chip/onboardingpayload/Verhoeff10.kt @@ -0,0 +1,93 @@ +/* + * + * Copyright (c) 2023 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. + */ + +package chip.onboardingpayload + +/** + * Implements Verhoeff's check-digit algorithm for base-10 strings. + */ +class Verhoeff10 { + companion object { + const val Base = 10 + const val PolygonSize = 5 + + val sMultiplyTable = intArrayOf( + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 0, 6, 7, 8, 9, 5, 2, 3, 4, 0, 1, 7, 8, 9, 5, 6, 3, 4, 0, 1, + 2, 8, 9, 5, 6, 7, 4, 0, 1, 2, 3, 9, 5, 6, 7, 8, 5, 9, 8, 7, 6, 0, 4, 3, 2, 1, 6, 5, 9, 8, 7, 1, 0, 4, + 3, 2, 7, 6, 5, 9, 8, 2, 1, 0, 4, 3, 8, 7, 6, 5, 9, 3, 2, 1, 0, 4, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 + ) + + // Permutation table for the algorithm. + val sPermTable = byteArrayOf(1, 5, 7, 6, 2, 8, 3, 0, 9, 4) + + // Compute a check character for a given string. + fun computeCheckChar(str: String): Char { + return computeCheckChar(str, str.length) + } + + fun computeCheckChar(str: String, strLen: Int): Char { + var c = 0 + for (i in 1..strLen) { + val ch = str[strLen - i] + val value = charToVal(ch) + val p = Verhoeff.permute(value, sPermTable, Base, i) + c = sMultiplyTable[c * Base + p] + } + c = Verhoeff.dihedralInvert(c, PolygonSize) + return valToChar(c) + } + + // Verify a check character against a given string. + fun validateCheckChar(checkChar: Char, str: String): Boolean { + return validateCheckChar(checkChar, str, str.length) + } + + fun validateCheckChar(checkChar: Char, str: String, strLen: Int): Boolean { + return computeCheckChar(str, strLen) == checkChar + } + + // Verify a check character at the end of a given string. + fun validateCheckChar(str: String): Boolean { + return validateCheckChar(str, str.length) + } + + fun validateCheckChar(str: String, strLen: Int): Boolean { + if (strLen == 0) + return false + return validateCheckChar(str[strLen - 1], str, strLen - 1) + } + + // Convert between a character and its corresponding value. + fun charToVal(ch: Char): Int { + if (ch in '0'..'9') { + return ch - '0' + } else { + throw IllegalArgumentException("Input character must be a digit") + } + } + + private fun valToChar(value: Int): Char { + if (value in 0..Base) { + return ('0'.code + value).toChar() + } else { + throw IllegalArgumentException("Input value must be a digit") + } + } + } + + private constructor() +} diff --git a/src/controller/java/zap-generated/CHIPClientCallbacks.h b/src/controller/java/zap-generated/CHIPClientCallbacks.h index 05462d7f837b21..bdaa258a384bf1 100644 --- a/src/controller/java/zap-generated/CHIPClientCallbacks.h +++ b/src/controller/java/zap-generated/CHIPClientCallbacks.h @@ -241,8 +241,8 @@ typedef void (*GeneralCommissioningAttributeListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*NetworkCommissioningNetworksListAttributeCallback)( void * context, - const chip::app::DataModel::DecodableList & - data); + const chip::app::DataModel::DecodableList< + chip::app::Clusters::NetworkCommissioning::Structs::NetworkInfoStruct::DecodableType> & data); typedef void (*NetworkCommissioningGeneratedCommandListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*NetworkCommissioningAcceptedCommandListListAttributeCallback)( diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index 5b2b3a01759ec4..39d4fa58647ce3 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -198,6 +198,7 @@ PyChipError pychip_GetConnectedDeviceByNodeId(chip::Controller::DeviceCommission PyChipError pychip_FreeOperationalDeviceProxy(chip::OperationalDeviceProxy * deviceProxy); PyChipError pychip_GetLocalSessionId(chip::OperationalDeviceProxy * deviceProxy, uint16_t * localSessionId); PyChipError pychip_GetNumSessionsToPeer(chip::OperationalDeviceProxy * deviceProxy, uint32_t * numSessions); +PyChipError pychip_GetAttestationChallenge(chip::OperationalDeviceProxy * deviceProxy, uint8_t * buf, size_t * size); PyChipError pychip_GetDeviceBeingCommissioned(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId, CommissioneeDeviceProxy ** proxy); PyChipError pychip_ExpireSessions(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId); @@ -713,6 +714,19 @@ PyChipError pychip_GetNumSessionsToPeer(chip::OperationalDeviceProxy * devicePro return ToPyChipError(CHIP_NO_ERROR); } +PyChipError pychip_GetAttestationChallenge(chip::OperationalDeviceProxy * deviceProxy, uint8_t * buf, size_t * size) +{ + VerifyOrReturnError(deviceProxy->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION)); + VerifyOrReturnError(buf != nullptr, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT)); + + ByteSpan challenge = deviceProxy->GetSecureSession().Value()->AsSecureSession()->GetCryptoContext().GetAttestationChallenge(); + VerifyOrReturnError(challenge.size() <= *size, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT)); + memcpy(buf, challenge.data(), challenge.size()); + *size = challenge.size(); + + return ToPyChipError(CHIP_NO_ERROR); +} + PyChipError pychip_GetDeviceBeingCommissioned(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId, CommissioneeDeviceProxy ** proxy) { diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index e41bb4257434bc..7982e3f644911c 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -201,6 +201,23 @@ def numTotalSessions(self) -> int: return numSessions.value + @property + def attestationChallenge(self) -> bytes: + self._dmLib.pychip_GetAttestationChallenge.argtypes = (c_void_p, POINTER(c_uint8), POINTER(c_size_t)) + self._dmLib.pychip_GetAttestationChallenge.restype = PyChipError + + # this buffer is overly large, but we shall resize + size = 64 + buf = ctypes.c_uint8(size) + csize = ctypes.c_size_t(size) + builtins.chipStack.Call( + lambda: self._dmLib.pychip_GetAttestationChallenge(self._deviceProxy, buf, ctypes.byref(csize)) + ).raise_on_error() + + resize(buf, csize.value) + + return bytes(buf) + DiscoveryFilterType = discovery.FilterType diff --git a/src/python_testing/TC_DA_1_2.py b/src/python_testing/TC_DA_1_2.py new file mode 100644 index 00000000000000..2140330be3ca97 --- /dev/null +++ b/src/python_testing/TC_DA_1_2.py @@ -0,0 +1,391 @@ +# +# Copyright (c) 2023 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. +# + +import os +import random + +import chip.clusters as Clusters +from chip.interaction_model import InteractionModelError, Status +from chip.tlv import TLVReader +from cryptography import x509 +from cryptography.exceptions import InvalidSignature +from cryptography.hazmat._oid import ExtensionOID +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.asymmetric import ec, utils +from ecdsa.curves import curve_by_name +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, hex_from_bytes, type_matches +from mobly import asserts +from pyasn1.codec.der.decoder import decode as der_decoder +from pyasn1.error import PyAsn1Error +from pyasn1.type import univ +from pyasn1_modules import rfc5652 + + +def get_value_for_oid(oid_dotted_str: str, cert: x509.Certificate) -> str: + rdn = list(filter(lambda rdn: oid_dotted_str in rdn.oid.dotted_string, cert.subject)) + if len(rdn) != 1: + return None + + return rdn[0].value.strip() + + +def parse_ids_from_subject(cert: x509.Certificate) -> tuple([str, str]): + vid_str = get_value_for_oid('1.3.6.1.4.1.37244.2.1', cert) + pid_str = get_value_for_oid('1.3.6.1.4.1.37244.2.2', cert) + + return vid_str, pid_str + + +def parse_single_vidpid_from_common_name(commonName: str, tag_str: str) -> str: + sp = commonName.split(tag_str) + if (len(sp)) != 2: + return None + + s = sp[1][:4] + if not s.isupper() or len(s) != 4: + return None + + return s + + +def parse_ids_from_common_name(cert: x509.Certificate) -> tuple([str, str]): + common = get_value_for_oid('2.5.4.3', cert) + vid_str = parse_single_vidpid_from_common_name(common, 'Mvid:') + pid_str = parse_single_vidpid_from_common_name(common, 'Mpid:') + + return vid_str, pid_str + + +def parse_ids_from_certs(dac: x509.Certificate, pai: x509.Certificate) -> tuple([int, int, int, int]): + dac_vid_str, dac_pid_str = parse_ids_from_subject(dac) + pai_vid_str, pai_pid_str = parse_ids_from_subject(pai) + + # Fallback methods - parse from commonName + if dac_vid_str is None and dac_pid_str is None: + dac_vid_str, dac_pid_str = parse_ids_from_common_name(dac) + + if pai_vid_str is None and pai_pid_str is None: + pai_vid_str, pai_pid_str = parse_ids_from_common_name(pai) + + # PID is not required in the PAI + asserts.assert_true(dac_vid_str is not None, "VID must be present in the DAC") + asserts.assert_true(dac_pid_str is not None, "PID must be present in the DAC") + asserts.assert_true(pai_vid_str is not None, "VID must be present in the PAI") + + dac_vid = int(dac_vid_str, 16) + dac_pid = int(dac_pid_str, 16) + pai_vid = int(pai_vid_str, 16) + if pai_pid_str: + pai_pid = int(pai_pid_str, 16) + else: + pai_pid = None + + return dac_vid, dac_pid, pai_vid, pai_pid + + +class TC_DA_1_2(MatterBaseTest): + @async_test_body + async def test_TC_DA_1_2(self): + is_ci = self.check_pics('PICS_SDK_CI_ONLY') + # These PICS will be ignored on the CI because we're going to test a bunch of combos + pics_origin_pid = self.check_pics('MCORE.DA.CERTDECL_ORIGIN_PRODUCTID') + pics_origin_vid = self.check_pics('MCORE.DA.CERTDECL_ORIGIN_VENDORID') + pics_paa_list = self.check_pics('MCORE.DA.CERTDECL_AUTH_PAA') + pics_firmware_info = self.check_pics('MCORE.DA.ATTESTELEMENT_FW_INFO') + if pics_origin_pid != pics_origin_vid: + asserts.fail("MCORE.DA.CERTDECL_ORIGIN_PRODUCTID and MCORE.DA.CERTDECL_ORIGIN_VENDORID PICS codes must match") + + self.print_step(0, "Commissioning, already done") + + opcreds = Clusters.Objects.OperationalCredentials + basic = Clusters.Objects.BasicInformation + + self.print_step(1, "Generate 32-byte nonce") + nonce = random.randbytes(32) + + self.print_step(2, "Send AttestationRequest") + attestation_resp = await self.send_single_cmd(cmd=opcreds.Commands.AttestationRequest(attestationNonce=nonce)) + + self.print_step("3a", "Verify AttestationResponse is correct type") + asserts.assert_true(type_matches(attestation_resp, opcreds.Commands.AttestationResponse), + "DUT returned invalid response to AttestationRequest") + + self.print_step("3b", "Send CertificateChainRequest for DAC") + type = opcreds.Enums.CertificateChainTypeEnum.kDACCertificate + dac_resp = await self.send_single_cmd(cmd=opcreds.Commands.CertificateChainRequest(certificateType=type)) + + self.print_step("3c", "Verify DAC is x509v3 and <= 600 bytes") + asserts.assert_true(type_matches(dac_resp, opcreds.Commands.CertificateChainResponse), + "DUT returned invalid response to CertificateChainRequest") + der_dac = dac_resp.certificate + asserts.assert_less_equal(len(der_dac), 600, "Returned DAC is > 600 bytes") + # This throws an exception for a non-x509 cert + try: + parsed_dac = x509.load_der_x509_certificate(der_dac) + except ValueError: + asserts.assert_true(False, "Unable to parse certificate from CertificateChainResponse") + asserts.assert_equal(parsed_dac.version, x509.Version.v3, "DUT returned incorrect certificate type") + + self.print_step("3d", "Send CertificateChainRequest for PAI and verifies PAI is x509v3 and <= 600 bytes") + type = opcreds.Enums.CertificateChainTypeEnum.kPAICertificate + pai_resp = await self.send_single_cmd(cmd=opcreds.Commands.CertificateChainRequest(certificateType=type)) + asserts.assert_true(type_matches(pai_resp, opcreds.Commands.CertificateChainResponse), + "DUT returned invalid response to CertificateChainRequest") + der_pai = pai_resp.certificate + asserts.assert_less_equal(len(der_pai), 600, "Returned PAI is > 600 bytes") + # This throws an exception for a non-x509 cert + try: + parsed_pai = x509.load_der_x509_certificate(der_pai) + except ValueError: + asserts.assert_true(False, "Unable to parse certificate from CertificateChainResponse") + asserts.assert_equal(parsed_pai.version, x509.Version.v3, "DUT returned incorrect certificate type") + + self.print_step("3e", "TH1 saves PAI") + # already saved above + + self.print_step("4a", "Read VendorID from basic info") + basic_info_vendor_id = await self.read_single_attribute_check_success(basic, basic.Attributes.VendorID) + + self.print_step("4b", "Read ProductID from basic info") + basic_info_product_id = await self.read_single_attribute_check_success(basic, basic.Attributes.ProductID) + + self.print_step(5, "Extract the attestation_elements_message") + elements = attestation_resp.attestationElements + + self.print_step(6, "Verify the AttestationResponse has the following fields") + # OK, it's a bit weird that we're doing this after extracting the elements already, but sure. + # We type checked earlier, but let's grab the signature here. + signature_attestation_raw = attestation_resp.attestationSignature + + self.print_step(7, "Read the attestation_elements_message structure fields") + # Already done + + self.print_step(8, "Verify that the attestation_elements_message structure fields satisfy the following conditions") + # Not sure why this is a separate step, but I'm ready...let's check. + + self.print_step("8.1", "Verify attestation elements size is < = 900 bytes") + asserts.assert_less_equal(len(elements), 900, "AttestationElements field is more than 900 bytes") + + self.print_step("8.2", "Verify certification declaration is present and follows spec format") + decoded = TLVReader(elements).get()["Any"] + # Certification declaration is tag 1 + asserts.assert_in(1, decoded.keys(), "CD is not present in the attestation elements") + cd_der = decoded[1] + + try: + temp, _ = der_decoder(cd_der, asn1Spec=rfc5652.ContentInfo()) + except PyAsn1Error: + asserts.fail("Unable to decode CD - improperly encoded DER") + + # turn this into a dict so I don't have to keep parsing tuples + layer1 = dict(temp) + + id_sha256 = univ.ObjectIdentifier('2.16.840.1.101.3.4.2.1') + + asserts.assert_equal(layer1['contentType'], rfc5652.id_signedData, "Incorrect object type") + + # uh, is this actually right? Doesn't the spec say enveloped data? + temp, _ = der_decoder(layer1['content'].asOctets(), asn1Spec=rfc5652.SignedData()) + + signed_data = dict(temp) + + asserts.assert_equal(signed_data['version'], 3, "Signed data version is not 3") + asserts.assert_equal(len(signed_data['digestAlgorithms']), 1, "More than one digest algorithm listed") + + # DigestAlgorithmIdentifier + algo_id = dict(signed_data['digestAlgorithms'][0]) + asserts.assert_equal(algo_id['algorithm'], id_sha256, "Reported digest algorithm is not SHA256") + + encap_content_info = dict(signed_data['encapContentInfo']) + + id_pkcs7_data = univ.ObjectIdentifier('1.2.840.113549.1.7.1') + asserts.assert_equal(encap_content_info['eContentType'], id_pkcs7_data, "Incorrect encapsulated content type") + + cd_tlv = bytes(encap_content_info['eContent']) + + # Check the signer info + # There should be only one signer info + asserts.assert_equal(len(signed_data['signerInfos']), 1, "Too many signer infos provided") + + # version shoule be 3 + signer_info = dict(signed_data['signerInfos'][0]) + asserts.assert_equal(signer_info['version'], 3, "Incorrect version on signer info") + + # subject key identifier needs to match the connectivity standards aliance key + subject_key_identifier = bytes(dict(signer_info['sid'])['subjectKeyIdentifier']) + + # digest algorithm is sha256, only one allowed + algo_id = dict(signer_info['digestAlgorithm']) + asserts.assert_equal(algo_id['algorithm'], id_sha256, "Incorrect digest algorithm for the signer info") + + # signature algorithm is ecdsa-with-sha256 + id_ecdsa_with_sha256 = univ.ObjectIdentifier('1.2.840.10045.4.3.2') + algo_id = dict(signer_info['signatureAlgorithm']) + asserts.assert_equal(algo_id['algorithm'], id_ecdsa_with_sha256, "Incorrect signature algorithm") + + self.print_step("8.3", "Verify mandatory cd contents") + # First, lets parse it + cd = TLVReader(cd_tlv).get()["Any"] + format_version = cd[0] + vendor_id = cd[1] + product_id_array = cd[2] + device_type_id = cd[3] + certificate_id = cd[4] + security_level = cd[5] + security_info = cd[6] + version_number = cd[7] + certification_type = cd[8] + + asserts.assert_equal(format_version, 1, "Format version is incorrect") + asserts.assert_equal(vendor_id, basic_info_vendor_id, "Vendor ID is incorrect") + if not is_ci: + asserts.assert_in(vendor_id, range(1, 0xfff0), "Vendor ID is out of range") + asserts.assert_true(basic_info_product_id in product_id_array, "Product ID not found in CD product array") + asserts.assert_in(device_type_id, range(0, (2**31)-1), "Device type ID is out of range") + asserts.assert_equal(len(certificate_id), 19, "Certificate id is the incorrect length") + asserts.assert_equal(security_level, 0, "Incorrect value for security level") + asserts.assert_equal(security_info, 0, "Incorrect value for security information") + asserts.assert_in(version_number, range(0, 65535), "Version number out of range") + if is_ci: + asserts.assert_in(certification_type, [0, 1, 2], "Certification type is out of range") + else: + asserts.assert_in(certification_type, [1, 2], "Certification type is out of range") + + self.print_step("8.4", "Confirm that both dac_origin_vendor_id and dac_origin_product_id are present") + if not is_ci and pics_origin_vid: + asserts.assert_in(9, cd.keys(), "Origin vendor ID not found in cert") + asserts.assert_in(10, cd.keys(), "Origin product ID not found in cert") + + self.print_step("8.5", "Confirm that neither dac_origin_vendor_id nor dac_origin_product_id are present") + if not is_ci and not pics_origin_vid: + asserts.assert_not_in(9, cd.keys(), "Origin vendor ID found in cert") + asserts.assert_not_in(10, cd.keys(), "Origin product ID found in cert") + + dac_vid, dac_pid, pai_vid, pai_pid = parse_ids_from_certs(parsed_dac, parsed_pai) + + self.print_step("8.6", "Check origin PID/VID against DAC and PAI") + has_origin_vid = 9 in cd.keys() + has_origin_pid = 10 in cd.keys() + if not is_ci and has_origin_vid != pics_origin_vid: + asserts.fail("Origin VID in CD does not match PICS") + if not is_ci and has_origin_pid and not pics_origin_pid: + asserts.fail("Origin PID in CD does not match PICS") + if has_origin_pid != has_origin_vid: + asserts.fail("Found one of origin PID or VID in CD but not both") + + # If this is the CI, ignore the PICS, we're going to try many cases. + if has_origin_vid: + origin_vid = cd[9] + origin_pid = cd[10] + + asserts.assert_equal(dac_vid, origin_vid, "Origin Vendor ID in the CD does not match the Vendor ID in the DAC") + asserts.assert_equal(pai_vid, origin_vid, "Origin Vendor ID in the CD does not match the Vendor ID in the PAI") + asserts.assert_equal(dac_pid, origin_pid, "Origin Product ID in the CD does not match the Product ID in the DAC") + if pai_pid: + asserts.assert_equal(pai_pid, origin_pid, "Origin Product ID in the CD does not match the Product ID in the PAI") + + self.print_step("8.7", "Check CD PID/VID against DAC and PAI") + if not has_origin_vid: + asserts.assert_equal(dac_vid, vendor_id, "Vendor ID in the CD does not match the Vendor ID in the DAC") + asserts.assert_equal(pai_vid, vendor_id, "Vendor ID in the CD does not match the Vendor ID in the PAI") + asserts.assert_in(dac_pid, product_id_array, "Product ID from the DAC is not present in the PID list in the CD") + if pai_pid: + asserts.assert_in(pai_pid, product_id_array, "Product ID from the PAI is not present in the PID list in the CD") + + self.print_step("8.8", "Check PAAs") + has_paa_list = 11 in cd.keys() + if not is_ci and pics_paa_list != has_paa_list: + asserts.fail("PAA list does not match PICS") + + if has_paa_list: + akids = [ext.value.key_identifier for ext in parsed_pai.extensions if ext.oid == ExtensionOID.AUTHORITY_KEY_IDENTIFIER] + asserts.assert_equal(len(akids), 1, "PAI requires exactly one AuthorityKeyIdentifier") + paa_authority_list = cd[11] + asserts.assert_in(akids[0], paa_authority_list, "PAI AKID not found in the authority list") + + self.print_step("8.9", "Check signature") + signature_cd = bytes(signer_info['signature']) + # TODO: Cecille - this path needs to be set as an input + cert_dir = 'credentials/development/cd-certs' + certs = {} + for filename in os.listdir(cert_dir): + if '.der' not in filename: + continue + with open(os.path.join(cert_dir, filename), 'rb') as f: + cert = x509.load_der_x509_certificate(f.read()) + pub = cert.public_key() + ski = x509.SubjectKeyIdentifier.from_public_key(pub).digest + certs[ski] = pub + + asserts.assert_true(subject_key_identifier in certs.keys(), "Subject key identifier not found in CD certs") + try: + certs[subject_key_identifier].verify(signature=signature_cd, data=cd_tlv, + signature_algorithm=ec.ECDSA(hashes.SHA256())) + except InvalidSignature: + asserts.fail("Failed to verify CD signature against known CD public key") + + self.print_step(9, "Verify nonce") + asserts.assert_in(2, decoded.keys(), "Attestation nonce is not present in the attestation elements") + returned_nonce = decoded[2] + asserts.assert_equal(returned_nonce, nonce, "Returned attestation nonce does not match request nonce") + asserts.assert_equal(len(returned_nonce), 32, "Returned nonce is incorrect size") + + self.print_step(10, "Verify firmware") + has_firmware_information = 4 in decoded.keys() + if not is_ci and has_firmware_information != pics_firmware_info: + asserts.fail("PICS for firmware information does not match returned value") + if has_firmware_information: + try: + int(decoded[4], 16) + except ValueError: + asserts.fail("Firmware is not an octet string") + + self.print_step(11, "Verify that the signature for the attestation response is valid") + proxy = self.default_controller.GetConnectedDeviceSync(self.dut_node_id, False) + asserts.assert_equal(len(proxy.attestationChallenge), 16, "Attestation challenge is the wrong length") + attestation_tbs = elements + proxy.attestationChallenge + + # signature is a struct of r and s - see 3.5.3 + # Actual curve is secp256r1 / NIST P-256 per 2.7 + baselen = curve_by_name("NIST256p").baselen + signature_attestation_raw_r = int(hex_from_bytes(signature_attestation_raw[:baselen]), 16) + signature_attestation_raw_s = int(hex_from_bytes(signature_attestation_raw[baselen:]), 16) + + signature_attestation = utils.encode_dss_signature(signature_attestation_raw_r, signature_attestation_raw_s) + + parsed_dac.public_key().verify(signature=signature_attestation, data=attestation_tbs, + signature_algorithm=ec.ECDSA(hashes.SHA256())) + + self.print_step(12, "Send AttestationRequest with nonce > 32 bytes") + nonce = random.randbytes(33) + try: + await self.send_single_cmd(cmd=opcreds.Commands.AttestationRequest(attestationNonce=nonce)) + asserts.fail("Received Success response when an INVALID_COMMAND was expected") + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.InvalidCommand, "Received incorrect error from AttestationRequest command") + + self.print_step(13, "Send AttestationRequest with nonce < 32 bytes") + nonce = random.randbytes(31) + try: + await self.send_single_cmd(cmd=opcreds.Commands.AttestationRequest(attestationNonce=nonce)) + asserts.fail("Received Success response when an INVALID_COMMAND was expected") + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.InvalidCommand, "Received incorrect error from AttestationRequest command") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_DA_1_5.py b/src/python_testing/TC_DA_1_5.py new file mode 100644 index 00000000000000..f27d2f136e5687 --- /dev/null +++ b/src/python_testing/TC_DA_1_5.py @@ -0,0 +1,211 @@ +# +# Copyright (c) 2023 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. +# +import random + +import chip.clusters as Clusters +from chip import ChipDeviceCtrl +from chip.interaction_model import InteractionModelError, Status +from chip.tlv import TLVReader +from cryptography import x509 +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.asymmetric import ec, utils +from ecdsa.curves import curve_by_name +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, hex_from_bytes, type_matches +from mobly import asserts +from pyasn1.codec.der.decoder import decode as der_decoder +from pyasn1.error import PyAsn1Error +from pyasn1_modules import rfc2986, rfc3279, rfc5480 + + +class TC_DA_1_5(MatterBaseTest): + @async_test_body + async def test_TC_DA_1_5(self): + + opcreds = Clusters.Objects.OperationalCredentials + + gcomm = Clusters.Objects.GeneralCommissioning + + self.print_step(1, "Commissioning, already done") + + self.print_step(2, "Save attestation challenge") + proxy = self.default_controller.GetConnectedDeviceSync(self.dut_node_id, False) + attestation_challenge = proxy.attestationChallenge + + self.print_step(3, "Send CertificateChainRequest for DAC") + certtype = opcreds.Enums.CertificateChainTypeEnum.kDACCertificate + dac_resp = await self.send_single_cmd(cmd=opcreds.Commands.CertificateChainRequest(certificateType=certtype)) + asserts.assert_true(type_matches(dac_resp, opcreds.Commands.CertificateChainResponse), + "Certificate request returned incorrect type") + der_dac = dac_resp.certificate + # This throws an exception for a non-x509 cert + try: + dac = x509.load_der_x509_certificate(der_dac) + except ValueError: + asserts.assert_true(False, "Unable to parse certificate from CertificateChainResponse") + + self.print_step(4, "Send ArmFailSafe") + await self.send_single_cmd(cmd=gcomm.Commands.ArmFailSafe(expiryLengthSeconds=900, breadcrumb=1)) + + self.print_step(5, "Send CSRRequest") + csr_nonce = random.randbytes(32) + csr_resp = await self.send_single_cmd(cmd=opcreds.Commands.CSRRequest(CSRNonce=csr_nonce, isForUpdateNOC=False)) + nocsr_elements = csr_resp.NOCSRElements + nocsr_attestation_signature_raw = csr_resp.attestationSignature + + self.print_step(6, "Extract TLV") + decoded = TLVReader(nocsr_elements).get()["Any"] + # CSR is field 1, nonce is field 2 + asserts.assert_in(1, decoded.keys(), "CSR is not present in the NOSCRElements") + asserts.assert_in(2, decoded.keys(), "Nonce is not present in the NOSCRElements") + csr_raw = decoded[1] + csr_nonce_returned = decoded[2] + vendor1 = None + vendor2 = None + vendor3 = None + if 3 in decoded.keys(): + vendor1 = decoded[3] + if 4 in decoded.keys(): + vendor2 = decoded[4] + if 5 in decoded.keys(): + vendor3 = decoded[5] + + # Verify that length of nocsr_elements is <= 900 + asserts.assert_less_equal(len(nocsr_elements), 900, "NOCSRElements is more than 900 bytes") + + # Verify der encoded and PKCS #10 (rfc2986 is PKCS #10) - next two requirements + try: + temp, _ = der_decoder(csr_raw, asn1Spec=rfc2986.CertificationRequest()) + except PyAsn1Error: + asserts.fail("Unable to decode CSR - improperly formatted DER file") + + layer1 = dict(temp) + info = dict(layer1['certificationRequestInfo']) + + # Verify public key is id-ecPublicKey with prime256v1 + requested_pk_algo = dict(dict(info['subjectPKInfo'])['algorithm']) + asserts.assert_equal(requested_pk_algo['algorithm'], rfc5480.id_ecPublicKey, "Incorrect public key algorithm") + der_parameters = requested_pk_algo['parameters'] + temp, _ = der_decoder(bytes(der_parameters), asn1Spec=rfc3279.EcpkParameters()) + parameters = dict(temp) + asserts.assert_in('namedCurve', parameters.keys(), "Unable to find namedCurve in EcpkParameters") + asserts.assert_equal(parameters['namedCurve'], rfc3279.prime256v1, "Incorrect curve specified for public key algorithm") + + # Verify public key is 256 bytes + csr = x509.load_der_x509_csr(csr_raw) + csr_pubkey = csr.public_key() + asserts.assert_equal(csr_pubkey.key_size, 256, "Incorrect key size") + + # Verify signature algorithm is ecdsa-with-SHA156 + signature_algorithm = dict(layer1['signatureAlgorithm'])['algorithm'] + asserts.assert_equal(signature_algorithm, rfc5480.ecdsa_with_SHA256, "CSR specifies incorrect signature key algorithm") + + # Verify signature is valid + asserts.assert_true(csr.is_signature_valid, "Signature is invalid") + + # Verify csr_nonce_returned is octet string of length 32 + try: + # csr_nonce_returned is an octet string if it can be converted to an int + int(hex_from_bytes(csr_nonce_returned), 16) + except ValueError: + asserts.fail("Returned CSR nonce is not an octet string") + + # Verify returned nonce matches sent nonce + asserts.assert_equal(csr_nonce_returned, csr_nonce, "Returned nonce is incorrect") + + nocsr_tbs = nocsr_elements + attestation_challenge + + self.print_step(7, "Verify signature") + baselen = curve_by_name("NIST256p").baselen + attestation_raw_r = int(hex_from_bytes(nocsr_attestation_signature_raw[:baselen]), 16) + attestation_raw_s = int(hex_from_bytes(nocsr_attestation_signature_raw[baselen:]), 16) + + nocsr_attestation = utils.encode_dss_signature(attestation_raw_r, attestation_raw_s) + + dac.public_key().verify(signature=nocsr_attestation, data=nocsr_tbs, signature_algorithm=ec.ECDSA(hashes.SHA256())) + + self.print_step(8, "Verify that attestation challenge does not appear in the vendor fields") + if vendor1: + asserts.assert_not_in(attestation_challenge, vendor1, "Attestation challenge appears in vendor 1") + if vendor2: + asserts.assert_not_in(attestation_challenge, vendor2, "Attestation challenge appears in vendor 2") + if vendor3: + asserts.assert_not_in(attestation_challenge, vendor3, "Attestation challenge appears in vendor 3") + + self.print_step(9, "Disarm failsafe") + await self.send_single_cmd(cmd=gcomm.Commands.ArmFailSafe(expiryLengthSeconds=0, breadcrumb=1)) + + self.print_step(10, "Arm failsafe to 900s") + await self.send_single_cmd(cmd=gcomm.Commands.ArmFailSafe(expiryLengthSeconds=900, breadcrumb=1)) + + self.print_step(11, "Send CSRRequest wtih 31-byte nonce") + bad_nonce = random.randbytes(32) + try: + await self.send_single_cmd(cmd=opcreds.Commands.CSRRequest(CSRNonce=bad_nonce, isForUpdateNOC=False)) + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.InvalidCommand, "Received incorrect error from CSRRequest command with bad nonce") + + self.print_step(12, "Disarm failsafe") + await self.send_single_cmd(cmd=gcomm.Commands.ArmFailSafe(expiryLengthSeconds=0, breadcrumb=1)) + + self.print_step(13, "Open commissioning window") + pin, _ = self.default_controller.OpenCommissioningWindow( + nodeid=self.dut_node_id, timeout=600, iteration=10000, discriminator=1234, option=1) + + self.print_step(14, "Commission to TH2") + new_certificate_authority = self.certificate_authority_manager.NewCertificateAuthority() + new_fabric_admin = new_certificate_authority.NewFabricAdmin(vendorId=0xFFF1, fabricId=2) + TH2 = new_fabric_admin.NewController(nodeId=112233) + + success, _ = TH2.CommissionOnNetwork( + nodeId=self.dut_node_id, setupPinCode=pin, + filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=1234) + asserts.assert_true(success, 'Commissioning on TH2 did not complete successfully') + + self.print_step(15, "Read NOCs list for TH1") + temp = await self.read_single_attribute_check_success( + cluster=Clusters.OperationalCredentials, + attribute=Clusters.OperationalCredentials.Attributes.NOCs) + asserts.assert_equal(len(temp), 1, "Returned NOC list does not contain one entry") + th1_noc = temp[0].noc + + self.print_step(16, "Read NOCs list for TH2") + temp = await self.read_single_attribute_check_success( + cluster=Clusters.OperationalCredentials, + attribute=Clusters.OperationalCredentials.Attributes.NOCs, dev_ctrl=TH2) + asserts.assert_equal(len(temp), 1, "Returned NOC list does not contain one entry") + th2_noc = temp[0].noc + + self.print_step(17, "Extract the public keys") + # NOCs are TLV encoded, public key is field 9 + th1_decoded = TLVReader(th1_noc).get()["Any"] + th2_decoded = TLVReader(th2_noc).get()["Any"] + + th1_pk = th1_decoded[9] + th2_pk = th2_decoded[9] + asserts.assert_not_equal(th1_pk, th2_pk, "Publc keys are the same") + + self.print_step(17, "Read the fabric index for TH2") + th2_idx = await self.read_single_attribute_check_success( + Clusters.OperationalCredentials, + attribute=Clusters.OperationalCredentials.Attributes.CurrentFabricIndex, dev_ctrl=TH2) + + self.print_step(18, "Remove TH2") + await self.send_single_cmd(cmd=Clusters.OperationalCredentials.Commands.RemoveFabric(fabricIndex=th2_idx)) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index 366c71f3ad12c0..fd8bece2a64dd4 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -400,8 +400,8 @@ async def send_single_cmd( result = await dev_ctrl.SendCommand(nodeid=node_id, endpoint=endpoint, payload=cmd, timedRequestTimeoutMs=timedRequestTimeoutMs) return result - def print_step(self, stepnum: int, title: str) -> None: - logging.info('***** Test Step %d : %s', stepnum, title) + def print_step(self, stepnum: typing.Union[int, str], title: str) -> None: + logging.info('***** Test Step {} : {}'.format(stepnum, title)) def generate_mobly_test_config(matter_test_config: MatterTestConfig): @@ -560,6 +560,8 @@ def root_index(s: str) -> int: def populate_commissioning_args(args: argparse.Namespace, config: MatterTestConfig) -> bool: + config.dut_node_id = args.dut_node_id + if args.commissioning_method is None: return True @@ -569,7 +571,6 @@ def populate_commissioning_args(args: argparse.Namespace, config: MatterTestConf if args.dut_node_id is None: print("error: When --commissioning-method present, --dut-node-id is mandatory!") return False - config.dut_node_id = args.dut_node_id if args.discriminator is None and (args.qr_code is None and args.manual_code is None): print("error: Missing --discriminator when no --qr-code/--manual-code present!") diff --git a/src/python_testing/test_testing/test_TC_DA_1_2.py b/src/python_testing/test_testing/test_TC_DA_1_2.py new file mode 100755 index 00000000000000..52a45407ba4aa6 --- /dev/null +++ b/src/python_testing/test_testing/test_TC_DA_1_2.py @@ -0,0 +1,99 @@ +#!/usr/bin/env -S python3 -B +# +# Copyright (c) 2023 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. +# + +import json +import os +import subprocess + +CHIP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../..')) +RUNNER_SCRIPT_DIR = os.path.join(CHIP_ROOT, 'scripts/tests') + + +def run_single_test(dac_provider: str, product_id: int, factory_reset: bool = False) -> int: + + reset = "" + if factory_reset: + reset = ' --factoryreset' + + app = os.path.join(CHIP_ROOT, 'out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app') + + # Certs in the commissioner_dut directory use 0x8000 as the PID + app_args = '--discriminator 1234 --KVS kvs1 --product-id ' + \ + str(product_id) + ' --vendor-id 65521 --dac_provider ' + dac_provider + + ci_pics_values = os.path.abspath(os.path.join(CHIP_ROOT, 'src/app/tests/suites/certification/ci-pics-values')) + script_args = '--storage-path admin_storage.json --discriminator 1234 --passcode 20202021 --dut-node-id 1 --PICS ' + \ + str(ci_pics_values) + + # for any test with a dac_provider, we don't want to recommission because there's a chance the + # dac could be wrong and the commissioning would fail. Rely on the original commissioning. This is also faster. + if factory_reset: + script_args = script_args + ' --commissioning-method on-network' + + script = os.path.abspath(os.path.join(CHIP_ROOT, 'src/python_testing/TC_DA_1_2.py')) + + # run_python_test uses click so call as a command + run_python_test = os.path.abspath(os.path.join(RUNNER_SCRIPT_DIR, 'run_python_test.py')) + cmd = str(run_python_test) + reset + ' --app ' + str(app) + ' --app-args "' + \ + app_args + '" --script ' + str(script) + ' --script-args "' + script_args + '"' + + return subprocess.call(cmd, shell=True) + + +def main(): + cert_path = os.path.abspath(os.path.join(CHIP_ROOT, 'credentials/development/commissioner_dut')) + + # Commission first using a known good set, then run the rest of the tests without recommissioning + path = str(os.path.join(cert_path, "struct_cd_authorized_paa_list_count1_valid/test_case_vector.json")) + run_single_test(path, 32768, factory_reset=True) + + test_cases = {'struct_cd': 32768, 'fallback_encoding': 177} + + # struct_cd_version_number_wrong - excluded because this is a DCL test not covered by cert + # struct_cd_cert_id_mismatch - excluded because this is a DCL test not covered by cert + exclude_cases = ['struct_cd_version_number_wrong', 'struct_cd_cert_id_mismatch'] + + passes = [] + for p in os.listdir(cert_path): + matches = list(filter(lambda t: t in str(p), test_cases.keys())) + if len(matches) != 1: + continue + + if str(p) in exclude_cases: + continue + + path = str(os.path.join(cert_path, p, 'test_case_vector.json')) + with open(path, 'r') as f: + j = json.loads(f.read()) + success_expected = j['is_success_case'].lower() == 'true' + + ret = run_single_test(path, test_cases[matches[0]]) + passes.append((str(p), ret, success_expected)) + + retval = 0 + for p in passes: + success = p[1] == 0 + if p[2] != success: + print('INCORRECT: ' + p[0]) + retval = 1 + + return retval + + +if __name__ == '__main__': + main() diff --git a/src/python_testing/test_testing/test_TC_DA_1_5.py b/src/python_testing/test_testing/test_TC_DA_1_5.py new file mode 100755 index 00000000000000..126814ca615f29 --- /dev/null +++ b/src/python_testing/test_testing/test_TC_DA_1_5.py @@ -0,0 +1,85 @@ +#!/usr/bin/env -S python3 -B +# +# Copyright (c) 2023 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. +# + +import os +import subprocess + +CHIP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../..')) +RUNNER_SCRIPT_DIR = os.path.join(CHIP_ROOT, 'scripts/tests') + + +def run_single_test(flag: str, factory_reset: bool = False) -> int: + + reset = "" + if factory_reset: + reset = ' --factoryreset' + + app = os.path.join(CHIP_ROOT, 'out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app') + + # Certs in the commissioner_dut directory use 0x8000 as the PID + app_args = '--discriminator 1234 --KVS kvs1 ' + flag + + ci_pics_values = os.path.abspath(os.path.join(CHIP_ROOT, 'src/app/tests/suites/certification/ci-pics-values')) + script_args = '--storage-path admin_storage.json --discriminator 1234 --passcode 20202021 --dut-node-id 1 --PICS ' + \ + str(ci_pics_values) + + # for any test with a dac_provider, we don't want to recommission because there's a chance the + # dac could be wrong and the commissioning would fail. Rely on the original commissioning. This is also faster. + if factory_reset: + script_args = script_args + ' --commissioning-method on-network' + + script = os.path.abspath(os.path.join(CHIP_ROOT, 'src/python_testing/TC_DA_1_5.py')) + + # run_python_test uses click so call as a command + run_python_test = os.path.abspath(os.path.join(RUNNER_SCRIPT_DIR, 'run_python_test.py')) + cmd = str(run_python_test) + reset + ' --app ' + str(app) + ' --app-args "' + \ + app_args + '" --script ' + str(script) + ' --script-args "' + script_args + '"' + + return subprocess.call(cmd, shell=True) + + +def main(): + # Commission first using a known good set, then run the rest of the tests without recommissioning + passes = [] + # test flag, test result, success expected + passes.append(("", run_single_test("", factory_reset=True), True)) + + failure_flags = ['--cert_error_csr_incorrect_type', + '--cert_error_csr_existing_keypair', + '--cert_error_csr_nonce_incorrect_type', + '--cert_error_csr_nonce_too_long', + '--cert_error_csr_nonce_invalid', + '--cert_error_nocsrelements_too_long', + '--cert_error_attestation_signature_incorrect_type', + '--cert_error_attestation_signature_invalid'] + + for f in failure_flags: + passes.append((f, run_single_test(f), False)) + + retval = 0 + for p in passes: + success = p[1] == 0 + if p[2] != success: + print('INCORRECT: ' + p[0]) + retval = 1 + + return retval + + +if __name__ == '__main__': + main() diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 9d9732d6d955d4..1d4c20a87fc79e 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -47,6 +47,8 @@ class TestList : public Command printf("Test_TC_ACL_2_10\n"); printf("Test_TC_ACE_1_1\n"); printf("Test_TC_ACE_1_5\n"); + printf("Test_TC_AIRQUAL_1_1\n"); + printf("Test_TC_AIRQUAL_2_1\n"); printf("Test_TC_BOOL_1_1\n"); printf("Test_TC_BOOL_2_1\n"); printf("Test_TC_BRBINFO_1_1\n"); @@ -9435,6 +9437,315 @@ class Test_TC_ACE_1_5Suite : public TestCommand } }; +class Test_TC_AIRQUAL_1_1Suite : public TestCommand +{ +public: + Test_TC_AIRQUAL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_AIRQUAL_1_1", 11, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_AIRQUAL_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::ClusterRevision::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!AIRQUAL.S.F00 && !AIRQUAL.S.F01 && !AIRQUAL.S.F02 && !AIRQUAL.S.F03"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 3: { + LogStep(3, "Given AIRQUAL.S.F00(Fair) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("AIRQUAL.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 4: { + LogStep(4, "Given AIRQUAL.S.F01(Moderate) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("AIRQUAL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "Given AIRQUAL.S.F02(VeryPoor) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("AIRQUAL.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, "Given AIRQUAL.S.F03(ExtremelyPoor) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("AIRQUAL.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::AcceptedCommandList::Id, + true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::GeneratedCommandList::Id, + true, chip::NullOptional); + } + case 10: { + LogStep(10, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::EventList::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_AIRQUAL_2_1Suite : public TestCommand +{ +public: + Test_TC_AIRQUAL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_AIRQUAL_2_1", 2, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_AIRQUAL_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::AirQuality::AirQualityEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 6U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the AirQuality attribute."); + VerifyOrDo(!ShouldSkip("AIRQUAL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::AirQuality::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + class Test_TC_BOOL_1_1Suite : public TestCommand { public: @@ -121768,6 +122079,8 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 5b8921287153fe..48f12352b38286 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -43,6 +43,8 @@ class TestList : public Command { printf("Test_TC_ACL_2_3\n"); printf("Test_TC_ACE_1_1\n"); printf("Test_TC_ACE_1_5\n"); + printf("Test_TC_AIRQUAL_1_1\n"); + printf("Test_TC_AIRQUAL_2_1\n"); printf("Test_TC_BOOL_1_1\n"); printf("Test_TC_BOOL_2_1\n"); printf("Test_TC_BRBINFO_1_1\n"); @@ -6402,6 +6404,520 @@ class Test_TC_ACE_1_5 : public TestCommandBridge { } }; +class Test_TC_AIRQUAL_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_AIRQUAL_1_1() + : TestCommandBridge("Test_TC_AIRQUAL_1_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_AIRQUAL_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_AIRQUAL_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_AIRQUAL_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!AIRQUAL.S.F00 && !AIRQUAL.S.F01 && !AIRQUAL.S.F02 && !AIRQUAL.S.F03")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Given AIRQUAL.S.F00(Fair) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("AIRQUAL.S.F00")) { + NextTest(); + return; + } + err = TestGivenAIRQUALSF00FairEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given AIRQUAL.S.F01(Moderate) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("AIRQUAL.S.F01")) { + NextTest(); + return; + } + err = TestGivenAIRQUALSF01ModerateEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress( + chipTool, " ***** Test Step 5 : Given AIRQUAL.S.F02(VeryPoor) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("AIRQUAL.S.F02")) { + NextTest(); + return; + } + err = TestGivenAIRQUALSF02VeryPoorEnsureFeaturemapHasTheCorrectBitSet_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Given AIRQUAL.S.F03(ExtremelyPoor) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("AIRQUAL.S.F03")) { + NextTest(); + return; + } + err = TestGivenAIRQUALSF03ExtremelyPoorEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_10(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 11; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenAIRQUALSF00FairEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given AIRQUAL.S.F00(Fair) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenAIRQUALSF01ModerateEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given AIRQUAL.S.F01(Moderate) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenAIRQUALSF02VeryPoorEnsureFeaturemapHasTheCorrectBitSet_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given AIRQUAL.S.F02(VeryPoor) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenAIRQUALSF03ExtremelyPoorEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given AIRQUAL.S.F03(ExtremelyPoor) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_AIRQUAL_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_AIRQUAL_2_1() + : TestCommandBridge("Test_TC_AIRQUAL_2_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_AIRQUAL_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_AIRQUAL_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_AIRQUAL_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the AirQuality attribute.\n"); + if (ShouldSkip("AIRQUAL.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAirQualityAttribute_1(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 2; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheAirQualityAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAirQualityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AirQuality attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("airQuality", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("airQuality", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("airQuality", [value unsignedCharValue], 6U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class Test_TC_BOOL_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -146039,6 +146555,8 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),